diff options
-rw-r--r-- | Makefile | 6 | ||||
-rw-r--r-- | swig/Makefile | 31 | ||||
-rw-r--r-- | swig/python/.gitignore | 2 | ||||
-rw-r--r-- | swig/python/__init__.py | 0 | ||||
-rw-r--r-- | swig/test.py (renamed from swig/python/test.py) | 2 |
5 files changed, 37 insertions, 4 deletions
@@ -6,7 +6,7 @@ HPATH = include/xtract export XTRACT_VERSION PREFIX LIBRARY -.PHONY: examples clean install doc src +.PHONY: examples clean install doc src swig all: src examples @@ -19,6 +19,9 @@ doc: examples: @$(MAKE) -C $@ +swig: src + @$(MAKE) -C $@ + install: @$(MAKE) -C src install @$(MAKE) -C examples install @@ -28,4 +31,5 @@ install: clean: @$(MAKE) -C src clean @$(MAKE) -C examples clean + @$(MAKE) -C swig clean @$(RM) -r dist 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 + diff --git a/swig/python/.gitignore b/swig/python/.gitignore deleted file mode 100644 index 6dfa0ae..0000000 --- a/swig/python/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -xtract.py -xtract_wrap.c
\ No newline at end of file diff --git a/swig/python/__init__.py b/swig/python/__init__.py deleted file mode 100644 index e69de29..0000000 --- a/swig/python/__init__.py +++ /dev/null diff --git a/swig/python/test.py b/swig/test.py index a89a6f9..4d14171 100644 --- a/swig/python/test.py +++ b/swig/test.py @@ -1,7 +1,7 @@ #!/usr/bin/python try: - import libxtract.xtract as xtract + import xtract except ImportError: print 'Failed to load the library "xtract"' |