Makefile 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. # Unfortunately setup.py below cannot handle srctree being ".." which it often
  2. # is. It fails with an error like:
  3. # Fatal error: can't create build/temp.linux-x86_64-2.7/../lib/libfdt/fdt.o:
  4. # No such file or directory
  5. # To fix this, use an absolute path.
  6. LIBFDT_srcdir = $(abspath $(srctree)/$(src)/../libfdt)
  7. include $(LIBFDT_srcdir)/Makefile.libfdt
  8. # Unfortunately setup.py (or actually the Python distutil implementation) puts
  9. # files into the same directory as the .i file. We cannot touch the source
  10. # directory, so we "ship" .i file into the objtree.
  11. PYLIBFDT_srcs = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_SRCS)) \
  12. $(obj)/libfdt.i
  13. quiet_cmd_pymod = PYMOD $@
  14. cmd_pymod = unset CROSS_COMPILE; unset CFLAGS; \
  15. CC="$(HOSTCC)" LDSHARED="$(HOSTCC) -shared " \
  16. LDFLAGS="$(HOSTLDFLAGS)" \
  17. VERSION="u-boot-$(UBOOTVERSION)" \
  18. CPPFLAGS="$(HOSTCFLAGS) -I$(LIBFDT_srcdir)" OBJDIR=$(obj) \
  19. SOURCES="$(PYLIBFDT_srcs)" \
  20. SWIG_OPTS="-I$(LIBFDT_srcdir) -I$(LIBFDT_srcdir)/.." \
  21. $(PYTHON3) $< --quiet build_ext --inplace
  22. $(obj)/_libfdt.so: $(src)/setup.py $(PYLIBFDT_srcs) FORCE
  23. @# Remove the library since otherwise Python doesn't seem to regenerate
  24. @# the libfdt.py file if it is missing.
  25. rm -f $(obj)/_libfdt*.so
  26. $(call if_changed,pymod)
  27. always += _libfdt.so
  28. clean-files += libfdt.i _libfdt.so libfdt.py libfdt_wrap.c