Thread View: ahn.tech.linux
1 messages
1 total messages
Started by Marc-Olivier SAMBO
Sat, 06 Oct 2007 21:04
Re : ifdef FEATURE_1
Author: Marc-Olivier SAMBO
Date: Sat, 06 Oct 2007 21:04
Date: Sat, 06 Oct 2007 21:04
50 lines
1644 bytes
1644 bytes
#ifdef FEATURE_1
Message envoyοΏ½ : lundi 2 aout 2004 01:34
> // Do feature 1 stuff
> #endif
> Is there a way to do this without manually specifying each feature
> flag as an environment variable and a -D flag separately? I'd like to
> avoid having to keep each thing in sync.
Try something like this:
# --- GNU Makefile ---
# invoke with e.g.
# make FEATURES="FEATURE_1 FEATURE_2"
OBJ = main.o
ifneq ($(filter FEATURE_1,$(FEATURES)),)
OBJ += feature1.o
endif
ifneq ($(filter FEATURE_2,$(FEATURES)),)
OBJ += feature2.o
endif
CFLAGS += $(patsubst %,-D%,$(FEATURES))
prog : $(OBJ)
$(CC) -o $@ $^
clean : ; rm -f prog *.o
# --- END ---
Marc-Olivier SAMBO
--------------= Posted using GrabIt =----------------
------= Binary Usenet downloading made easy =---------
-= Get GrabIt for free from http://www.shemes.com/ =-
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads