# ****************************** # * S E T T I N G S * # ****************************** # PUMA root PUMA ?= ../Puma # default target TARGET ?= linux-release # include the PUMA configuration variables # => set _TARGET, RELEASE, CFLAGS, CXXFLAGS, CPPFLAGS, etc. include $(PUMA)/vars.mk # libxml2 settings ifeq ($(_TARGET),win32) LIBXML2_INC := `mingw32-xml2-config --cflags` LIBXML2_LIB := `mingw32-xml2-config --libs` EXT=.exe else LIBXML2_INC := `xml2-config --cflags` LIBXML2_LIB := `xml2-config --libs` endif # linker settings ifneq ($(_TARGET),macosx) ifeq ($(SHARED),) LDFLAGS += -static endif LDFLAGS += -Wl,-Bstatic -L$(PUMA)/lib/$(TARGET) -lPuma ifneq ($(SHARED),) LDFLAGS += -Wl,-Bdynamic endif else LDFLAGS += -L$(PUMA)/lib/$(TARGET) -lPuma endif LDFLAGS += $(LIBXML2_LIB) # compiler settings ifeq ($(_TARGET),win32) CPPFLAGS += -I $(PUMA)/src/win32/regex RES := mingw32-windres RCFILES := win-ac++.rc endif CPPFLAGS += -I$(PUMA)/extern -I$(PUMA)/include $(LIBXML2_INC) # profiling ifneq ($(GPROF),) LDFLAGS := $(LDFLAGS) -lc_p -lm_p CXXFLAGS += -pg endif ifneq ($(PROFILING),) CPPFLAGS += -DPROFILING endif # use the new libacmodel ifneq ($(ACMODEL),) CPPFLAGS += -DACMODEL -I$(ACMODEL)/include LDFLAGS += -L$(ACMODEL)/lib/$(TARGET) -lacmodel endif # ****************************** # * S O U R C E S * # ****************************** BINDIR := bin/$(TARGET) #programm to compile PROG := $(BINDIR)/ac++$(EXT) CCSOURCES := $(wildcard *.cc) OBJECTDIR := ObjFiles/$(TARGET) OBJECTS := $(addprefix $(OBJECTDIR)/,$(CCSOURCES:.cc=.o) $(RCFILES:.rc=.o)) DEPDIR := DepFiles/$(TARGET) DEPS := $(addprefix $(DEPDIR)/,$(CCSOURCES:.cc=.d)) DIRS := $(OBJECTDIR) $(DEPDIR) $(BINDIR) # ****************************** # * E X A M P L E / T E S T * # ****************************** # tool selection export AC := $(shell pwd)/$(PROG) MAKE ?= make # ac++ settings for tests ACFLAGS := -k -v 9 ACEXAMPLES = coverage helloworld modules profiling singleton .PHONY: $(ACEXAMPLES) # ****************************** # * T A R G E T S * # ****************************** all: showtarget $(PROG) strip: $(PROG) @$(STRIP) $< showtarget: @echo "---" @echo "Making AspectC++ for TARGET=$(TARGET)" @echo " Compiler = $(CXX) $(CPPFLAGS) $(CXXFLAGS)" @echo " Linker = $(CXX) $(CXXFLAGS) $(LDFLAGS)" @echo "---" clean: testclean exampleclean @echo Making it clean. @rm -rf core core.* *~ $(PROG) $(OBJECTDIR) $(DEPDIR) $(ERROR_FILE) cleanall: doxygen-clean clean dirs: $(DIRS) test: $(PROG)$(EXT) testall example: $(PROG)$(EXT) $(addsuffix .example_make, $(ACEXAMPLES)) examplerun: example $(addsuffix .example_run, $(ACEXAMPLES)) exampleclean: @rm -rf examples/*-out @rm -rf examples/*.acp doxygen: @echo "Making AspectC++ documentation with doxygen" @doxygen doc/doxygen.conf && echo "=> see doc/doxygen/html/index.html" doxygen-clean: @rm -rf doc/doxygen regressiontest: rm -rf RegressionTests.tar.bz2 RegressionTestsTmp mkdir RegressionTestsTmp svn export tests/ RegressionTestsTmp/tests/ sed -i '1iREGRESSIONTEST := 1' RegressionTestsTmp/tests/Makefile cd RegressionTestsTmp && tar cvfj RegressionTests.tar.bz2 tests/ mv RegressionTestsTmp/RegressionTests.tar.bz2 . cd .. rm -rf RegressionTestsTmp .PHONY: all test clean cleanall example examplerun exampleclean \ showtarget doxygen doxygen-clean # ****************************** # * R U L E S * # ****************************** $(DIRS) : @mkdir -p $@ $(PROG): $(OBJECTS) | dirs @echo "Linking $@." @$(CXX) -o $@ $(CXXFLAGS) $^ $(LDFLAGS) $(OBJECTDIR)/%.o : %.cc | dirs @echo Making object file $@. @$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c -o $@ $< # -Wold-style-cast to find classic C casts "a = (A*)b;" $(DEPDIR)/%.d: %.cc | dirs @echo Making dependency file $@. @mkdir -p $(DEPDIR) @$(CXX) $(CPPFLAGS) $(CXXFLAGS) -MM -MT $(OBJECTDIR)/$(<:%.cc=%.o) -MT $@ $< >$@ ifeq ($(_TARGET),win32) $(OBJECTDIR)/%.o : %.rc | dirs @echo Compiling Windows resource file @$(RES) $(filter -D%,$(CPPFLAGS)) $< $@ endif test%: $(MAKE) -C tests -s $* %.example_make: % cd examples/$< ; \ $(AC) $(ACFLAGS) -I. -p . -d ../$<-out \ -r ../$<.acp ; \ cp Makefile ../$<-out/Makefile; \ cd ../.. %.example_run: % @mkdir examples/$<-out || true cd examples/$<-out; $(MAKE); `find . -type f -perm -700` ifneq ($(MAKECMDGOALS),clean) -include $(DEPS) endif