D1X
D1X

Reputation: 5444

Makefile syntax error. Missing separator

I need to understand the syntax of a makefile prior to modify it to fit my own needs. Searching through the net I have been able to understand most of it, but the last part is giving me a syntax error:

Makefile:119: *** missing separator. Stop.

line 119 is the first one here:

        rm -rf $(CLEANFILES)
.cpp.o:
        $(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$<
.cpp.obj:
        $(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi`
.c.o:
        $(CC) $(CFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$<
.c.obj:
        $(CC) $(CFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi`

I don't really get what's being done in these last lines, and I can't seem to find the information I need in the GNU make manual,

Thanks

Upvotes: 2

Views: 534

Answers (1)

Eric Melski
Eric Melski

Reputation: 16790

Since you've cut-and-pasted from your actual Makefile it's hard to give a certain answer. If the first line you provided, rm -rf $(CLEANFILES) truly is line 119 and the makefile is valid until then, it's likely that you don't have a TAB preceding the rm -rf $(CLEANFILES). It should look like this:

clean:
        rm -rf $(CLEANFILES)
.cpp.o:
        $(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$<
.cpp.obj:
        $(CXX) $(CXXFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi`
.c.o:
        $(CC) $(CFLAGS) $(INCL) -c -o $@ `test -f '$<' || echo '$(SRCDIR)/'`$<
.c.obj:
        $(CC) $(CFLAGS) $(INCL) -c -o $@ `if test -f '$<'; then $(CYGPATH_W) '$<'; else $(CYGPATH_W) '$(SRCDIR)/$<'; fi`

That is, the command lines in each recipe must have a literal TAB character at the start of the line.

Upvotes: 1

Related Questions