summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2006-05-01 17:11:04 +0000
committerMike Buland <eichlan@xagasoft.com>2006-05-01 17:11:04 +0000
commitf7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54 (patch)
tree53cec4864776e07950e3c72f2a990a1017d08045 /Makefile
downloadlibbu++-f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54.tar.gz
libbu++-f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54.tar.bz2
libbu++-f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54.tar.xz
libbu++-f7a9549bd6ad83f2e0bceec9cddacfa5e3f84a54.zip
libbu++ is finally laid out the way it should be, trunk, branches, and tags.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile69
1 files changed, 69 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..b3d213d
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,69 @@
1OBJS:=$(patsubst %.cpp,%.o,$(wildcard src/*.cpp))
2TOBJS:=$(patsubst %.cpp,%.o,$(wildcard src/test/*.cpp))
3TDIRS:=$(filter-out %.o %.cpp %.h %.d,$(wildcard src/test/*))
4TESTS:=$(patsubst src/test/%.o,%,$(TOBJS)) $(patsubst src/test/%,%,$(TDIRS))
5ATOBJS:=$(TOBJS) $(patsubst %.cpp,%.o,$(foreach dr,$(TDIRS),$(wildcard $(dr)/*.cpp)))
6LIB:=libbu++.a
7DATE:=$(shell date +%F)
8
9TXTCPP:="\ g++:\ \ \ "
10TXTLNK:="\ \ ld:\ \ \ "
11TXTDEP:="\ dep:\ \ \ "
12TXTARC:="\ \ ar:\ \ \ "
13
14.PHONY: all clean dist tests depclean cleanapi
15.SILENT: clean $(OBJS) $(TOBJS) $(ATOBJS) $(TESTS) $(patsubst %.o,%.d,$(OBJS) $(TOBJS) $(ATOBJS) $(TESTS)) $(LIB)
16
17all: libbu++.a tests
18
19depclean:
20 -rm $(patsubst %.o,%.d,$(OBJS) $(ATOBJS))
21
22-include $(patsubst %.o,%.d,$(OBJS) $(ATOBJS))
23
24clean:
25 -rm $(OBJS) $(ATOBJS) $(TESTS) $(LIB)
26
27# This bit I cribbed from the docs, seems to work great though!
28%.d: %.cpp
29 g++ $(CXXFLAGS) -Isrc -M $(CPPFLAGS) $< | sed 's,\($(notdir $*)\)\.o[: ]*,$(dir $*)\1.o $@: ,g' > $@
30 echo "$(TXTDEP)$@"
31
32%.o: %.cpp
33 g++ $(CXXFLAGS) -Isrc $(foreach dr,$(filter $(dir $@),$(foreach ddr,$(TDIRS),$(ddr)/)),-I$(dr)) -ggdb -c -o $@ $<
34 echo "$(TXTCPP)$@"
35
36$(LIB): $(OBJS)
37 ar cr $(LIB) $(OBJS)
38 echo "$(TXTARC)$@"
39
40$(TESTS): $(ATOBJS) $(LIB)
41 g++ $(LDFLAGS) -ggdb $(filter %$@.o, $(TOBJS) ) $(patsubst %.cpp,%.o,$(wildcard $(filter %$@, $(TDIRS))/*.cpp)) -L. -lbu++ -o $@
42 echo "$(TXTLNK)$@"
43
44tests: $(TESTS)
45
46dist: clean depclean
47 mkdir libbu++-$(DATE)
48 cp -a --target-directory=libbu++-$(DATE) Makefile src
49 tar --exclude=\.svn -c libbu++-$(DATE) | bzip2 -9 > libbu++-$(DATE).tar.bz2
50 rm -Rf libbu++-$(DATE)
51
52install: libbu++.a
53 cat src/*.h | grep -v "#include \"" - > libbu++.h
54 cp -a libbu++.a $(PREFIX)/lib
55 cp -a libbu++.h $(PREFIX)/include
56
57cleanapi:
58 -rm -Rf api
59
60api: $(SRC)
61 -rm -Rf api
62 doxygen
63 make -C api/latex
64
65#tests: $(TOBJS) $(LIB)
66# for file in $(patsubst src/test/%.o,%,$(TOBJS)); \
67# do g++ -o $$file src/test/$$file.o -L. -lbu++; \
68# done
69