we currently generate a dependency file for every .o. But when do an incremental build, Make reads from the dependency file for dependencies for each .o. Is Make checking the time stamp of these dependent files and compare it with the .o? If so, is it possible to cache the status of dependencies to avoid too much I/O hit because of duplicated status checks for each object file?
for example,
a.o: h1.h h2.h
gcc...
b.o: h1.h h2.h
gcc...
If we cache the status of h1.h and h2.h when it builds a.o, do we save two checks when build b.o?
I am not familiar with the make system, but is currently looking for ways to improve its performance on a large legacy C project.
Use
stracefor that purpose:Output of the first run (full build):
And the second run (incremental build):
As you can see, GNU Make caches timestamps avoiding unnecessary
statsyscalls. However, I guess, things are not so good in case of using recursive make.