当前位置: 技术问答>linux和unix
makefile 包含mk文件错误为啥呢??
来源: 互联网 发布时间:2017-05-23
本文导语: #!binsh ROOT ?= $(PWD) FLAGS_PATH ?= $(ROOT)/borad_flag.mk -include $(FLAGS_PATH) print: @echo "include path" @echo $(FLAGS_PATH) @echo $(SRC) CC = gcc RM = rm OBJ = test1.o SRC = $(ROOT)/test1.c TARGETS = main all: ...
#!binsh
ROOT ?= $(PWD)
FLAGS_PATH ?= $(ROOT)/borad_flag.mk
-include $(FLAGS_PATH)
print:
@echo "include path"
@echo $(FLAGS_PATH)
@echo $(SRC)
CC = gcc
RM = rm
OBJ = test1.o
SRC = $(ROOT)/test1.c
TARGETS = main
all:
$(CC) $(CFLAGS) -o $(TARGETS) $(OBJ)
clean:
$(RM) -f $(OBJ) $(TARGETS)
[user@localhost Mk_define]$ vi borad_flag.mk
CFLAGS +=
-DENABLE_MYTEST =1
-DENABLE_USB=1
-DENABLE_PRINT=1
-DENABLE_BOOT_MUSIC=1
[user@localhost Mk_define]$ make all
gcc -DENABLE_MYTEST =1 -DENABLE_USB=1 -DENABLE_PRINT=1 -DENABLE_BOOT_MUSIC=1
-o main test1.o
gcc: =1: No such file or directory
make: *** [all] Error 1
求救呀!!!
ROOT ?= $(PWD)
FLAGS_PATH ?= $(ROOT)/borad_flag.mk
-include $(FLAGS_PATH)
print:
@echo "include path"
@echo $(FLAGS_PATH)
@echo $(SRC)
CC = gcc
RM = rm
OBJ = test1.o
SRC = $(ROOT)/test1.c
TARGETS = main
all:
$(CC) $(CFLAGS) -o $(TARGETS) $(OBJ)
clean:
$(RM) -f $(OBJ) $(TARGETS)
[user@localhost Mk_define]$ vi borad_flag.mk
CFLAGS +=
-DENABLE_MYTEST =1
-DENABLE_USB=1
-DENABLE_PRINT=1
-DENABLE_BOOT_MUSIC=1
[user@localhost Mk_define]$ make all
gcc -DENABLE_MYTEST =1 -DENABLE_USB=1 -DENABLE_PRINT=1 -DENABLE_BOOT_MUSIC=1
-o main test1.o
gcc: =1: No such file or directory
make: *** [all] Error 1
求救呀!!!
|
$(CC) $(CFLAGS) -o $(TARGETS) $(OBJ) 应该为
$(CC) $(LDFLAGS) -o $(TARGETS) $(OBJ)改为:
$(CC) $(LDFLAGS) -o $(TARGETS) $(OBJ)改为:
|
LDFLAGS 是链接选项