diff options
Diffstat (limited to '')
-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 |