]> arthur.barton.de Git - bup.git/blobdiff - Makefile
main: fix problem when redirecting to newliner on MacOS X.
[bup.git] / Makefile
index 6c62c9b74a45b6db988118047f4ffacb19eef118..40cae28223c0d55b49a6085164877bef36747fb0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,34 +1,79 @@
-CFLAGS=-Wall -g -Werror
+OS:=$(shell uname | sed 's/[-_].*//')
+CFLAGS=-Wall -g -O2 -Werror $(PYINCLUDE) -g
+ifneq ($(OS),CYGWIN)
+  CFLAGS += -fPIC
+endif
+SHARED=-shared
+SOEXT:=.so
 
-default: all
+ifeq (${OS},Darwin)
+  MACHINE:=$(shell arch)
+  CFLAGS += -arch $(MACHINE)
+  SHARED = -dynamiclib
+endif
+ifeq ($(OS),CYGWIN)
+  LDFLAGS += -L/usr/bin
+  EXT:=.exe
+  SOEXT:=.dll
+endif
 
-all: hashsplit hashjoin
+default: all
 
-hashsplit: hashsplit.o
+all: cmds bup lib/bup/_hashsplit$(SOEXT) \
+       Documentation/all
+       
+%/all:
+       $(MAKE) -C $* all
+       
+%/clean:
+       $(MAKE) -C $* clean
 
-hashjoin: hashjoin.sh
+lib/bup/_hashsplit$(SOEXT): lib/bup/_hashsplit.c lib/bup/csetup.py
+       @rm -f $@
+       cd lib/bup && python csetup.py build
+       cp lib/bup/build/*/_hashsplit$(SOEXT) lib/bup/
+       
+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: main.py
+       rm -f $@
+       ln -s $< $@
+       
+cmds: $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py))
+
+cmd/bup-%: cmd/%-cmd.py
+       rm -f $@
+       ln -s $*-cmd.py $@
+       
+%: %.py
+       rm -f $@
+       ln -s $< $@
        
-%: %.sh
+bup-%: cmd-%.sh
        rm -f $@
-       ln -s $^ $@
+       ln -s $< $@
        
 %.o: %.c
-       gcc -c -o $@ $^ $(CPPFLAGS) $(CFLAGS)
+       gcc -c -o $@ $< $(CPPFLAGS) $(CFLAGS)
 
-clean:
-       rm -f *.o *~ hashsplit hashjoin hsplit hjoin \
-               out[12] tags[12] .*~
+clean: Documentation/clean
+       rm -f *.o *.so */*/*.so *.dll *.exe .*~ *~ */*~ */*/*~ \
+               *.pyc */*.pyc */*/*.pyc\
+               bup bup-* cmd/bup-* randomgen memtest \
+               out[12] out2[tc] tags[12] tags2[tc]
+       rm -rf *.tmp build lib/bup/build