]> arthur.barton.de Git - bup.git/commitdiff
Makefile: Build on Windows under Cygwin.
authorLukasz Kosewski <lkosewsk@gmail.com>
Sun, 10 Jan 2010 08:52:52 +0000 (03:52 -0500)
committerLukasz Kosewski <lkosewsk@gmail.com>
Sun, 10 Jan 2010 08:52:52 +0000 (03:52 -0500)
- Python modules have to end with .dll instead .so to load into Python
  via 'import'.
- GCC under Windows builds all programs with -fPIC, and doesn't accept
  this command-line option.
- libpython2.5.dll is found in /usr/bin under Cygwin (wtf?), so we need
  to add this to the LDFLAGS path.
- 'make clean' should remove .dll files too.

Makefile

index 7c24fa1fbd950047af51667310745cfa8f272178..48a41ac04ecc819f39544d32373a087202db0b8a 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -2,24 +2,32 @@ 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
+CFLAGS=-Wall -g -O2 -Werror $(PYINCLUDE) -g
+ifneq ($(OS),CYGWIN_NT-5.1)
+  CFLAGS += -fPIC
+endif
 SHARED=-shared
+SOEXT:=so
 
 ifeq (${OS},Darwin)
   CFLAGS += -arch $(MACHINE)
   SHARED = -dynamiclib
 endif
+ifeq ($(OS),CYGWIN_NT-5.1)
+  LDFLAGS += -L/usr/bin
+  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 randomgen chashsplit.$(SOEXT)
 
 randomgen: randomgen.o
        $(CC) $(CFLAGS) -o $@ $<
 
-chashsplit.so: chashsplitmodule.o
-       $(CC) $(CFLAGS) $(SHARED) -o $@ $< $(PYLIB)
+chashsplit.$(SOEXT): chashsplitmodule.o
+       $(CC) $(CFLAGS) $(LDFLAGS) $(SHARED) -o $@ $< $(PYLIB)
        
 runtests: all runtests-python runtests-cmdline
 
@@ -54,7 +62,7 @@ bup-%: cmd-%.sh
        gcc -c -o $@ $^ $(CPPFLAGS) $(CFLAGS)
 
 clean:
-       rm -f *.o *.so *~ .*~ *.pyc */*.pyc */*~ \
+       rm -f *.o *.so *.dll *~ .*~ *.pyc */*.pyc */*~ \
                bup bup-* randomgen \
                out[12] out2[tc] tags[12] tags2[tc]
        rm -rf *.tmp