summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorLucas De Marchi <lucas.demarchi@intel.com>2014-03-24 08:27:19 -0300
committerLucas De Marchi <lucas.demarchi@intel.com>2014-03-26 22:30:56 -0300
commit3a33a7a566c221e13c426c0d2f3519ebe8f70a34 (patch)
tree95c461f52f94f6a694847d20494e3f41b5d2f5bd /Makefile.am
parent5ad36e522226732d3815ace77b2ec19198bd24fc (diff)
downloadkmod-3a33a7a566c221e13c426c0d2f3519ebe8f70a34.tar.gz
kmod-3a33a7a566c221e13c426c0d2f3519ebe8f70a34.tar.bz2
kmod-3a33a7a566c221e13c426c0d2f3519ebe8f70a34.zip
build-sys: add hooks to build python bindings
Add --enable-python configure switch so we build the python bindings. We also pass version.py through SED_PROCESS macro, so the version is kept in sync with kmod. Acked-by: Andy Grover <agrover@redhat.com>
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am70
1 files changed, 68 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index 46b7652..e65fdfb 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,7 +6,8 @@ endif
DISTCLEAN_LOCAL_HOOKS =
EXTRA_DIST =
-CLEANFILES =
+CLEANFILES = $(BUILT_FILES)
+BUILT_FILES =
ACLOCAL_AMFLAGS = -I m4 ${ACLOCAL_FLAGS}
AM_MAKEFLAGS = --no-print-directory
@@ -125,6 +126,70 @@ ${noinst_SCRIPTS}: tools/kmod
endif
# ------------------------------------------------------------------------------
+# PYTHON BINDINGS
+# ------------------------------------------------------------------------------
+
+CYTHON_FLAGS_VERBOSE_ =
+CYTHON_FLAGS_VERBOSE_0 =
+CYTHON_FLAGS_VERBOSE_1 = -v
+CYTHON_FLAGS = $(CYTHON_FLAGS_VERBOSE_$(V))
+AM_V_CYTHON = $(am__v_CYTHON_$(V))
+am__v_CYTHON_ = $(am__v_CYTHON_$(AM_DEFAULT_VERBOSITY))
+am__v_CYTHON_0 = @echo " CYTHON " $@;
+
+.pyx.c:
+ $(AM_V_CYTHON)$(CYTHON) -o $@ $<
+
+%.py: %.py.in Makefile
+ $(SED_PROCESS)
+
+# Remove some warnings for generated code
+PYTHON_NOWARN = -Wno-redundant-decls -Wno-shadow -Wno-strict-aliasing
+
+CPYTHON_MODULE_CFLAGS = $(AM_CFLAGS) -DCPYTHON_COMPILING_IN_PYPY=0 \
+ $(PYTHON_NOWARN) $(PYTHON_CFLAGS) \
+ -fvisibility=default
+CPYTHON_MODULE_LDFLAGS = $(AM_LDFLAGS) -module -avoid-version -shared
+
+if BUILD_PYTHON
+pkgpyexec_LTLIBRARIES = libkmod/python/kmod/kmod.la \
+ libkmod/python/kmod/list.la \
+ libkmod/python/kmod/module.la \
+ libkmod/python/kmod/_util.la
+
+libkmod_python_kmod_kmod_la_SOURCES = libkmod/python/kmod/kmod.c
+libkmod_python_kmod_kmod_la_CFLAGS = $(CPYTHON_MODULE_CFLAGS)
+libkmod_python_kmod_kmod_la_LDFLAGS = $(CPYTHON_MODULE_LDFLAGS)
+libkmod_python_kmod_kmod_la_LIBADD = $(PYTHON_LIBS) libkmod/libkmod.la
+
+libkmod_python_kmod_list_la_SOURCES = libkmod/python/kmod/list.c
+libkmod_python_kmod_list_la_CFLAGS = $(CPYTHON_MODULE_CFLAGS)
+libkmod_python_kmod_list_la_LDFLAGS = $(CPYTHON_MODULE_LDFLAGS)
+libkmod_python_kmod_list_la_LIBADD = $(PYTHON_LIBS) libkmod/libkmod.la
+
+libkmod_python_kmod_module_la_SOURCES = libkmod/python/kmod/module.c
+libkmod_python_kmod_module_la_CFLAGS = $(CPYTHON_MODULE_CFLAGS)
+libkmod_python_kmod_module_la_LDFLAGS = $(CPYTHON_MODULE_LDFLAGS)
+libkmod_python_kmod_module_la_LIBADD = $(PYTHON_LIBS) libkmod/libkmod.la
+
+libkmod_python_kmod__util_la_SOURCES = libkmod/python/kmod/_util.c
+libkmod_python_kmod__util_la_CFLAGS = $(CPYTHON_MODULE_CFLAGS)
+libkmod_python_kmod__util_la_LDFLAGS = $(CPYTHON_MODULE_LDFLAGS)
+libkmod_python_kmod__util_la_LIBADD = $(PYTHON_LIBS) libkmod/libkmod.la
+
+BUILT_FILES += $(libkmod_python_kmod_kmod_la_SOURCES) \
+ $(libkmod_python_kmod_list_la_SOURCES) \
+ $(libkmod_python_kmod_module_la_SOURCES) \
+ $(libkmod_python_kmod__util_la_SOURCES)
+
+dist_pkgpyexec_PYTHON = libkmod/python/kmod/error.py \
+ libkmod/python/kmod/__init__.py \
+ libkmod/python/kmod/version.py
+
+BUILT_FILES += libkmod/python/kmod/version.py
+
+endif
+# ------------------------------------------------------------------------------
# TESTSUITE
# ------------------------------------------------------------------------------
@@ -211,7 +276,8 @@ testsuite-distclean:
DISTCLEAN_LOCAL_HOOKS += testsuite-distclean
EXTRA_DIST += testsuite/rootfs-pristine
-DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --sysconfdir=/etc --with-zlib \
+DISTCHECK_CONFIGURE_FLAGS=--enable-gtk-doc --enable-python --sysconfdir=/etc \
+ --with-zlib \
--with-bashcompletiondir=$$dc_install_base/$(bashcompletiondir)
distclean-local: $(DISTCLEAN_LOCAL_HOOKS)