diff options
author | Mike Buland <eichlan@xagasoft.com> | 2006-05-26 14:36:57 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2006-05-26 14:36:57 +0000 |
commit | a820665eea71a64b40e74ed24afeaf07a7a99db4 (patch) | |
tree | 515af31ac2ed78aa92ce7e90e478bdb452e6e438 /Makefile | |
parent | bd5bb1ca60a6a97b110cbf221b3625e6e6200141 (diff) | |
download | libbu++-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 'Makefile')
-rw-r--r-- | Makefile | 19 |
1 files changed, 14 insertions, 5 deletions
@@ -1,4 +1,7 @@ | |||
1 | OBJS:=$(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) | 1 | OBJS:=$(patsubst %.cpp,%.o,$(wildcard src/*.cpp)) |
2 | USRCS:=$(wildcard src/unit/*.cpp) | ||
3 | UOBJS:=$(patsubst %.cpp,%.o,$(USRCS)) | ||
4 | UNIT:=$(foreach ut,$(patsubst %.cpp,%,$(wildcard src/unit/*.cpp)),unit/$(notdir $(ut))) | ||
2 | TOBJS:=$(patsubst %.cpp,%.o,$(wildcard src/test/*.cpp)) | 5 | TOBJS:=$(patsubst %.cpp,%.o,$(wildcard src/test/*.cpp)) |
3 | TDIRS:=$(filter-out %.o %.cpp %.h %.d,$(wildcard src/test/*)) | 6 | TDIRS:=$(filter-out %.o %.cpp %.h %.d,$(wildcard src/test/*)) |
4 | TESTS:=$(patsubst src/test/%.o,tests/%,$(TOBJS)) $(patsubst src/test/%,tests/%,$(TDIRS)) | 7 | TESTS:=$(patsubst src/test/%.o,tests/%,$(TOBJS)) $(patsubst src/test/%,tests/%,$(TDIRS)) |
@@ -12,17 +15,17 @@ TXTDEP:="\ dep:\ \ \ " | |||
12 | TXTARC:="\ \ ar:\ \ \ " | 15 | TXTARC:="\ \ 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 | ||
17 | all: libbu++.a tests | 20 | all: libbu++.a tests unit |
18 | 21 | ||
19 | depclean: | 22 | depclean: |
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 | ||
24 | clean: | 27 | clean: |
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 | |||
44 | tests: $(TESTS) | 51 | tests: $(TESTS) |
45 | 52 | ||
53 | unit: $(UNIT) | ||
54 | |||
46 | dist: clean depclean | 55 | dist: 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 |