我在shell脚本中有一个构建文件,该文件具有变量VAR,必须将其导出到makefile中。
在构建文件中,
if [ "$arg" == "something" ]; then
export VAR=$arg
fi
make
现在在makefile中,我需要在条件语句中使用该变量:
ifeq ( $(VAR),something)
CONFIGURE_OPTIONS = abcdef
else
CONFIGURE_OPTIONS = ghijkl
endif
但是永远不会以这种方式检查条件。如何使用此导出的变量?
在shell脚本中,
export VAR=hello
make all
在makefile中,
all :
ifeq ($(VAR),hello)
$(eval var1:="hello world in if block")
else
$(eval var1:="hello world in else block")
endif
@echo "$(var1)"
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句