我的简单makefile
#export PATH=/xxx/bin:$$PATH
$(info $(PATH))
export ABC=123
t:
echo $${PATH}
echo $${ABC}
运行正常。直到我取消第一行的注释。以下是之前和之后的输出之前:
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
echo ${PATH}
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games
echo ${ABC}
123
echo 123
123
之后:
/xxx/bin:$PATH
echo ${PATH}
/xxx/bin:$PATH
echo ${ABC}
123
echo 123
make: echo: Command not found
make: *** [t.mk:13: t] Error 127
您想要export PATH := /xxx/bin:$(PATH)
。