git » libfiu » commit 3f2d1cc

Make python bindings build without having libfiu installed

author Alberto Bertogli
2009-06-15 04:02:44 UTC
committer Alberto Bertogli
2009-06-16 15:42:54 UTC
parent 8362f9771fe1e838cf56c1e8c84dc26a53d78379

Make python bindings build without having libfiu installed

The setup.py is not so nice, but it's worth it. Also, while at it, add
a general "bindings" target to the top-level Makefile, and make the
python[23] build depend on libfiu.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>

Makefile +12 -4
bindings/python/setup.py +7 -2

diff --git a/Makefile b/Makefile
index 1e9e257..f084565 100644
--- a/Makefile
+++ b/Makefile
@@ -29,16 +29,23 @@ preload_clean:
 preload_install: preload
 	$(MAKE) -C preload install
 
-python2:
+
+bindings: python2 python3
+
+bindings_install: python2_install python3_install
+
+bindings_clean: python_clean
+
+python2: libfiu
 	cd bindings/python && python setup.py build
 
-python2_install:
+python2_install: python2
 	cd bindings/python && python setup.py install
 
-python3:
+python3: libfiu
 	cd bindings/python && python3 setup.py build
 
-python3_install:
+python3_install: python3
 	cd bindings/python && python3 setup.py install
 
 python_clean:
@@ -51,6 +58,7 @@ clean: python_clean preload_clean libfiu_clean
 .PHONY: default all clean install all_install \
 	libfiu libfiu_clean libfiu_install \
 	python2 python2_install python3 python3_install python_clean \
+	bindings bindings_install bindings_clean \
 	preload preload_clean preload_install
 
 
diff --git a/bindings/python/setup.py b/bindings/python/setup.py
index 2255064..fed2a78 100644
--- a/bindings/python/setup.py
+++ b/bindings/python/setup.py
@@ -8,9 +8,14 @@ elif sys.version_info[0] == 3:
 	ver_define = ('PYTHON3', '1')
 
 fiu_ll = Extension("fiu_ll",
-		libraries = ['fiu'],
 		sources = ['fiu_ll.c'],
-		define_macros = [ver_define])
+		define_macros = [ver_define],
+		libraries = ['fiu'],
+
+		# these two allow us to build without having libfiu installed,
+		# assuming we're in the libfiu source tree
+		include_dirs = ['../../libfiu/'],
+		library_dirs=['../../libfiu/'])
 
 setup(
 	name = 'fiu',