From 937d960d2677c87ac6d68dc5445be115ac001d3e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 29 Jun 2006 05:50:44 +0000 Subject: Completely switched over to the much simpler, nicer pymake. Things look great, and the old Makefile may soon fall into disrepair. To use the old one, which should almost always be able to build at least thi library, call: make -f Makefile.legacy The new Makefile just calls pymake --- Makefile.legacy | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 Makefile.legacy (limited to 'Makefile.legacy') diff --git a/Makefile.legacy b/Makefile.legacy new file mode 100644 index 0000000..0afb4a0 --- /dev/null +++ b/Makefile.legacy @@ -0,0 +1,78 @@ +OBJS:=$(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) +USRCS:=$(wildcard src/unit/*.cpp) +UOBJS:=$(patsubst %.cpp,%.o,$(USRCS)) +UNIT:=$(foreach ut,$(patsubst %.cpp,%,$(wildcard src/unit/*.cpp)),unit/$(notdir $(ut))) +TOBJS:=$(patsubst %.cpp,%.o,$(wildcard src/test/*.cpp)) +TDIRS:=$(filter-out %.o %.cpp %.h %.d,$(wildcard src/test/*)) +TESTS:=$(patsubst src/test/%.o,tests/%,$(TOBJS)) $(patsubst src/test/%,tests/%,$(TDIRS)) +ATOBJS:=$(TOBJS) $(patsubst %.cpp,%.o,$(foreach dr,$(TDIRS),$(wildcard $(dr)/*.cpp))) +LIB:=libbu++.a +DATE:=$(shell date +%F) + +TXTCPP:="\ g++:\ \ \ " +TXTLNK:="\ \ ld:\ \ \ " +TXTDEP:="\ dep:\ \ \ " +TXTARC:="\ \ ar:\ \ \ " + +.PHONY: all clean dist tests depclean cleanapi +.SILENT: clean $(OBJS) $(TOBJS) $(ATOBJS) $(UNIT) $(UOBJS) $(TESTS) $(patsubst %.o,%.d,$(OBJS) $(TOBJS) $(ATOBJS) $(UOBJS) $(TESTS)) $(LIB) + +all: libbu++.a + +depclean: + -rm $(patsubst %.o,%.d,$(OBJS) $(ATOBJS) $(UOBJS)) + +-include $(patsubst %.o,%.d,$(OBJS) $(ATOBJS) $(UOBJS)) + +clean: + -rm $(OBJS) $(ATOBJS) $(UOBJS) $(TESTS) $(LIB) + +# This bit I cribbed from the docs, seems to work great though! +%.d: %.cpp + echo "$(TXTDEP)$@" + g++ $(CXXFLAGS) -Isrc -M $(CPPFLAGS) $< | sed 's,\($(notdir $*)\)\.o[: ]*,$(dir $*)\1.o $@: ,g' > $@ + +%.o: %.cpp + echo "$(TXTCPP)$@" + g++ -fPIC $(CXXFLAGS) -Isrc $(foreach dr,$(filter $(dir $@),$(foreach ddr,$(TDIRS),$(ddr)/)),-I$(dr)) -ggdb -c -o $@ $< + +$(LIB): $(OBJS) + echo "$(TXTARC)$@" + ar cr $(LIB) $(OBJS) + +$(TESTS): $(ATOBJS) $(LIB) + echo "$(TXTLNK)$@" + g++ $(LDFLAGS) -ggdb $(filter %$(patsubst tests/%,%,$@).o, $(TOBJS) ) $(patsubst %.cpp,%.o,$(wildcard $(filter %$(patsubst tests/%,%,$@), $(TDIRS))/*.cpp)) -L. -lbu++ -ldl -o $@ + +$(UNIT): $(USRCS) $(LIB) + echo "$(TXTLNK)$@" + g++ $(LDFLAGS) -ggdb -Isrc -Isrc/unit src/$@.cpp -L. -lbu++ -lcpptest -o $@ + +tests: $(TESTS) + +unit: $(UNIT) + +dist: clean depclean + mkdir libbu++-$(DATE) + cp -a --target-directory=libbu++-$(DATE) Makefile src + tar --exclude=\.svn -c libbu++-$(DATE) | bzip2 -9 > libbu++-$(DATE).tar.bz2 + rm -Rf libbu++-$(DATE) + +install: libbu++.a + cat src/*.h | grep -v "#include \"" - > libbu++.h + cp -a libbu++.a $(PREFIX)/lib + cp -a libbu++.h $(PREFIX)/include + +cleanapi: + -rm -Rf api + +api: $(SRC) + -rm -Rf api + doxygen + make -C api/latex + +#tests: $(TOBJS) $(LIB) +# for file in $(patsubst src/test/%.o,%,$(TOBJS)); \ +# do g++ -o $$file src/test/$$file.o -L. -lbu++; \ +# done + -- cgit v1.2.3