Sometimes it seems like not a new executable is built, even though I need one, but I don’t understand why. For example, when I change a Makefile, but there is already an executable, and when I execute ‘make’ it doesn’t create an updated executable.
Isn’t the whole purpose of Makefiles so that I don’t need to worry about that stuff anymore?
From the GNU make documentation
It’s not changing your Makefile that triggers it.
make cleanremoves all the object files that had been created in the meantime. Normally, it’s no big deal to partially recompile, i.e. only to recompile the files you changed and finally link the newly created object files with the pre-existing ones. Still, if you want to be absolutely safe, you should runmake cleanbefore runningmakeagain.An example where keeping old object files (i.e. never running make clean) may become a problem: Suppose you have an already existing object file that is meant to be linked against version 1.0 of some library. Now you update your machine and this will install version 1.1 on it, where some function is incompatible to the of function 1.0. But since your object file was compiled expecting the prior version the linking process will ultimately fail.