-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
-all: hsplit
+ifeq (${OS},Darwin)
+ CFLAGS += -arch $(MACHINE)
+ SHARED = -dynamiclib
+endif
-hsplit: hsplit.o
+default: all
-hjoin: hjoin.o
+all: bup-split bup-join bup-save bup-init bup-server bup-index bup-tick \
+ bup randomgen chashsplit.so
-test: hsplit
- ./hsplit <testfile1 >tags1
- ./hsplit <testfile2 >tags2
- diff -u -U50 tags1 tags2
+randomgen: randomgen.o
+ $(CC) $(CFLAGS) -o $@ $<
+
+chashsplit.so: chashsplitmodule.o
+ $(CC) $(CFLAGS) $(SHARED) -o $@ $< $(PYLIB)
+
+runtests: all runtests-python runtests-cmdline
+
+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 $^ $@
+
+bup-%: cmd-%.sh
+ rm -f $@
+ ln -s $^ $@
%.o: %.c
gcc -c -o $@ $^ $(CPPFLAGS) $(CFLAGS)
clean:
- rm -f *.o *~ hsplit hjoin
+ rm -f *.o *.so *~ .*~ *.pyc */*.pyc */*~ \
+ bup bup-* randomgen \
+ out[12] out2[tc] tags[12] tags2[tc]
+ rm -rf *.tmp