]> arthur.barton.de Git - bup.git/commitdiff
More compile options for MacOS X.
authorAvery Pennarun <apenwarr@gmail.com>
Thu, 7 Jan 2010 23:14:20 +0000 (18:14 -0500)
committerAvery Pennarun <apenwarr@gmail.com>
Thu, 7 Jan 2010 23:14:20 +0000 (18:14 -0500)
Based on a patch from Dave Coombs.  I changed it to auto-detect the OS
platform, so I might have broken it, however.

Makefile

index 86d2368b6420279d897731f8e39cf20440b98fb6..6ca9447e116fa3adc8d1461c3dd3bf7f9947fe8f 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,15 +1,24 @@
 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
+
+ifeq (${OS},Darwin)
+  CFLAGS += -arch $(MACHINE)
+  SHARED = -dynamiclib
+endif
 
 default: all
 
 all: bup-split bup-join bup-save bup-init bup-server bup randomgen chashsplit.so
 
 randomgen: randomgen.o
+       $(CC) $(CFLAGS) -o $@ $<
 
 chashsplit.so: chashsplitmodule.o
-       $(CC) -shared -o $@ $< $(PYLIB)
+       $(CC) $(CFLAGS) $(SHARED) -o $@ $< $(PYLIB)
        
 runtests: all
        ./wvtest.py $(wildcard t/t*.py)
@@ -24,7 +33,7 @@ test: all runtests-cmdline
        ./wvtestrun $(MAKE) runtests
 
 %: %.o
-       gcc -o $@ $< $(LDFLAGS) $(LIBS)
+       $(CC) $(CFLAGS) (LDFLAGS) -o $@ $< $(LIBS)
        
 bup: bup.py
        rm -f $@