我有一个 makefile,其中导出将由可执行文件接收的变量,但令人惊讶的是可执行文件没有接收导出的值。
请帮我。
31 test:
32 @ echo
33 @ echo "Testing Electric Fence."
34 @ echo "After the last test, it should print that the test has PASSED."
35 ./eftest
36 ./tstheap 3072
37 export EF_ERRTRACK_START=3
38 export EF_ERRTRACK_END=5
39 ./time-interval-measurement-test
40 @ echo
41 @ echo "Electric Fence confidence test PASSED."
42 @ echo
time-interval-measurement-test
是一个可执行文件(C 程序),它应该接收导出的变量,但它没有获取。请帮我。
如果我没有记错的话,Makefile 中的每一行都是一个单独的 shell 进程。因此 shell-export 不适用于多个进程:一种方法是将它们放入一行:
test:
@ echo
@ echo "Testing Electric Fence."
@ echo "After the last test, it should print that the test has PASSED."
./eftest
./tstheap 3072
EF_ERRTRACK_START=3 EF_ERRTRACK_END=5 ./time-interval-measurement-test
@ echo
@ echo "Electric Fence confidence test PASSED."
@ echo
或用 '\' 进行换行转义
test:
[..]
EF_ERRTRACK_START=3 \
EF_ERRTRACK_END=5 \
./time-interval-measurement-test
就像 ENV 变量可用于 ./time-interval-measurement
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)