This manual introduces the use of GNU Make, including make overview, Makefile file introduction, writing Makefile files, writing rules, using commands in rules, using variables, Makefile file condition statements, text conversion functions, executing make and using implicit rules.
This manual introduces GNU Make, a tool that automatically determines which files in a program need to be rebuilt and executes the necessary commands. It covers the basic concepts of Makefiles, rule syntax, and how to invoke make to compile projects.
The guide also details advanced topics such as using variables, implicit (suffix) rules, pattern rules, parallel execution, and special targets like .PHONY and clean. Example Makefiles and command-line options are provided throughout the document. This manual is written in Chinese.
| Version | 3.79 |
|---|
Type the command `make` in the directory containing the Makefile.
Use the `make clean` command, which runs the clean target defined in the Makefile.
A .PHONY target defines a name that is not a real file, used for actions like `clean` that should always run.
Define a variable (e.g., `objects = main.o kbd.o …`) and reference it with `$$(objects)` to avoid listing files repeatedly.