【发布时间】:2018-06-14 06:35:57
【问题描述】:
我正在尝试在我们的一个 make 文件中编写 'if' check in define 指令。 实际上我正在尝试检查平台并继续进行环境设置。
define templ_32
mkdir -p $(@D)
if [ "$(PLAT)" = "x86_64" ]; then env PERLLIB=$(EXTLIBS)/$(PLAT32)/lib/perl5/site_perl/5.10.0 --template $<; fi
if [ "$(PLAT)" = "aarch64" ]; then env PERLLIB=$(EXTLIBS)/$(PLAT32)/lib/perl5/site_perl/5.8.0 --template $<; fi
endef
我在我的目标配方之一中使用上述定义指令,如下所示。
some/%.c: test/tmpl-%.c $(NEW_DATA32)
$(templ_32) --initialization $(NEW_DATA32)
当我运行具有上述更改的构建时。我收到错误:
/bin/sh: -c: line 0: syntax error near unexpected token `--initialization'
而且从日志中我看到的整个“如果”条件如下。
if [ "aarch64" = "x86_64" ]; then env PERLLIB=$(EXTLIBS)/$(PLAT32)/lib/perl5/site_perl/5.8.0 --template /test/deploy/tmpl-kt.c ; fi --initialization /work/deploy/test.pl
从我的成功日志中,我只能看到没有共同的“if”语句
env PERLLIB=$(EXTLIBS)/$(PLAT32)/lib/perl5/site_perl/5.8.0 --template /test/deploy/tmpl-kt.c --initialization /work/deploy/test.pl
我不想让 'if' 检查与 'env' 命令一起使用。我只对
env PERLLIB=$(EXTLIBS)/$(PLAT32)/lib/perl5/site_perl/5.8.0 --template
我该如何解决这个问题?
【问题讨论】: