]> arthur.barton.de Git - bup.git/blobdiff - Makefile
This adds the long-awaited indexfile feature, so you no longer have to feed
[bup.git] / Makefile
index 802e32a7b2e7d8ad5cdab0e5122777eebcf72421..7c24fa1fbd950047af51667310745cfa8f272178 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,40 +1,42 @@
-CFLAGS=-Wall -g -O2 -Werror -I/usr/include/python2.5 -g -fPIC
+PYINCLUDE:=$(shell python2.5-config --includes)
+PYLIB:=$(shell python2.5-config --lib)
+OS:=$(shell uname)
+MACHINE:=$(shell uname -m)
+CFLAGS=-Wall -g -O2 -Werror $(PYINCLUDE) -g -fPIC
+SHARED=-shared
+
+ifeq (${OS},Darwin)
+  CFLAGS += -arch $(MACHINE)
+  SHARED = -dynamiclib
+endif
 
 default: all
 
-all: bup-split bup-join bup-save bup-init bup randomgen chashsplit.so
+all: bup-split bup-join bup-save bup-init bup-server bup-index bup-tick \
+       bup randomgen chashsplit.so
 
 randomgen: randomgen.o
+       $(CC) $(CFLAGS) -o $@ $<
 
 chashsplit.so: chashsplitmodule.o
-       $(CC) -shared -o $@ $<
+       $(CC) $(CFLAGS) $(SHARED) -o $@ $< $(PYLIB)
        
-runtests: all
+runtests: all runtests-python runtests-cmdline
+
+runtests-python:
        ./wvtest.py $(wildcard t/t*.py)
        
 runtests-cmdline: all
-       @echo "Testing \"$@\" in Makefile:"
-       ./bup split --bench -b <testfile1 >tags1.tmp
-       ./bup split -vvvv -b testfile2 >tags2.tmp
-       ./bup split -t testfile2 >tags2t.tmp
-       ./bup split -c testfile2 >tags2c.tmp
-       diff -u tags1.tmp tags2.tmp || true
-       wc -c testfile1 testfile2
-       wc -l tags1.tmp tags2.tmp
-       ./bup join $$(cat tags1.tmp) >out1.tmp
-       ./bup join <tags2.tmp >out2.tmp
-       ./bup join <tags2t.tmp >out2t.tmp
-       ./bup join <tags2c.tmp >out2c.tmp
-       diff -u testfile1 out1.tmp
-       diff -u testfile2 out2.tmp
-       diff -u testfile2 out2t.tmp
-       diff -u testfile2 out2c.tmp
-       
-test: all runtests-cmdline
+       t/test.sh
+       
+stupid:
+       PATH=/bin:/usr/bin $(MAKE) test
+       
+test: all
        ./wvtestrun $(MAKE) runtests
 
 %: %.o
-       gcc -o $@ $< $(LDFLAGS) $(LIBS)
+       $(CC) $(CFLAGS) (LDFLAGS) -o $@ $< $(LIBS)
        
 bup: bup.py
        rm -f $@
@@ -53,5 +55,6 @@ bup-%: cmd-%.sh
 
 clean:
        rm -f *.o *.so *~ .*~ *.pyc */*.pyc */*~ \
-               bup bup-split bup-join bup-save bup-init randomgen \
-               out[12] out2[tc] tags[12] tags2[tc] *.tmp
+               bup bup-* randomgen \
+               out[12] out2[tc] tags[12] tags2[tc]
+       rm -rf *.tmp