]> arthur.barton.de Git - bup.git/blobdiff - Makefile
Start using wvtest.sh for shell-based tests in test-sh.
[bup.git] / Makefile
index 6c62c9b74a45b6db988118047f4ffacb19eef118..3209e8a98a8334ef4d9084f5aea2e6724ca88b6b 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,28 +1,52 @@
-CFLAGS=-Wall -g -Werror
+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: hashsplit hashjoin
+all: bup-split bup-join bup-save bup-init bup-server bup-index \
+       bup randomgen chashsplit.so
 
-hashsplit: hashsplit.o
+randomgen: randomgen.o
+       $(CC) $(CFLAGS) -o $@ $<
 
-hashjoin: hashjoin.sh
+chashsplit.so: chashsplitmodule.o
+       $(CC) $(CFLAGS) $(SHARED) -o $@ $< $(PYLIB)
+       
+runtests: all runtests-python runtests-cmdline
 
-test: hashsplit hashjoin
-       ./hashsplit <testfile1 >tags1
-       ./hashsplit <testfile2 >tags2
-       diff -u tags1 tags2 || true
-       wc -c testfile1 testfile2
-       wc -l tags1 tags2
-       ./hashjoin <tags1 >out1
-       ./hashjoin <tags2 >out2
-       diff -u testfile1 out1
-       diff -u testfile2 out2
+runtests-python:
+       ./wvtest.py $(wildcard t/t*.py)
+       
+runtests-cmdline: all
+       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 $@
+       ln -s $^ $@
+       
+bup-%: cmd-%.py
+       rm -f $@
+       ln -s $^ $@
        
-%: %.sh
+bup-%: cmd-%.sh
        rm -f $@
        ln -s $^ $@
        
@@ -30,5 +54,7 @@ test: hashsplit hashjoin
        gcc -c -o $@ $^ $(CPPFLAGS) $(CFLAGS)
 
 clean:
-       rm -f *.o *~ hashsplit hashjoin hsplit hjoin \
-               out[12] tags[12] .*~
+       rm -f *.o *.so *~ .*~ *.pyc */*.pyc */*~ \
+               bup bup-* randomgen \
+               out[12] out2[tc] tags[12] tags2[tc]
+       rm -rf *.tmp