aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-05-26 14:36:57 +0000
committerMike Buland <eichlan@xagasoft.com>2006-05-26 14:36:57 +0000
commita820665eea71a64b40e74ed24afeaf07a7a99db4 (patch)
tree515af31ac2ed78aa92ce7e90e478bdb452e6e438 /Makefile
parentbd5bb1ca60a6a97b110cbf221b3625e6e6200141 (diff)
downloadlibbu++-a820665eea71a64b40e74ed24afeaf07a7a99db4.tar.gz
libbu++-a820665eea71a64b40e74ed24afeaf07a7a99db4.tar.bz2
libbu++-a820665eea71a64b40e74ed24afeaf07a7a99db4.tar.xz
libbu++-a820665eea71a64b40e74ed24afeaf07a7a99db4.zip
Added the first of many unit tests. For now the unit tests are just built with
everything else in the all target of the makefile, which is fine, but relies on CppTest, which can be found at http://cpptest.sf.net Also fixed some things I've been meaning to get to for a while in the xml system, including a few bugs that will make coping with malformed data not hang other programs, and do the error reporting in a nice way.
Diffstat (limited to '')
-rw-r--r--Makefile19
1 files changed, 14 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 1add784..d034ffc 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,7 @@
1OBJS:=$(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) 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)))
2TOBJS:=$(patsubst %.cpp,%.o,$(wildcard src/test/*.cpp)) 5TOBJS:=$(patsubst %.cpp,%.o,$(wildcard src/test/*.cpp))
3TDIRS:=$(filter-out %.o %.cpp %.h %.d,$(wildcard src/test/*)) 6TDIRS:=$(filter-out %.o %.cpp %.h %.d,$(wildcard src/test/*))
4TESTS:=$(patsubst src/test/%.o,tests/%,$(TOBJS)) $(patsubst src/test/%,tests/%,$(TDIRS)) 7TESTS:=$(patsubst src/test/%.o,tests/%,$(TOBJS)) $(patsubst src/test/%,tests/%,$(TDIRS))
@@ -12,17 +15,17 @@ TXTDEP:="\ dep:\ \ \ "
12TXTARC:="\ \ ar:\ \ \ " 15TXTARC:="\ \ ar:\ \ \ "
13 16
14.PHONY: all clean dist tests depclean cleanapi 17.PHONY: all clean dist tests depclean cleanapi
15.SILENT: clean $(OBJS) $(TOBJS) $(ATOBJS) $(TESTS) $(patsubst %.o,%.d,$(OBJS) $(TOBJS) $(ATOBJS) $(TESTS)) $(LIB) 18.SILENT: clean $(OBJS) $(TOBJS) $(ATOBJS) $(UNIT) $(UOBJS) $(TESTS) $(patsubst %.o,%.d,$(OBJS) $(TOBJS) $(ATOBJS) $(TESTS)) $(LIB)
16 19
17all: libbu++.a tests 20all: libbu++.a tests unit
18 21
19depclean: 22depclean:
20 -rm $(patsubst %.o,%.d,$(OBJS) $(ATOBJS)) 23 -rm $(patsubst %.o,%.d,$(OBJS) $(ATOBJS) $(UOBJS))
21 24
22-include $(patsubst %.o,%.d,$(OBJS) $(ATOBJS)) 25-include $(patsubst %.o,%.d,$(OBJS) $(ATOBJS) $(UOBJS))
23 26
24clean: 27clean:
25 -rm $(OBJS) $(ATOBJS) $(TESTS) $(LIB) 28 -rm $(OBJS) $(ATOBJS) $(UOBJS) $(TESTS) $(LIB)
26 29
27# This bit I cribbed from the docs, seems to work great though! 30# This bit I cribbed from the docs, seems to work great though!
28%.d: %.cpp 31%.d: %.cpp
@@ -41,8 +44,14 @@ $(TESTS): $(ATOBJS) $(LIB)
41 echo "$(TXTLNK)$@" 44 echo "$(TXTLNK)$@"
42 g++ $(LDFLAGS) -ggdb $(filter %$(patsubst tests/%,%,$@).o, $(TOBJS) ) $(patsubst %.cpp,%.o,$(wildcard $(filter %$(patsubst tests/%,%,$@), $(TDIRS))/*.cpp)) -L. -lbu++ -o $@ 45 g++ $(LDFLAGS) -ggdb $(filter %$(patsubst tests/%,%,$@).o, $(TOBJS) ) $(patsubst %.cpp,%.o,$(wildcard $(filter %$(patsubst tests/%,%,$@), $(TDIRS))/*.cpp)) -L. -lbu++ -o $@
43 46
47$(UNIT): $(USRCS) $(LIB)
48 echo "$(TXTLNK)$@"
49 g++ $(LDFLAGS) -ggdb -Isrc -Isrc/unit src/$@.cpp -L. -lbu++ -lcpptest -o $@
50
44tests: $(TESTS) 51tests: $(TESTS)
45 52
53unit: $(UNIT)
54
46dist: clean depclean 55dist: clean depclean
47 mkdir libbu++-$(DATE) 56 mkdir libbu++-$(DATE)
48 cp -a --target-directory=libbu++-$(DATE) Makefile src 57 cp -a --target-directory=libbu++-$(DATE) Makefile src