Make给了我一个错误:
make/sources.make:16: *** missing separator. Stop.
The terminal process terminated with exit code: 2
生成此错误的代码是:
$(addprefix a,b)
我查过车位,但什么也没找到。
如果我把它注释掉,就不会出错。我把范围缩小到这一行,我想不出来。”“a”和“b”可以用任何东西代替,但仍然不起作用。但是,如果删除所有参数,如下所示
$(addprefix ,)
然后没有错误。
这是怎么回事?
包含错误的makefile的完整代码:
# sources.make - source files
# path of source files
SOURCEPATH=src
# build list of source files
# categorize source files
SOURCE_MAIN=main.c
# add categories to SOURCES as needed
SOURCES+=$(SOURCE_MAIN)
# add the SOURCEPATH to each source file
#$(addprefix $(SOURCEPATH),$(SOURCES)) <------ This is the true error code
$(addprefix a,b)
# extra files to remove
TRASHFILES = stdout.txt stderr.txt
# extra directories to remove
TRASHDIRS = junkdir
# build target
TARGET = $(PROG)$(EXT)
# generate object files
OBJECTS = $(patsubst %.c,%.o,$(SOURCES))
# generate dependency files
DEPENDS = $(patsubst %.c,%.d,$(SOURCES))