diff options
Diffstat (limited to '')
| -rw-r--r-- | Makefile | 84 |
1 files changed, 81 insertions, 3 deletions
| @@ -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 | 8 | OBJECTS := $(patsubst %.cpp,%.o,$(wildcard src/stable/*.cpp src/unstable/*.cpp src/experimental/*.cpp)) |
| 9 | HEADERS := 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)) | ||
| 10 | TOOLS := $(patsubst src/tools/%.cpp,%,$(wildcard src/tools/*.cpp)) | ||
| 11 | UNITS := $(patsubst src/unit/%.unit,unit/%,$(wildcard src/unit/*.unit)) | ||
| 12 | TESTS := $(patsubst src/tests/%.cpp,tests/%,$(wildcard src/tests/*.cpp)) | ||
| 13 | |||
| 14 | .PHONY: default all headers clean tests | ||
| 15 | |||
| 16 | default: libbu++.a tools | ||
| 17 | |||
| 18 | all: default tests | ||
| 19 | |||
| 20 | tests: ${UNITS} ${TESTS} | ||
| 21 | |||
| 22 | clean: | ||
| 23 | -rm ${HEADERS} ${OBJECTS} libbu++.a ${TOOLS} ${UNITS} ${TESTS} | ||
| 24 | |||
| 25 | bu/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 | |||
| 40 | autoconfig: autoconfig.cpp | ||
| 41 | ${CXX} -o autoconfig autoconfig.cpp | ||
| 42 | |||
| 43 | src/autoconfig.h src/version.h: autoconfig | ||
| 44 | ./autoconfig $@ | ||
| 45 | |||
| 46 | src/signals.h: signals-pregen.h | ||
| 47 | cp $< $@ | ||
| 48 | |||
| 49 | headers: ${HEADERS} | ||
| 50 | |||
| 51 | tools: ${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 | |||
| 58 | viewcsv: | ||
| 59 | g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++ -lncurses | ||
| 60 | |||
| 61 | bin2cpp: | ||
| 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 | |||
| 78 | tests/bzip2: | ||
| 79 | g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++ -lbz2 | ||
| 80 | |||
| 81 | tests/deflate: | ||
| 82 | g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++ -lz | ||
| 83 | |||
| 84 | tests/lzma: | ||
| 85 | g++ -ggdb -W -Wall -I. -L. $< -o $@ -lbu++ -llzma | ||
| 86 | |||
| 87 | libbu++.a: ${HEADERS} ${OBJECTS} | ||
| 88 | ar -r libbu++.a ${OBJECTS} | ||
| 9 | 89 | ||
| 10 | build: | ||
| 11 | build | ||
