makefile错误***缺少分隔符。停止

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了makefile错误***缺少分隔符。停止相关的知识,希望对你有一定的参考价值。

有人会指出make文件问题的根本原因和修复方法吗?在Suse 12 SP2 x64上构建我遇到此错误:

tony@linux-31cz:~/sandbox> gmake -f gnumake.sys
gnumake.sys:18: *** missing separator.  Stop.
tony@linux-31cz:~/sandbox> 

我有这个版本:

tony@linux-31cz:~/sandbox> make --version
GNU Make 4.0
Built for x86_64-unknown-linux-gnu
Copyright (C) 1988-2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

下面是gnumake.sys,其中[TAB]是一个tab char。

#-----------------------------------------------------------------------#
#     Common definitions, can be overridden in Platform specific part
#-----------------------------------------------------------------------#
CC                = cc
CCPP              = CC
LIB               = ar rv
CP                = cp
RM                = rm -f
MV                = mv -f
TOUCH             = touch
NEEDMOVE          =
CPP_NEED_C_SUFFIX =
GREP_SEARCH       = "^# .* .*.[ch]"
AWK_COLUMN        = $$3
AWK_COLUMN_CPP    = $$3
WD               := $(shell pwd)

%if %env (BUILD_PRODUCT_VERSION, 712) 
[TAB]export BUILDFLAGVER = -DBUILD_PRODUCT_V712
[TAB]export TSMVERSIONTXT =7.1.2.0
[TAB]%if %env (VERSION_BASED_OUTPUT,1)
[TABTAB]export TSMVERSION=$(BUILD_PRODUCT_VERSION)
[TAB]%endif
%elseif %env (BUILD_PRODUCT_VERSION, 812)
[TAB]export BUILDFLAGVER = -DBUILD_PRODUCT_V713
[TAB]export TSMVERSIONTXT =7.1.3.0
[TAB]%if %env (VERSION_BASED_OUTPUT,1)
[TABTAB]export TSMVERSION=$(BUILD_PRODUCT_VERSION)
[TAB]%endif
%endif
答案

在给定的示例中,使用了错误的语法。正确的语法是这样的:

#-----------------------------------------------------------------------#
#     Common definitions, can be overridden in Platform specific part
#-----------------------------------------------------------------------#
CC                = cc
CCPP              = CC
LIB               = ar rv
CP                = cp
RM                = rm -f
MV                = mv -f
TOUCH             = touch
NEEDMOVE          =
CPP_NEED_C_SUFFIX =
GREP_SEARCH       = "^# .* .*.[ch]"
AWK_COLUMN        = $$3
AWK_COLUMN_CPP    = $$3
WD               := $(shell pwd)

ifeq ($(BUILD_PRODUCT_VERSION), 712)
        export BUILDFLAGVER = -DBUILD_PRODUCT_V712
        export TSMVERSIONTXT = 7.1.2.0
        ifeq ($(VERSION_BASED_OUTPUT), 1)
                export TSMVERSION=$(BUILD_PRODUCT_VERSION)
        endif
else ifeq ($(BUILD_PRODUCT_VERSION), 812)
        export BUILDFLAGVER = -DBUILD_PRODUCT_V713
        export TSMVERSIONTXT = 7.1.3.0
        ifeq ($(VERSION_BASED_OUTPUT), 1)
                export TSMVERSION=$(BUILD_PRODUCT_VERSION)
        endif
endif

您可以在这里找到详细说明:http://www.gnu.org/software/make/manual/make.html

以上是关于makefile错误***缺少分隔符。停止的主要内容,如果未能解决你的问题,请参考以下文章

make命令makefile出错:18:***缺少分隔符。停止

Makefile:2: *** 缺少分隔符。停止。我该如何解决这个问题我是 Raylib for C++ 的新手

Linux问题,Makefile 遗漏分隔符 停止

出错:缺少分隔符

*** 缺少分隔符会出错

Linux 报错 “ Makefile:4: *** missing separator。 停止。 ”