Reputation: 823
Make is giving me the error:
make/sources.make:16: *** missing separator. Stop.
The terminal process terminated with exit code: 2
The code that is generating this error is:
$(addprefix a,b)
I've checked for spaces, but I didn't find anything.
If I comment it out, no errors are given. I've narrowed it down to this one line, and I can't figure it out. 'a' and 'b' can be replaced with anything, and it still won't work. However, if you remove all arguments to it, like this $(addprefix ,)
then no errors are given.
What is going on here?
Full code of makefile that contains the error:
# 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))
Upvotes: 2
Views: 830
Reputation: 144951
The offending line is interpreted as a rule, not a directive. It should instead read:
SOURCES := $(addprefix $(SOURCEPATH)/,$(SOURCES))
Upvotes: 4