build - doubility-sky/daydayup GitHub Wiki

Build automation is the process of automating the creation of a software build and the associated processes including: compiling computer source code into binary code, packaging binary code, and running automated tests.

Learn

  • 每条规则的形式
    <target> : <prerequisites> 
    [tab]  <commands>
    
  • order-only依赖,使用管道符号 '|' 分隔 常规依赖 和 order-only依赖,order-only依赖通常用来创建目录targets : normal-prerequisites | order-only-prerequisites
  • 伪目标 .PHONY,声明clean是"伪目标"之后,make就不会去检查是否存在一个叫做clean的文件,而是每次运行都执行对应的命令。
    .PHONY: clean
    clean:
    	rm *.o temp
  • 目标变量 <target ...> : variable-assignment
  • 自动变量
    • $@ 当前目标
      • $(@D)$(@F) 分别指向 $@ 的目录名和文件名
      • 比如,$@src/input.c,那么 $(@D) 的值为 src$(@F) 的值为 input.c
    • $< 第一个依赖
      • $(<D)$(<F) 分别指向 $< 的目录名和文件名
    • $^ 所有依赖,但不包括 order-only依赖
    • $? 比目标更新的所有依赖,以空格分隔
    • $* 指代匹配符 % 匹配的部分, 比如 % 匹配 f1.txt 中的 f1$* 就表示 f1
  • Makefile简明教程
  • Make 命令教程
  • 跟我一起写Makefile

Make-likes

Next Generations

  • SCons
  • Waf
  • Meson® is a project to create the best possible next-generation build system.

Resources

  • Awesome CMake: A curated list of awesome CMake resources, scripts, modules and examples.
⚠️ **GitHub.com Fallback** ⚠️