As I was debugging and optimizing one of my C/C++-projects, I often disabled and enables the profiling flags -p -g -pg and some optimization flags in my Makefile to have a better look at whats happening.
However, GNU make did not detect this change and did not do a recompile.
How to properly rebuild a whole software project with some new flags (or some removed) without manually doing a make clean?
As a suggested tweak to Stefan’s above response, you can factor out build configuration into a separate file. Instead of somehow force-including this file in your code, you can list the name of this configuration file as a prereq (i.e. to the right of the colon) for all makefile rules you use to build code.