-
Gnu Makefile help
I'm having an issue with my makefile. I'm new to building Makefiles, so forgive my ignorance. I have a project with several nested directories. The code in the directories are compiled into libraries, and then linked at the top level. Everything worked great when I output one executable.
Now I want to create two different executables with different compiler options. Here's a snippet of the makefile:
Code:
BUILD_A_EXECUTABLE = mw_A_exec
BUILD_B_EXECUTABLE = mw_B_exec
all :
$(MAKE) build_a build_b
build_a : $(DIRS)
$(MAKE) $(BUILD_A_EXECUTABLE)
build_b : $(DIRS)
$(MAKE) $(BUILD_B_EXECUTABLE)
...
############## BUILD A ##############
ifeq ($(MW_TYPE_A),1)
CPPFLAGS = -g -Wall $(INCLS) \
-DDtHLA=1 -DRTI_USES_STD_FSTREAM
else ########## BUILD B ##############
CPPFLAGS = -g -Wall $(INCLS) \
-DDtDIS=1
endif
How can I define MW_TYPE_A = 1 only when I'm creating BUILD_A_EXECUTABLE and not when I'm building BUILD_B_EXECUTABLE?
Any help would be great! Thanks.
tjkrz
-
Hi ,
If I got ur problem correctly.....The solution would be...do this while running makefile
$ make MW_TYPE_A = 1
or
$ make MW_TYPE_A = 2
Bi....Hope it works....