]> arthur.barton.de Git - bup.git/blob - Makefile
Makefile: build module using python distutils instead of manually.
[bup.git] / Makefile
1 OS:=$(shell uname | sed 's/[-_].*//')
2 MACHINE:=$(shell uname -m)
3 CFLAGS=-Wall -g -O2 -Werror $(PYINCLUDE) -g
4 ifneq ($(OS),CYGWIN)
5   CFLAGS += -fPIC
6 endif
7 SHARED=-shared
8 SOEXT:=.so
9
10 ifeq (${OS},Darwin)
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: bup-split bup-join bup-save bup-init bup-server bup-index bup-tick \
23         bup memtest randomgen$(EXT) chashsplit$(SOEXT)
24
25 randomgen$(EXT): randomgen.o
26         $(CC) $(CFLAGS) -o $@ $<
27
28 chashsplit$(SOEXT): chashsplitmodule.c csetup.py
29         @rm -f $@
30         python csetup.py build
31         cp build/*/chashsplit.so .
32         
33 runtests: all runtests-python runtests-cmdline
34
35 runtests-python:
36         ./wvtest.py $(wildcard t/t*.py)
37         
38 runtests-cmdline: all
39         t/test.sh
40         
41 stupid:
42         PATH=/bin:/usr/bin $(MAKE) test
43         
44 test: all
45         ./wvtestrun $(MAKE) runtests
46
47 %: %.o
48         $(CC) $(CFLAGS) (LDFLAGS) -o $@ $^ $(LIBS)
49         
50 bup: bup.py
51         rm -f $@
52         ln -s $< $@
53         
54 bup-%: cmd-%.py
55         rm -f $@
56         ln -s $< $@
57         
58 %: %.py
59         rm -f $@
60         ln -s $< $@
61         
62 bup-%: cmd-%.sh
63         rm -f $@
64         ln -s $< $@
65         
66 %.o: %.c
67         gcc -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
68
69 clean:
70         rm -f *.o *.so *.dll *.exe *~ .*~ *.pyc */*.pyc */*~ \
71                 bup bup-* randomgen memtest \
72                 out[12] out2[tc] tags[12] tags2[tc]
73         rm -rf *.tmp build