[C language core series] Makefile rules in C language

Except for very simple programs like Hello World, general programs are compiled and linked from multiple source files. The processing steps of these source files are usually managed by Makefile. The benefit of makefile is "automatic compilation". Once it is written, only one make command is needed, and the entire project is completely automatically compiled, which greatly improves the efficiency of software development. Make is a command tool, a command tool that interprets the instructions in the makefile. Generally speaking, most IDEs have this command.

The C language first compiles the source file into an intermediate code file, which is an .obj file under Windows, and an .o file, or ObjectFile under UNIX. This action is called compile. Then synthesize a large number of Object Files into executable files. This action is called link.

When compiling, what the compiler needs is correct syntax and correct declaration of functions and variables. For the latter, usually you need to tell the compiler the location of the header file (the header file should be just a declaration, and the definition should be placed in the C/C++ file), as long as all the syntax is correct, the compiler can compile the intermediate target file. Generally speaking, each source file should correspond to an intermediate target file ÿ

Guess you like

Origin blog.csdn.net/weixin_54707168/article/details/115016054