summaryrefslogtreecommitdiff
path: root/Makefile.legacy
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile.legacy')
-rw-r--r--Makefile.legacy78
1 files changed, 78 insertions, 0 deletions
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