makefile - 为什么在 Makefile 中使用 exec?

标签 makefile

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/

相关文章:

makefile - 如何使 Make *not* 打印“目标配方失败?

makefile - 调用 Make 时抑制 Makefile 输出

c - gcc:错误:缺少 '-l' 的参数

makefile - 使用 make 将消息文件放置在正确的目录结构中

asynchronous - 可以使用命令的 gvim 远程选项卡吗?

c++ - 如何静态编译 boost_iostreams?

makefile - make 'vpath' 指令,为什么它不足以满足这个先决条件?

shell - 在 makefile 中转义

c++ - make 中对 `main' 的 undefined reference

gcc - 安卓 NDK : how to let gcc to use additional include directories