About the understanding of MAKE in segmentation compilation

xiaoxiao2021-03-06  41

"Thinking In C " April Fool Revelation -------- About the Make in the segmentation compilation today read "Thinking In C " 3.11 "Make: Management Segmentation Compilation", Let me have deepened some software of VC. I used to always wonder when I was programmed, sometimes a program had to consist of seven eight CPP files. How did they compile into a file, I understand this chapter. We now use the C compiler to compile the Separate Compilation method. This method is generally a multi-source code file compilation of an executable file. When we compile him, we first compile these files into one Obj file, then connect them to the unique executable of the one we want. But why should we compile him into a one Obj file and then connect to an executable file, why not put all the source code in a file, then compile it directly into an executable, isn't it simpler? ? Yes, it is simple, but when a considerable file consists of a lot of source code, there are a lot of programmers to modify him. If each of our programmers want to perform the files modified, then Say that when the programmer is compiled into an executable, we have to completely recompile all the source code on whether you have modified it in other parts of the program. This is not that work efficiency is too low. And if we use segmentation, we only need to recompile the OBJ where the part of the code is changed, and the other is not used, and then connect them together to form an executable file, it seems efficient. Some people will be confused, how do the compiler know that file, that module is changed, need to recompile. Asked here, you should change the protagonist Makefile today, she is the protagonist and soul of segmentation. Below is an instance of makefile, I will explain the so-called mysterious Makefiel on this instance (where # 其中 注 注 注) # MakefileCPP = G ?? # Macro CPP, we define it as a Gun C macro name and value is modified, this Macro represents the compiler OFLAG = -O? # A flag allows the custom output file name. Suffixes: .o .cpp .c? # Description Make must pay attention to the suffix to .o .cpp .cpp .cpp .o :? ? # Compare .cpp .o If the previous new is executed $ (CPP) $ (cppflags) -c $

转载请注明原文地址:https://www.9cbs.com/read-60542.html

New Post(0)