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

时间:2018-03-02 10:05:33

标签: linux 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]是一个标签字符。

#-----------------------------------------------------------------------#
#     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

1 个答案:

答案 0 :(得分:2)

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

#-----------------------------------------------------------------------#
#     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