For example, suppose you add a macro or a declaration to a header file, on which the other files depend. Sometimes you may have changed a source file but you may not want to recompile all the files that depend on it. There may be a project consisting of thousands of files. If source file has a newer time stamp than the object file, then it generates new object file assuming that the source file has been changed. While compiling a file, the make checks its object file and compares the time stamps. However if you make any change in main.cpp, as this is not dependent of any other file, then only main.cpp file is recompiled, and help.cpp and factorial.cpp are not. Hence if you make any changes in functions.h, then the make recompiles all the source files to generate new object files. If you have four files main.cpp, hello.cpp, factorial.cpp and functions.h, then all the remaining files are dependent on functions.h, and main.cpp is dependent on both hello.cpp and factorial.cpp. The make program is an intelligent utility and works based on the changes you do in your source files.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |