makefile missing separator
I have a makefile (provided by third party) which gives the following error
Makefile:108: *** missing separator. Stop.
The line in question is the following if statement.... any ideas? have tried various replacing tabs with spaces and not got very far at all.开发者_开发知识库..
if have_sdl
libiulib_a_SOURCES += $(srcdir)/utils/dgraphics.cc
libiulib_a_SOURCES += $(srcdir)/utils/SDL_lines.cc
include_HEADERS += $(srcdir)/utils/SDL_lines.h
else
libiulib_a_SOURCES += $(srcdir)/utils/dgraphics_nosdl.cc
endif
Try it this way:
ifneq ($(have_sdl),)
libiulib_a_SOURCES += $(srcdir)/utils/dgraphics.cc
libiulib_a_SOURCES += $(srcdir)/utils/SDL_lines.cc
include_HEADERS += $(srcdir)/utils/SDL_lines.h
else
libiulib_a_SOURCES += $(srcdir)/utils/dgraphics_nosdl.cc
endif
This checks if have_sdl is non empty (meaning defined to TRUE, yes, 1 or something other than empty string)
If there is no space between ifeq and opening of bracket then also it causes the same warning.
it should be ifeq ()
I am not aware of any make dialect that allows if
keyword. The code you cited is neither POSIX make, nor GNU make.
Examples of working syntax include:
ifdef have_sdl
... (rest is the same)
and
ifneq ($(have_sdl),) #not equal to empty string
... (rest is the same)
.
If I remember correctly, the makefile-mode
in emacs
highlights whitespace syntax errors with red. Try loading the Makefile in emacs to see if the error is obvious.
IIRC (it's been a while) that if/else is a GNU makeism. If you are not running GNU make then this may well fail. Solution is to install GNU make.
I have seen problems like this caused by blank lines that aren't blank - they contain tabs or spaces. Clearing out all whitespace on the blank lines may solve it.
Edited to add: Upon rereading your question, I see that this may not be your particular problem given the line number and code you posted, but it could be a problem for others so I will leave my answer.
精彩评论