]> arthur.barton.de Git - bup.git/blobdiff - Makefile
main: fix problem when redirecting to newliner on MacOS X.
[bup.git] / Makefile
index b2651548169a5b25ad1bd64926773b5f92abd1d8..40cae28223c0d55b49a6085164877bef36747fb0 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,4 @@
-PYINCLUDE:=$(shell python2.5-config --includes)
-PYLIB:=$(shell python2.5-config --lib)
 OS:=$(shell uname | sed 's/[-_].*//')
-MACHINE:=$(shell uname -m)
 CFLAGS=-Wall -g -O2 -Werror $(PYINCLUDE) -g
 ifneq ($(OS),CYGWIN)
   CFLAGS += -fPIC
@@ -10,6 +7,7 @@ SHARED=-shared
 SOEXT:=.so
 
 ifeq (${OS},Darwin)
+  MACHINE:=$(shell arch)
   CFLAGS += -arch $(MACHINE)
   SHARED = -dynamiclib
 endif
@@ -21,14 +19,19 @@ endif
 
 default: all
 
-all: bup-split bup-join bup-save bup-init bup-server bup-index bup-tick \
-       bup memtest randomgen$(EXT) chashsplit$(SOEXT)
-
-randomgen$(EXT): randomgen.o
-       $(CC) $(CFLAGS) -o $@ $<
+all: cmds bup lib/bup/_hashsplit$(SOEXT) \
+       Documentation/all
+       
+%/all:
+       $(MAKE) -C $* all
+       
+%/clean:
+       $(MAKE) -C $* clean
 
-chashsplit$(SOEXT): chashsplitmodule.o
-       $(CC) $(CFLAGS) $(LDFLAGS) $(SHARED) -o $@ $< $(PYLIB)
+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
 
@@ -45,29 +48,32 @@ test: all
        ./wvtestrun $(MAKE) runtests
 
 %: %.o
-       $(CC) $(CFLAGS) (LDFLAGS) -o $@ $< $(LIBS)
+       $(CC) $(CFLAGS) (LDFLAGS) -o $@ $^ $(LIBS)
        
-bup: bup.py
+bup: main.py
        rm -f $@
-       ln -s $^ $@
+       ln -s $< $@
        
-bup-%: cmd-%.py
+cmds: $(patsubst cmd/%-cmd.py,cmd/bup-%,$(wildcard cmd/*-cmd.py))
+
+cmd/bup-%: cmd/%-cmd.py
        rm -f $@
-       ln -s $^ $@
+       ln -s $*-cmd.py $@
        
 %: %.py
        rm -f $@
-       ln -s $^ $@
+       ln -s $< $@
        
 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 *.so *.dll *.exe *~ .*~ *.pyc */*.pyc */*~ \
-               bup bup-* randomgen \
+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
+       rm -rf *.tmp build lib/bup/build