cs-self-learning/docs/必学工具/GNU_Make.md
Yukiteru ebc8150824 format markdown documents
This commit does the following things:

- Separate Chinese and English by a space
- Fix proper nouns
- Fix syntax problems of Markdown
- Move long links below
- Remove unnecessary suffix of links

Signed-off-by: Yukiteru <wfly1998@sina.com>
2022-04-03 17:39:04 +08:00

13 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# GNU Make
## 为什么学 GNU Make
大家第一次写 hello world 程序的时候一定都记得,在编辑完 `helloworld.c` 之后,需要用 `gcc` 编译生成可执行文件,然后再执行(如果你不理解前面这段话,请先自行谷歌 *gcc 编译* 并理解相关内容)。但如果你的项目由成百上千个 C 源文件组成,并且星罗棋布在各个子目录下,你该如何将它们编译链接到一起呢?假如你的项目编译一次需要半个小时(大型项目相当常见),而你只修改了一个分号,是不是还需要再等半个小时呢?
这时候 GNU Make 就闪亮登场了,它能让你在一个脚本里(即所谓的 `Makefile`)定义整个编译流程以及各个目标文件与源文件之间的依赖关系,并且只重新编译你的修改会影响到的部分,从而降低编译的时间。
## 如何学习 GNU Make
这里有一篇写得深入浅出的[文档](https://seisman.github.io/how-to-write-makefile/overview.html)供大家参考。
GNU Make 掌握起来相对容易,但用好它需要不断的练习。将它融入到自己的日常开发中,勤于学习和模仿其他优秀开源项目里的 `Makefile` 的写法,总结出适合自己的 template久而久之你对 GNU Make 的使用会愈加纯熟。