aboutsummaryrefslogtreecommitdiffstats
path: root/pylibfdt/Makefile.pylibfdt
diff options
context:
space:
mode:
Diffstat (limited to 'pylibfdt/Makefile.pylibfdt')
-rw-r--r--pylibfdt/Makefile.pylibfdt24
1 files changed, 24 insertions, 0 deletions
diff --git a/pylibfdt/Makefile.pylibfdt b/pylibfdt/Makefile.pylibfdt
new file mode 100644
index 000000000000..9507d3d44694
--- /dev/null
+++ b/pylibfdt/Makefile.pylibfdt
@@ -0,0 +1,24 @@
+# Makefile.pylibfdt
+#
+
+PYLIBFDT_srcs = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_SRCS)) \
+ $(PYLIBFDT_srcdir)/libfdt.i
+PYMODULE = $(PYLIBFDT_objdir)/_libfdt.so
+
+define run_setup
+ SOURCES="$(1)" CPPFLAGS="$(CPPFLAGS)" OBJDIR="$(PYLIBFDT_objdir)"
+ VERSION="$(dtc_version)"
+ $(PYLIBFDT_objdir)/setup.py --quiet $(2)
+endef
+
+$(PYMODULE): $(PYLIBFDT_srcs)
+ @$(VECHO) PYMOD $@
+ $(call run_setup, $^, build_ext --inplace)
+ mv _libfdt.so $@
+
+install_pylibfdt: $(PYMODULE)
+ $(VECHO) INSTALL-PYLIB; \
+ $(call run_setup, $(PYLIBFDT_srcs), \
+ install $(if $(SETUP_PREFIX),--prefix=$(SETUP_PREFIX)))
+
+PYLIBFDT_cleanfiles = libfdt_wrap.c libfdt.py libfdt.pyc _libfdt.so