aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-03-25 20:00:08 +0000
committerMike Buland <eichlan@xagasoft.com>2012-03-25 20:00:08 +0000
commit469bbcf0701e1eb8a6670c23145b0da87357e178 (patch)
treeb5b062a16e46a6c5d3410b4e574cd0cc09057211 /Makefile
parentee1b79396076edc4e30aefb285fada03bb45e80d (diff)
downloadlibbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.gz
libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.bz2
libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.xz
libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.zip
Code is all reorganized. We're about ready to release. I should write up a
little explenation of the arrangement.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile84
1 files changed, 81 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 0b7716f..42218f0 100644
--- a/Makefile
+++ b/Makefile
@@ -5,7 +5,85 @@
5# terms of the license contained in the file LICENSE. 5# terms of the license contained in the file LICENSE.
6# 6#
7 7
8.PHONY: build 8OBJECTS := $(patsubst %.cpp,%.o,$(wildcard src/stable/*.cpp src/unstable/*.cpp src/experimental/*.cpp))
9HEADERS := bu/signals.h bu/autoconfig.h bu/version.h bu/config.h $(foreach fn,$(wildcard src/stable/*.h src/unstable/*.h src/experimental/*.h),bu/$(notdir ${fn})) $(patsubst src/%,bu/%,$(wildcard src/compat/*.h))
10TOOLS := $(patsubst src/tools/%.cpp,%,$(wildcard src/tools/*.cpp))
11UNITS := $(patsubst src/unit/%.unit,unit/%,$(wildcard src/unit/*.unit))
12TESTS := $(patsubst src/tests/%.cpp,tests/%,$(wildcard src/tests/*.cpp))
13
14.PHONY: default all headers clean tests
15
16default: libbu++.a tools
17
18all: default tests
19
20tests: ${UNITS} ${TESTS}
21
22clean:
23 -rm ${HEADERS} ${OBJECTS} libbu++.a ${TOOLS} ${UNITS} ${TESTS}
24
25bu/signals.h bu/config.h bu/autoconfig.h bu/version.h: bu/%: src/%
26 ln -s ../$< $@
27
28$(foreach fn,$(wildcard src/stable/*.h),bu/$(notdir ${fn})): bu/%: src/stable/%
29 ln -s ../$< $@
30
31$(foreach fn,$(wildcard src/unstable/*.h),bu/$(notdir ${fn})): bu/%: src/unstable/%
32 ln -s ../$< $@
33
34$(foreach fn,$(wildcard src/experimental/*.h),bu/$(notdir ${fn})): bu/%: src/experimental/%
35 ln -s ../$< $@
36
37$(patsubst src/%,bu/%,$(wildcard src/compat/*.h)): bu/%: src/%
38 ln -s ../../$< $@
39
40autoconfig: autoconfig.cpp
41 ${CXX} -o autoconfig autoconfig.cpp
42
43src/autoconfig.h src/version.h: autoconfig
44 ./autoconfig $@
45
46src/signals.h: signals-pregen.h
47 cp $< $@
48
49headers: ${HEADERS}
50
51tools: ${TOOLS}
52
53${TOOLS}: %: src/tools/%.cpp libbu++.a
54
55$(filter-out viewcsv bin2cpp,${TOOLS}):
56 g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++
57
58viewcsv:
59 g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++ -lncurses
60
61bin2cpp:
62 g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++ -lbz2 -lz -llzma
63
64${OBJECTS}: %.o: %.cpp
65 g++ -ggdb -W -Wall -I. $< -c -o $@
66
67$(patsubst %,src/%.cpp,${UNITS}): %.cpp: %.unit mkunit
68 ./mkunit $< $@
69
70${UNITS}: %: src/%.cpp
71 g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++
72
73${TESTS}: %: src/%.cpp
74
75$(filter-out tests/bzip2 tests/deflate tests/lzma,${TESTS}):
76 g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++
77
78tests/bzip2:
79 g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++ -lbz2
80
81tests/deflate:
82 g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++ -lz
83
84tests/lzma:
85 g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++ -llzma
86
87libbu++.a: ${HEADERS} ${OBJECTS}
88 ar -r libbu++.a ${OBJECTS}
9 89
10build:
11 build