aboutsummaryrefslogtreecommitdiff
path: root/swig/Makefile
blob: 2d47e12e80f586896e5a5fddb108b26360923e6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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