I have a big makefile that I have configured with several phony targets. One to compile the program with debug flags, one to compile with optimization flags, etc.
One problem I am having is that when you previously use one target but then specify another target later, it does not know that it needs to recompile all the files with the new set of flags.
For instance I compile everything with the debug target. After compilation I test the program. Seeing no problems I try to run make with the optimization target but it compiles nothing as everything is up to date by Make’s reckoning.
I just had the idea of making the location of the object files dependent on the target chosen, but other than that I have nothing.
Is there any way to handle this elegantly?
1 Answer