Using GNU Make to build both debug and release targets at the same time
I'm working on a medium sized project which contains several libraries with interdependence's which I've recently converted over to build using a non-recursive makefile. My next goal is to enable building of both debug and release builds out of the same source tree at the same time (make debug;make release). My first step was to make debug and release targets which contained the correct build flags. I did this using target specific variables, like this: CXXFLAGS=-Wall -Wextra -Werror -DLINUX CXX_DEBUG_FLAGS=-g3 -DDEBUG_ALL CXX_RELEASE_FLAGS=-O3 .PHONY: debug debug: CXXFLAGS+=$(CXX_DEBUG_FLAGS)