in shell when I enter
在我进入时的shell中
echo $demoPath
it prints
它打印
/usr/local/demo
how can I get this this variable of $demoPath
in makefile?
如何在makefile中获取$ demo的这个变量?
1 个解决方案
#1
58
If you've exported the environment variable:
如果您已导出环境变量:
export demoPath=/usr/local/demo
you can simply refer to it by name in the makefile
(make
imports all the environment variables you have set):
你可以简单地在makefile中通过名字引用它(make import你设置的所有环境变量):
DEMOPATH = ${demoPath} # Or $(demoPath) if you prefer.
If you've not exported the environment variable, it is not accessible until you do export it, or unless you pass it explicitly on the command line:
如果您没有导出环境变量,则在导出它之前无法访问它,或者除非您在命令行上显式传递它:
make DEMOPATH="${demoPath}" …
If you are using a C shell derivative, substitute setenv demoPath /usr/local/demo
for the export
command.
如果您使用的是C shell派生,请将setenv demoPath / usr / local / demo替换为export命令。
#1
58
If you've exported the environment variable:
如果您已导出环境变量:
export demoPath=/usr/local/demo
you can simply refer to it by name in the makefile
(make
imports all the environment variables you have set):
你可以简单地在makefile中通过名字引用它(make import你设置的所有环境变量):
DEMOPATH = ${demoPath} # Or $(demoPath) if you prefer.
If you've not exported the environment variable, it is not accessible until you do export it, or unless you pass it explicitly on the command line:
如果您没有导出环境变量,则在导出它之前无法访问它,或者除非您在命令行上显式传递它:
make DEMOPATH="${demoPath}" …
If you are using a C shell derivative, substitute setenv demoPath /usr/local/demo
for the export
command.
如果您使用的是C shell派生,请将setenv demoPath / usr / local / demo替换为export命令。