aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile54
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 @@
1SRC:=$(wildcard src/*.cpp)
2OBJS:=$(patsubst %.cpp,%.o,$(SRC))
3VER:=r$(shell svn info | grep "Revision" | cut -d\ -f2)
4LIBS:=bu++
5LIBDIRS:=$(patsubst %,lib%,$(LIBS))
6LIBFILES:=$(foreach dir,$(LIBDIRS),$(dir)/$(dir).a)
7DEPFILES:=$(patsubst %.o,%.d,$(OBJS))
8
9.PHONY: all clean dist checklibs
10
11all: checklibs src/version.h build
12
13checklibs:
14 for ldir in $(LIBDIRS); do make -C $$ldir; done
15
16-include $(DEPFILES)
17
18src/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
24clean:
25 -rm $(foreach dir,src,$(wildcard $(dir)/*.o)) build src/version.h
26
27depclean:
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
36test:
37 -build
38
39build: $(LIBFILES) $(OBJS)
40 g++ -ggdb $(OBJS) -o build $(patsubst %,-L%,$(LIBDIRS)) $(patsubst %,-l%,$(LIBS))
41
42api: $(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
48dist: 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