加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

makefile – 使用gnumake和先决条件并行构建

发布时间:2020-12-16 05:28:42 所属栏目:百科 来源:网络整理
导读:我的第一个问题(yay!)是关于gnumake和并行构建的.以下是一个快速示例文件: .PHONY: tool_1 tool_2 tool_3 tool_4 all toolsall: | toolstools: | tool_2 tool_3 tool_4tool_1: # commands for tool 1tool_2: | tool_1 # commands for tool 2tool_3: | tool
我的第一个问题(yay!)是关于gnumake和并行构建的.以下是一个快速示例文件:
.PHONY: tool_1 tool_2 tool_3 tool_4 all tools

all: | tools

tools: | tool_2 tool_3 tool_4

tool_1:
    # commands for tool 1

tool_2: | tool_1
    # commands for tool 2

tool_3: | tool_1
    # commands for tool 3

tool_4: | tool_1
    # commands for tool 4

如果我在这个家伙做了-j,我在这里正确的是确保tool_1的命令完全执行一次,然后make尝试构建任何tool_ [234]?

我正在寻找的是make -j,因为tool_1首先被构建,然后tool_ [234]被并行构建,但是没有执行三次用于tool_1的命令.我希望这是有道理的.感谢任何建议或想法!

解决方法

make -j的行为与您在问题中的期望完全一致.它不会多次依赖关系.

那个管道(|)字符在依赖列表中做什么?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读