diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0be9792 --- /dev/null +++ b/Makefile | |||
@@ -0,0 +1,54 @@ | |||
1 | SRC:=$(wildcard src/*.cpp) | ||
2 | OBJS:=$(patsubst %.cpp,%.o,$(SRC)) | ||
3 | VER:=r$(shell svn info | grep "Revision" | cut -d\ -f2) | ||
4 | LIBS:=bu++ | ||
5 | LIBDIRS:=$(patsubst %,lib%,$(LIBS)) | ||
6 | LIBFILES:=$(foreach dir,$(LIBDIRS),$(dir)/$(dir).a) | ||
7 | DEPFILES:=$(patsubst %.o,%.d,$(OBJS)) | ||
8 | |||
9 | .PHONY: all clean dist checklibs | ||
10 | |||
11 | all: checklibs src/version.h build | ||
12 | |||
13 | checklibs: | ||
14 | for ldir in $(LIBDIRS); do make -C $$ldir; done | ||
15 | |||
16 | -include $(DEPFILES) | ||
17 | |||
18 | src/version.h: .svn | ||
19 | echo "#define SVNREV \"$(VER)\"" > src/version.h | ||
20 | |||
21 | %.o: %.cpp %.d | ||
22 | g++ -ggdb $(CXXFLAGS) -Isrc $(patsubst %,-I%/src,$(LIBDIRS)) -c -o $@ $< | ||
23 | |||
24 | clean: | ||
25 | -rm $(foreach dir,src,$(wildcard $(dir)/*.o)) build src/version.h | ||
26 | |||
27 | depclean: | ||
28 | -rm $(foreach dir,src src/lib $(TOOLDIRS),$(wildcard $(dir)/*.d)) | ||
29 | |||
30 | %.d: %.cpp | ||
31 | g++ -Isrc -Isrc/lib $(CXXFLAGS) $(patsubst %,-I%/src,$(LIBDIRS)) -M $(CPPFLAGS) $< | sed 's,\($(patsubst src/%,%,$*)\)\.o[:]*,src/\1.o $@:,g' > $@ | ||
32 | |||
33 | $(LIBFILES): | ||
34 | make -C $(dir $@) $(notdir $@) | ||
35 | |||
36 | test: | ||
37 | -build | ||
38 | |||
39 | build: $(LIBFILES) $(OBJS) | ||
40 | g++ -ggdb $(OBJS) -o build $(patsubst %,-L%,$(LIBDIRS)) $(patsubst %,-l%,$(LIBS)) | ||
41 | |||
42 | api: $(LIBSRC) $(TOOLSRC) | ||
43 | sed 's/PROJECT_NUMBER.*/PROJECT_NUMBER = $(VER)/' < Doxyfile > Doxyfile.tmp | ||
44 | doxygen Doxyfile.tmp | ||
45 | rm Doxyfile.tmp | ||
46 | make -C api/latex | ||
47 | |||
48 | dist: clean src/version.h | ||
49 | mkdir build-$(VER) | ||
50 | cp -a --target-directory=build-$(VER) Makefile src | ||
51 | tar --exclude=\.svn -c build-$(VER) | bzip2 -9 > build-$(VER).tar.bz2 | ||
52 | rm -Rf build-$(VER) | ||
53 | -for dir in $(LIBDIRS); do make -C $$dir dist; done | ||
54 | |||