]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - tools/Makefile
dtoc: Move BytesToValue() and GetEmpty() into PropBase
[people/ms/u-boot.git] / tools / Makefile
index f72294a98a583fee5cfb43ec15cc61615b7e8e88..421414bc154b0a596cb5833148f2c19c614d5fa9 100644 (file)
@@ -107,6 +107,20 @@ mkimage-objs   := $(dumpimage-mkimage-objs) mkimage.o
 fit_info-objs   := $(dumpimage-mkimage-objs) fit_info.o
 fit_check_sign-objs   := $(dumpimage-mkimage-objs) fit_check_sign.o
 
+# Build a libfdt Python module if swig is available
+# Use 'sudo apt-get install swig libpython-dev' to enable this
+hostprogs-$(CONFIG_SPL_OF_PLATDATA) += \
+       $(if $(shell which swig),_libfdt.so)
+_libfdt.so-sharedobjs += $(LIBFDT_OBJS)
+libfdt:
+
+tools/_libfdt.so: $(patsubst %.o,%.c,$(LIBFDT_OBJS)) tools/libfdt_wrap.c
+       python $(srctree)/lib/libfdt/setup.py "$(_hostc_flags)" $^
+       mv _libfdt.so $@
+
+tools/libfdt_wrap.c: $(srctree)/lib/libfdt/libfdt.swig
+       swig -python -o $@ $<
+
 # TODO(sjg@chromium.org): Is this correct on Mac OS?
 
 ifneq ($(CONFIG_MX23)$(CONFIG_MX28),)