I've got a program that I'd like to compile with varying
sets of options. All of these options are completely independent, and
the actual dependencies of the targets are the same- they differ only
in options passed to the commands. My idea was to have each set of
flags be a pattern match rule and an explicit rule. The pattern match
rule would match the option-set to the suffix, strip the suffix, and
depend on the prefix, which would repeat the process until only a
single option-set remained, which would match the explicit rule.
Here's the relevant portion of the makefile :
debug: CXXFLAGS := $(CXXFLAGS) -Wall -g debug: all
benchmark: CXXFLAGS := $(CXXFLAGS) -DBENCHMARK benchmark: all
openmp: CXXFLAGS := $(CXXFLAGS) $(OMP) openmp: all
release: CXXFLAGS := $(CXXFLAGS) -DNDEBUG -O2
release: all
vector: CXXFLAGS := $(CXXFLAGS) -DUSE_SIMD $(VECTOR_FLAGS) vector: all