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

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 do this, it shows an error .... Syntax error: word unexpectedly (expected ")")?

Plzz .. Help ..

+7
makefile
source share
1 answer

The formatting in your question (both the makefile and the error message) is too confusing, but I suspect your ifeq is indented with tabs.

This is not true; ifeq - make command. (Almost) all lines with TAB characters when the first character in a line in a makefile is passed to the shell. The shell knows nothing about ifeq , so, depending on your shell, it might print such an error.

You have to move the target app: after the ifeq blocks just before using $(CC) (and make sure the line $(CC) ... is indented with a tab as the first character on that line).

In the future, please remember to use the SO formatting capabilities and remember to cut and paste error messages accurately, plus a few lines of context before and after, asking questions.

+21
source share

All Articles