aboutsummaryrefslogtreecommitdiff
path: root/swig/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'swig/Makefile')
-rw-r--r--swig/Makefile31
1 files changed, 31 insertions, 0 deletions
diff --git a/swig/Makefile b/swig/Makefile
new file mode 100644
index 0000000..2d47e12
--- /dev/null
+++ b/swig/Makefile
@@ -0,0 +1,31 @@
+NAME = xtract
+
+OS := $(shell uname)
+
+# Assume that since we're building the python bindings, we have a python installed!
+INCLUDEPY = $(shell python -m sysconfig | grep -w INCLUDEPY | awk '{print $$3}')
+
+ifeq ($(OS), Darwin)
+ CFLAGS=-g -c
+ LD=gcc
+ LDFLAGS=-bundle -flat_namespace -undefined suppress
+else
+ CFLAGS=-g -c -fPIC
+ LD=ld
+ LDFLAGS=-shared
+endif
+
+.PHONY: python
+
+python:
+ @swig -I../include -python $(NAME).i
+ @$(CC) $(CFLAGS) $(NAME)_wrap.c -o $(NAME)_wrap.o -I$(INCLUDEPY) -I../include
+ @$(CC) $(LDFLAGS) ../src/lib$(NAME).a $(NAME)_wrap.o -o _$(NAME).so -framework Accelerate
+
+clean:
+ @$(RM) *.o
+ @$(RM) *.pyc
+ @$(RM) *.so
+ @$(RM) $(NAME)_wrap.c
+ @$(RM) $(NAME).py
+