what's the DRY version of the following Makefile targets?
Posted
by carneades
on Stack Overflow
See other posts from Stack Overflow
or by carneades
Published on 2010-04-03T20:22:33Z
Indexed on
2010/04/03
20:33 UTC
Read the original article
Hit count: 294
I don't know how to execute a command stored as a variable or how to use ifeq
inside of a target, so I have a very redundant Makefile at the moment!
Ideally I'd like to have just one target (all
) which would run the stored command on Mac and run it twice on Linux, once with -m32 and once with -m64.
all:
echo PLEASE SELECT OS, e.g. make linux
exit 1
mac:
gcc $(SHARED_OPT) $(GENERAL_CFLAGS) $(PLATFORM_CFLAGS) -o $(BUILD_DIR)$(BUILD_NAME) $(SOURCE) $(LIBRARIES)
linux:
gcc $(SHARED_OPT) $(GENERAL_CFLAGS) $(PLATFORM_CFLAGS) -o $(BUILD_DIR)$(BUILD_NAME64) $(SOURCE) $(LIBRARIES64) -m64
gcc $(SHARED_OPT) $(GENERAL_CFLAGS) $(PLATFORM_CFLAGS) -o $(BUILD_DIR)$(BUILD_NAME) $(SOURCE) $(LIBRARIES) -m32
© Stack Overflow or respective owner