Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

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

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..

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...