help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Dynamic top-level targets


From: Timothy Reilly
Subject: Dynamic top-level targets
Date: Wed, 11 Jun 2008 03:03:31 -0400

Hello-

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


%_debug: CXXFLAGS := $(CXXFLAGS) -Wall -g
%_debug: %

%_benchmark: CXXFLAGS := $(CXXFLAGS) -DBENCHMARK
%_benchmark: %

%_openmp: CXXFLAGS := $(CXXFLAGS) $(OMP)
%_openmp: %

%_release: CXXFLAGS := $(CXXFLAGS) -DNDEBUG -O2
%_release: %

%_vector: CXXFLAGS := $(CXXFLAGS) -DUSE_SIMD $(VECTOR_FLAGS)
%_vector: %


The idea was to be able to do something as such:

make vector_debug_openmp_benchmark

and have CXXFLAGS expand to all of the relevant flags.

The pattern match rules do not do what I'd like them to do, and I do not understand why.  Is what I'm trying to do feasible/possible?


Thanks in advance for your time,
Timothy Reilly
reply via email to

[Prev in Thread] Current Thread [Next in Thread]