【问题标题】:Why use exec in Makefile?为什么在 Makefile 中使用 exec?
【发布时间】:2017-06-14 20:35:14
【问题描述】:

在 Makefile 中是否需要 exec 关键字?

build-cache: clean-cache                                    
    @exec ./scripts/copy_packages.sh
    ./scripts/build_makefile.sh
    docker build -t common/cache ./cache

我刚刚注意到有些行使用 exec 而其他行不使用。

【问题讨论】:

  • 是GNU的make吗?

标签: makefile


【解决方案1】:

否(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?

【讨论】:

    猜你喜欢
    • 2016-08-26
    • 1970-01-01
    • 2013-09-22
    • 1970-01-01
    • 2012-05-02
    • 1970-01-01
    • 2022-12-02
    • 2020-09-09
    • 1970-01-01
    相关资源
    最近更新 更多