Reputation: 1277
When I edit one source file, does running make recompile that file plus all files for which that one is a dependency? If so, why?
Upvotes: 0
Views: 188
Reputation: 206616
Why?
Because that is the whole purpose of having an Make file.
If a particular source file is modified then all dependant files should be recompiled with the modified file so that all of the dependant files refer the same source and the entire code base is in sync.
How?
make
utility checks timestamps to check which files were modified.When an make file is created One needs to specify dependency rules which explicitly tell the utility which other files are dependant on particular file. So using these rules Make compiles all dependent files as well, So that the binaries generated refer the same updated code.
Upvotes: 4
Reputation: 62106
If that file is #included in other files, it's reasonable to expect those other files to recompile as well as you don't want to have a "half" of your program new and the other "half" old.
Upvotes: 4
Reputation: 64273
When I edit one source file, does running make recompile that file plus all files for which that one is a dependency? If so, why?
It can happen for a bad makefile (you haven't posted how it looks like).
Or the source file contains the implementation of a template, and is included somewhere.
Upvotes: 0