makefile 缺少分隔符
我有一个 makefile(由第三方提供),它给出了以下错误
Makefile:108: *** missing separator. Stop.
有问题的行是以下 if 语句....有什么想法吗?已经尝试了各种用空格替换制表符的方法,但根本没有走得很远......
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
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
尝试这样:
这检查 have_sdl 是否非空(意味着定义为 TRUE、yes、1 或空字符串以外的其他值)
Try it this way:
This checks if have_sdl is non empty (meaning defined to TRUE, yes, 1 or something other than empty string)
如果 ifeq 和括号之间没有空格,那么也会导致相同的警告。
应该是ifeq()
If there is no space between ifeq and opening of bracket then also it causes the same warning.
it should be ifeq ()
我不知道任何 make 方言允许
if
关键字。您引用的代码既不是 POSIX make,也不是 GNU make。工作语法的示例包括:
和
。
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:
and
.
如果我没记错的话,
emacs
中的makefile-mode
用红色突出显示空白语法错误。尝试在 emacs 中加载 Makefile 以查看错误是否明显。If I remember correctly, the
makefile-mode
inemacs
highlights whitespace syntax errors with red. Try loading the Makefile in emacs to see if the error is obvious.IIRC(已经有一段时间了)if/else 是 GNU makeism。如果您没有运行 GNU make 那么这很可能会失败。解决方案是安装GNU make。
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.