]> arthur.barton.de Git - bup.git/blob - Makefile
Merge branch 'master' of /tmp/bup
[bup.git] / Makefile
1 OS:=$(shell uname | sed 's/[-_].*//')
2 CFLAGS=-Wall -g -O2 -Werror $(PYINCLUDE) -g
3 ifneq ($(OS),CYGWIN)
4   CFLAGS += -fPIC
5 endif
6 SHARED=-shared
7 SOEXT:=.so
8
9 ifeq (${OS},Darwin)
10   MACHINE:=$(shell arch)
11   CFLAGS += -arch $(MACHINE)
12   SHARED = -dynamiclib
13 endif
14 ifeq ($(OS),CYGWIN)
15   LDFLAGS += -L/usr/bin
16   EXT:=.exe
17   SOEXT:=.dll
18 endif
19
20 default: all
21
22 all: cmds bup lib/bup/_hashsplit$(SOEXT) \
23         Documentation/all
24
25 INSTALL=install
26 MANDIR=$(DESTDIR)/usr/share/man
27 DOCDIR=$(DESTDIR)/usr/share/doc/bup
28 BINDIR=$(DESTDIR)/usr/bin
29 LIBDIR=$(DESTDIR)/usr/lib/bup
30 install: all
31         $(INSTALL) -d $(MANDIR)/man1 $(DOCDIR) $(BINDIR) \
32                 $(LIBDIR)/bup $(LIBDIR)/cmd
33         $(INSTALL) -o 0 -g 0 -m 0644 \
34                 $(wildcard Documentation/*.1) \
35                 $(MANDIR)/man1
36         $(INSTALL) -o 0 -g 0 -m 0644 \
37                 $(wildcard Documentation/*.html) \
38                 $(DOCDIR)
39         $(INSTALL) -o 0 -g 0 -m 0755 bup $(BINDIR)
40         $(INSTALL) -o 0 -g 0 -m 0755 \
41                 $(wildcard cmd/bup-*) \
42                 $(LIBDIR)/cmd
43         $(INSTALL) -o 0 -g 0 -m 0644 \
44                 $(wildcard lib/bup/*.so lib/bup/*.py) \
45                 $(LIBDIR)/bup
46         
47 %/all:
48         $(MAKE) -C $* all
49         
50 %/clean:
51         $(MAKE) -C $* clean
52
53 lib/bup/_hashsplit$(SOEXT): lib/bup/_hashsplit.c lib/bup/csetup.py
54         @rm -f $@
55         cd lib/bup && python csetup.py build
56         cp lib/bup/build/*/_hashsplit$(SOEXT) lib/bup/
57         
58 runtests: all runtests-python runtests-cmdline
59
60 runtests-python:
61         ./wvtest.py $(wildcard t/t*.py)
62         
63 runtests-cmdline: all
64         t/test.sh
65         
66 stupid:
67         PATH=/bin:/usr/bin $(MAKE) test
68         
69 test: all
70         ./wvtestrun $(MAKE) runtests
71
72 %: %.o
73         $(CC) $(CFLAGS) (LDFLAGS) -o $@ $^ $(LIBS)
74         
75 bup: main.py
76         rm -f $@
77         ln -s $< $@
78         
79 cmds: $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py))
80
81 cmd/bup-%: cmd/%-cmd.py
82         rm -f $@
83         ln -s $*-cmd.py $@
84         
85 %: %.py
86         rm -f $@
87         ln -s $< $@
88         
89 bup-%: cmd-%.sh
90         rm -f $@
91         ln -s $< $@
92         
93 %.o: %.c
94         gcc -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
95
96 clean: Documentation/clean
97         rm -f *.o *.so */*/*.so *.dll *.exe .*~ *~ */*~ */*/*~ \
98                 *.pyc */*.pyc */*/*.pyc\
99                 bup bup-* cmd/bup-* randomgen memtest \
100                 out[12] out2[tc] tags[12] tags2[tc]
101         rm -rf *.tmp build lib/bup/build