]> arthur.barton.de Git - bup.git/blobdiff - Makefile
cmd-midx: a command for merging multiple .idx files into one.
[bup.git] / Makefile
index 7c24fa1fbd950047af51667310745cfa8f272178..2723930586eaa4b6ddead0530101b9fcdb25b707 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,35 @@
-PYINCLUDE:=$(shell python2.5-config --includes)
-PYLIB:=$(shell python2.5-config --lib)
-OS:=$(shell uname)
+OS:=$(shell uname | sed 's/[-_].*//')
 MACHINE:=$(shell uname -m)
-CFLAGS=-Wall -g -O2 -Werror $(PYINCLUDE) -g -fPIC
+CFLAGS=-Wall -g -O2 -Werror $(PYINCLUDE) -g
+ifneq ($(OS),CYGWIN)
+  CFLAGS += -fPIC
+endif
 SHARED=-shared
+SOEXT:=.so
 
 ifeq (${OS},Darwin)
   CFLAGS += -arch $(MACHINE)
   SHARED = -dynamiclib
 endif
+ifeq ($(OS),CYGWIN)
+  LDFLAGS += -L/usr/bin
+  EXT:=.exe
+  SOEXT:=.dll
+endif
 
 default: all
 
 all: bup-split bup-join bup-save bup-init bup-server bup-index bup-tick \
-       bup randomgen chashsplit.so
+       bup-midx \
+       bup memtest randomgen$(EXT) _hashsplit$(SOEXT)
 
-randomgen: randomgen.o
+randomgen$(EXT): randomgen.o
        $(CC) $(CFLAGS) -o $@ $<
 
-chashsplit.so: chashsplitmodule.o
-       $(CC) $(CFLAGS) $(SHARED) -o $@ $< $(PYLIB)
+_hashsplit$(SOEXT): _hashsplit.c csetup.py
+       @rm -f $@
+       python csetup.py build
+       cp build/*/_hashsplit.so .
        
 runtests: all runtests-python runtests-cmdline
 
@@ -36,25 +46,29 @@ test: all
        ./wvtestrun $(MAKE) runtests
 
 %: %.o
-       $(CC) $(CFLAGS) (LDFLAGS) -o $@ $< $(LIBS)
+       $(CC) $(CFLAGS) (LDFLAGS) -o $@ $^ $(LIBS)
        
 bup: bup.py
        rm -f $@
-       ln -s $^ $@
+       ln -s $< $@
        
 bup-%: cmd-%.py
        rm -f $@
-       ln -s $^ $@
+       ln -s $< $@
+       
+%: %.py
+       rm -f $@
+       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 *~ .*~ *.pyc */*.pyc */*~ \
-               bup bup-* randomgen \
+       rm -f *.o *.so *.dll *.exe *~ .*~ *.pyc */*.pyc */*~ \
+               bup bup-* randomgen memtest \
                out[12] out2[tc] tags[12] tags2[tc]
-       rm -rf *.tmp
+       rm -rf *.tmp build