如何打印makefile中的值

如何打印makefile中的值,makefile,gnu-make,Makefile,Gnu Make,我有一个要调试的make文件。我有一个结构如下: ifeq ($(CC_VER),4.3) error "I am here" AR = ar6x qwe CSL_LIBDIR = $(CC_DIR)\lib CSL_INCDIR = $(CC_DIR)\include else error "Please check that commands and include/lib path are correct for your version o

我有一个要调试的make文件。我有一个结构如下:

ifeq ($(CC_VER),4.3)
error "I am here"
AR             = ar6x qwe
CSL_LIBDIR     = $(CC_DIR)\lib
CSL_INCDIR     = $(CC_DIR)\include
else
    error "Please check that commands and include/lib path are correct for your version of CC  compiler"
endif
但它不起作用。从batchfile运行此makefile,该文件将CC\u版本设置为:

set CC_VER= 4.3
我想找到一种打印出抄送版本的方法,这样我就可以找到if不起作用的原因

还有,如何生成错误?错误“消息”不起作用

我正在使用Gmake。

您可以使用
$(错误文本…
构造错误。当消息为
text
时,它会生成致命错误,如下所示:

$(error Please check that commands and include/lib path are correct for your version of CC  compiler)
类似地,您也可以使用
$(info text…
构造来提供信息,如中所示

$(info CC_VER has the value "$(CC_VER)")
有关文档,请参阅

如果您只是想快速检查变量的值,还可以使用
-p
--print database
选项来
make
,这将打印所有规则和变量值

if
语句失败,因为
set CC\u VER
命令中的
=
4.3
之间有空格。此空格保留在变量值中,因此
$(CC\u VER)
不等于
4.3
,而是等于
4.3