PLATFORM = x86
CUD = cuda
X86 = x86
PAN = panda
ARM = arm
app:
ifeq($(PLATFORM),$(CUD))
CC = dum3
endif
ifeq($(PLATFORM), $(X86))
CC = gcc
endif
ifeq($(PLATFORM),$(PAN))
CC = dum1
endif
ifeq($(PLATFORM),$(ARM))
CC = dum2
endif
$(CC) -o ./Executable/list ./Source/ll_main.c ./Library/liblst.a
./Executable/list
When I make
this, it throws the error....
Syntax error: word unexpected (expecting ")")
Please help fix this problem.
The formatting in your question (both the makefile and the error message) is too messed up to be sure, but my suspicion is that your ifeq
is indented with a TAB.
That's not right; ifeq
is a make command. (Almost) all lines with TAB characters as the first character on the line in a makefile is passed to the shell. The shell doesn't know anything about ifeq
, so, depending on your shell, might print an error like that.
You should move the app:
target after the ifeq
blocks to just before the use of $(CC)
(and ensure the $(CC) ...
line is indented with a TAB as the first character on that line).
In the future please be sure to use SO's formatting capabilities, and be sure to cut and paste error messages exactly, plus a few lines of context before and after, when asking questions.