aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
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