If makefile changes, make rebuilds all targets right?
But how to tell make that if after makefile changed, it shall run make clean and then make?
Or how to instruct make to run some other command in that situation? Do I have to write a special kind of target?
I believe that you want to run clean automatically because you want certain targets to be rebuilt whenever make is called. This can be achieved by adding a dependency named
FORCEto the rule whose target you want to build always and then defineFORCElike this: ie no rule and no dependency.Please see http://www.gnu.org/software/make/manual/make.html#Force-Targets
If you want all files to be recompiled, you add the following to the makefile: