summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-06-29 05:50:44 +0000
committerMike Buland <eichlan@xagasoft.com>2006-06-29 05:50:44 +0000
commit937d960d2677c87ac6d68dc5445be115ac001d3e (patch)
tree35b33aebb0cab5073fc0778f13f2425d3e18278f /Makefile
parentdcd914665f6e8ea6ea4e648f7357f1c842273d87 (diff)
downloadlibbu++-937d960d2677c87ac6d68dc5445be115ac001d3e.tar.gz
libbu++-937d960d2677c87ac6d68dc5445be115ac001d3e.tar.bz2
libbu++-937d960d2677c87ac6d68dc5445be115ac001d3e.tar.xz
libbu++-937d960d2677c87ac6d68dc5445be115ac001d3e.zip
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
Diffstat (limited to '')
-rw-r--r--Makefile80
-rw-r--r--Makefile.legacy78
2 files changed, 81 insertions, 77 deletions
diff --git a/Makefile b/Makefile
index 0afb4a0..2257ecc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,78 +1,4 @@
1OBJS:=$(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) 1.PHONY: pymake
2USRCS:=$(wildcard src/unit/*.cpp)
3UOBJS:=$(patsubst %.cpp,%.o,$(USRCS))
4UNIT:=$(foreach ut,$(patsubst %.cpp,%,$(wildcard src/unit/*.cpp)),unit/$(notdir $(ut)))
5TOBJS:=$(patsubst %.cpp,%.o,$(wildcard src/test/*.cpp))
6TDIRS:=$(filter-out %.o %.cpp %.h %.d,$(wildcard src/test/*))
7TESTS:=$(patsubst src/test/%.o,tests/%,$(TOBJS)) $(patsubst src/test/%,tests/%,$(TDIRS))
8ATOBJS:=$(TOBJS) $(patsubst %.cpp,%.o,$(foreach dr,$(TDIRS),$(wildcard $(dr)/*.cpp)))
9LIB:=libbu++.a
10DATE:=$(shell date +%F)
11
12TXTCPP:="\ g++:\ \ \ "
13TXTLNK:="\ \ ld:\ \ \ "
14TXTDEP:="\ dep:\ \ \ "
15TXTARC:="\ \ ar:\ \ \ "
16
17.PHONY: all clean dist tests depclean cleanapi
18.SILENT: clean $(OBJS) $(TOBJS) $(ATOBJS) $(UNIT) $(UOBJS) $(TESTS) $(patsubst %.o,%.d,$(OBJS) $(TOBJS) $(ATOBJS) $(UOBJS) $(TESTS)) $(LIB)
19
20all: libbu++.a
21
22depclean:
23 -rm $(patsubst %.o,%.d,$(OBJS) $(ATOBJS) $(UOBJS))
24
25-include $(patsubst %.o,%.d,$(OBJS) $(ATOBJS) $(UOBJS))
26
27clean:
28 -rm $(OBJS) $(ATOBJS) $(UOBJS) $(TESTS) $(LIB)
29
30# This bit I cribbed from the docs, seems to work great though!
31%.d: %.cpp
32 echo "$(TXTDEP)$@"
33 g++ $(CXXFLAGS) -Isrc -M $(CPPFLAGS) $< | sed 's,\($(notdir $*)\)\.o[: ]*,$(dir $*)\1.o $@: ,g' > $@
34
35%.o: %.cpp
36 echo "$(TXTCPP)$@"
37 g++ -fPIC $(CXXFLAGS) -Isrc $(foreach dr,$(filter $(dir $@),$(foreach ddr,$(TDIRS),$(ddr)/)),-I$(dr)) -ggdb -c -o $@ $<
38
39$(LIB): $(OBJS)
40 echo "$(TXTARC)$@"
41 ar cr $(LIB) $(OBJS)
42
43$(TESTS): $(ATOBJS) $(LIB)
44 echo "$(TXTLNK)$@"
45 g++ $(LDFLAGS) -ggdb $(filter %$(patsubst tests/%,%,$@).o, $(TOBJS) ) $(patsubst %.cpp,%.o,$(wildcard $(filter %$(patsubst tests/%,%,$@), $(TDIRS))/*.cpp)) -L. -lbu++ -ldl -o $@
46
47$(UNIT): $(USRCS) $(LIB)
48 echo "$(TXTLNK)$@"
49 g++ $(LDFLAGS) -ggdb -Isrc -Isrc/unit src/$@.cpp -L. -lbu++ -lcpptest -o $@
50
51tests: $(TESTS)
52
53unit: $(UNIT)
54
55dist: clean depclean
56 mkdir libbu++-$(DATE)
57 cp -a --target-directory=libbu++-$(DATE) Makefile src
58 tar --exclude=\.svn -c libbu++-$(DATE) | bzip2 -9 > libbu++-$(DATE).tar.bz2
59 rm -Rf libbu++-$(DATE)
60
61install: libbu++.a
62 cat src/*.h | grep -v "#include \"" - > libbu++.h
63 cp -a libbu++.a $(PREFIX)/lib
64 cp -a libbu++.h $(PREFIX)/include
65
66cleanapi:
67 -rm -Rf api
68
69api: $(SRC)
70 -rm -Rf api
71 doxygen
72 make -C api/latex
73
74#tests: $(TOBJS) $(LIB)
75# for file in $(patsubst src/test/%.o,%,$(TOBJS)); \
76# do g++ -o $$file src/test/$$file.o -L. -lbu++; \
77# done
78 2
3pymake:
4 pymake
diff --git a/Makefile.legacy b/Makefile.legacy
new file mode 100644
index 0000000..0afb4a0
--- /dev/null
+++ b/Makefile.legacy
@@ -0,0 +1,78 @@
1OBJS:=$(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
2USRCS:=$(wildcard src/unit/*.cpp)
3UOBJS:=$(patsubst %.cpp,%.o,$(USRCS))
4UNIT:=$(foreach ut,$(patsubst %.cpp,%,$(wildcard src/unit/*.cpp)),unit/$(notdir $(ut)))
5TOBJS:=$(patsubst %.cpp,%.o,$(wildcard src/test/*.cpp))
6TDIRS:=$(filter-out %.o %.cpp %.h %.d,$(wildcard src/test/*))
7TESTS:=$(patsubst src/test/%.o,tests/%,$(TOBJS)) $(patsubst src/test/%,tests/%,$(TDIRS))
8ATOBJS:=$(TOBJS) $(patsubst %.cpp,%.o,$(foreach dr,$(TDIRS),$(wildcard $(dr)/*.cpp)))
9LIB:=libbu++.a
10DATE:=$(shell date +%F)
11
12TXTCPP:="\ g++:\ \ \ "
13TXTLNK:="\ \ ld:\ \ \ "
14TXTDEP:="\ dep:\ \ \ "
15TXTARC:="\ \ ar:\ \ \ "
16
17.PHONY: all clean dist tests depclean cleanapi
18.SILENT: clean $(OBJS) $(TOBJS) $(ATOBJS) $(UNIT) $(UOBJS) $(TESTS) $(patsubst %.o,%.d,$(OBJS) $(TOBJS) $(ATOBJS) $(UOBJS) $(TESTS)) $(LIB)
19
20all: libbu++.a
21
22depclean:
23 -rm $(patsubst %.o,%.d,$(OBJS) $(ATOBJS) $(UOBJS))
24
25-include $(patsubst %.o,%.d,$(OBJS) $(ATOBJS) $(UOBJS))
26
27clean:
28 -rm $(OBJS) $(ATOBJS) $(UOBJS) $(TESTS) $(LIB)
29
30# This bit I cribbed from the docs, seems to work great though!
31%.d: %.cpp
32 echo "$(TXTDEP)$@"
33 g++ $(CXXFLAGS) -Isrc -M $(CPPFLAGS) $< | sed 's,\($(notdir $*)\)\.o[: ]*,$(dir $*)\1.o $@: ,g' > $@
34
35%.o: %.cpp
36 echo "$(TXTCPP)$@"
37 g++ -fPIC $(CXXFLAGS) -Isrc $(foreach dr,$(filter $(dir $@),$(foreach ddr,$(TDIRS),$(ddr)/)),-I$(dr)) -ggdb -c -o $@ $<
38
39$(LIB): $(OBJS)
40 echo "$(TXTARC)$@"
41 ar cr $(LIB) $(OBJS)
42
43$(TESTS): $(ATOBJS) $(LIB)
44 echo "$(TXTLNK)$@"
45 g++ $(LDFLAGS) -ggdb $(filter %$(patsubst tests/%,%,$@).o, $(TOBJS) ) $(patsubst %.cpp,%.o,$(wildcard $(filter %$(patsubst tests/%,%,$@), $(TDIRS))/*.cpp)) -L. -lbu++ -ldl -o $@
46
47$(UNIT): $(USRCS) $(LIB)
48 echo "$(TXTLNK)$@"
49 g++ $(LDFLAGS) -ggdb -Isrc -Isrc/unit src/$@.cpp -L. -lbu++ -lcpptest -o $@
50
51tests: $(TESTS)
52
53unit: $(UNIT)
54
55dist: clean depclean
56 mkdir libbu++-$(DATE)
57 cp -a --target-directory=libbu++-$(DATE) Makefile src
58 tar --exclude=\.svn -c libbu++-$(DATE) | bzip2 -9 > libbu++-$(DATE).tar.bz2
59 rm -Rf libbu++-$(DATE)
60
61install: libbu++.a
62 cat src/*.h | grep -v "#include \"" - > libbu++.h
63 cp -a libbu++.a $(PREFIX)/lib
64 cp -a libbu++.h $(PREFIX)/include
65
66cleanapi:
67 -rm -Rf api
68
69api: $(SRC)
70 -rm -Rf api
71 doxygen
72 make -C api/latex
73
74#tests: $(TOBJS) $(LIB)
75# for file in $(patsubst src/test/%.o,%,$(TOBJS)); \
76# do g++ -o $$file src/test/$$file.o -L. -lbu++; \
77# done
78