【问题标题】:Run pre-requisite tasks before anything else in GNU Make?在 GNU Make 中运行任何其他任务之前运行先决条件任务?
【发布时间】:2020-08-10 15:01:34
【问题描述】:

我有一个目标如下的 Makefile:

all: a b

a: a_prereqs a_steps
b: b_prereqs b_steps

ab 需要一段时间才能运行并具有先决条件。我希望a_prereqsb_prereqs 都先运行(这样我就不必等待a_steps 完成后才发现b_steps 会失败。

但我不想让b_prereqs 运行除非我正在运行b

如何在 GNU Make 中做到这一点?

【问题讨论】:

    标签: gnu-make


    【解决方案1】:
    all: a b
    
    a: a_steps
    b: b_steps
    
    a_steps: a_prereqs
    b_steps: b_prereqs
    

    然后运行 ​​make 处理更多作业

    $ make -j X
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-04-17
      • 1970-01-01
      • 1970-01-01
      • 2015-04-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多