CLAM_PATH ?= $(TOP) SRCDEPS=$(CLAM_PATH)/build/srcdeps/srcdeps all: program library clean: rm -rf obj/ dep/ Makefile.vars $(PROGRAM) lib$(LIBRARY).so distclean: clean rm -rf dep/ depend: .FORCE @echo Generating SOURCES, OBJECTS, DEPENDS and INCLUDES definitions $(SRCDEPS) settings.cfg > Makefile.vars .FORCE: ifneq ($(MAKECMDGOALS),clean) ifneq ($(MAKECMDGOALS),depend) include Makefile.vars include $(DEPENDS) endif endif Makefile.vars: Makefile $(SRCDEPS) @echo Generating SOURCES, OBJECTS, DEPENDS and INCLUDES definitions $(SRCDEPS) settings.cfg > Makefile.vars program: $(PROGRAM) library: $(LIBRARY) $(LIBRARY): lib$(LIBRARY).so ifeq ($(CONFIG),debug) LIBRARIES = $(LIBRARIES_DEBUG) LINK_FLAGS = $(LINK_FLAGS_DEBUG) CXXFLAGS = $(CXXFLAGS_DEBUG) $(PROGRAM): $(OBJECTS) @echo == linking $@ @$(CXX) $(OBJECTS) $(LIBRARY_PATHS) $(LIBRARIES) $(LINK_FLAGS) -o $@ lib$(LIBRARY).so: $(OBJECTS) @echo == linking $@ @$(CXX) $(OBJECTS) $(LIBRARY_PATHS) $(LIBRARIES) $(LINK_FLAGS) -o $@ -shared %.o: @mkdir -p obj @echo == compiling $< @$(CXX) $(CXXFLAGS) -c $(PREINCL) -ftemplate-depth-99 $(DEFINES) $(PRE_INCLUDES) $(INCLUDES) $< -o $@ else ifeq ($(CONFIG),release) LIBRARIES = $(LIBRARIES_RELEASE) LINK_FLAGS = $(LINK_FLAGS_RELEASE) CXXFLAGS = $(CXXFLAGS_RELEASE) $(PROGRAM): $(OBJECTS) @echo == linking $@ @$(CXX) $(OBJECTS) $(LIBRARY_PATHS) $(LIBRARIES) $(LINK_FLAGS) -o $@ lib$(LIBRARY).so: $(OBJECTS) @echo == linking $@ @$(CXX) $(OBJECTS) $(LIBRARY_PATHS) $(LIBRARIES) $(LINK_FLAGS) -o $@ -shared %.o: @mkdir -p obj @echo == compiling $< @$(CXX) $(CXXFLAGS) -c $(PREINCL) -ftemplate-depth-99 $(DEFINES) $(PRE_INCLUDES) $(INCLUDES) $< -o $@ else .FORCE: %.o: .FORCE @echo "====================================================================" @echo "Error: specify configuration, either by" @echo "- specifying CONFIG=[debug|release] when running make" @echo " $(MAKE_COMMAND) $(MAKECMDGOALS) CONFIG=debug" @echo " $(MAKE_COMMAND) $(MAKECMDGOALS) CONFIG=release" @echo "- setting the environment variable CONFIG" @echo " bash: export CONFIG=debug" @echo " export CONFIG=release" @echo " csh: setenv CONFIG debug" @echo " setenv CONFIG release" @echo "====================================================================" $(PROGRAM): .FORCE @echo "====================================================================" @echo "Error: specify configuration, either by" @echo "- specifying CONFIG=[debug|release] when running make" @echo " $(MAKE_COMMAND) $(MAKECMDGOALS) CONFIG=debug" @echo " $(MAKE_COMMAND) $(MAKECMDGOALS) CONFIG=release" @echo "- setting the environment variable CONFIG" @echo " bash: export CONFIG=debug" @echo " export CONFIG=release" @echo " csh: setenv CONFIG debug" @echo " setenv CONFIG release" @echo "====================================================================" $(LIBRARY): .FORCE @echo "====================================================================" @echo "Error: specify configuration, either by" @echo "- specifying CONFIG=[debug|release] when running make" @echo " $(MAKE_COMMAND) $(MAKECMDGOALS) CONFIG=debug" @echo " $(MAKE_COMMAND) $(MAKECMDGOALS) CONFIG=release" @echo "- setting the environment variable CONFIG" @echo " bash: export CONFIG=debug" @echo " export CONFIG=release" @echo " csh: setenv CONFIG debug" @echo " setenv CONFIG release" @echo "====================================================================" endif endif %.d: @mkdir -p dep @echo Generating dependency information for $< @$(SRCDEPS) -d settings.cfg $< > $@ .SUFFIXES: