Makefile 中是否需要 exec
关键字?
build-cache: clean-cache
@exec ./scripts/copy_packages.sh
./scripts/build_makefile.sh
docker build -t common/cache ./cache
我只是注意到有些行使用了 exec 而有些则没有。
最佳答案
否(exec
不是make
中的关键字);你误解了这一行:
@exec ./scripts/copy_packages.sh
@
表示在执行此“配方”中的命令时“不要回显此行”。 exec
表示 make
开始运行该行的 shell 将自身替换为脚本 ./scripts/copy_packages.sh
。
另见 What do @
, -
and +
do as prefixes to recipe lines in make
?
关于makefile - 为什么在 Makefile 中使用 exec?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41923158/