Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax error: word unexpected (expecting ")")?

Tags:

makefile

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 shows error.... Syntax error: word unexpected (expecting ")") ?

Plzz.. Help..

like image 712
Chirag Parekh Avatar asked Jan 20 '14 05:01

Chirag Parekh


1 Answers

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.

like image 89
MadScientist Avatar answered Oct 26 '22 18:10

MadScientist