115b97f5cSMasahiro Yamada# Unfortunately setup.py below cannot handle srctree being ".." which it often 215b97f5cSMasahiro Yamada# is. It fails with an error like: 315b97f5cSMasahiro Yamada# Fatal error: can't create build/temp.linux-x86_64-2.7/../lib/libfdt/fdt.o: 415b97f5cSMasahiro Yamada# No such file or directory 515b97f5cSMasahiro Yamada# To fix this, use an absolute path. 615b97f5cSMasahiro YamadaLIBFDT_srcdir = $(abspath $(srctree)/$(src)/../libfdt) 715b97f5cSMasahiro Yamada 815b97f5cSMasahiro Yamadainclude $(LIBFDT_srcdir)/Makefile.libfdt 915b97f5cSMasahiro Yamada 1015b97f5cSMasahiro Yamada# Unfortunately setup.py (or actually the Python distutil implementation) puts 1115b97f5cSMasahiro Yamada# files into the same directory as the .i file. We cannot touch the source 1215b97f5cSMasahiro Yamada# directory, so we "ship" .i file into the objtree. 1315b97f5cSMasahiro YamadaPYLIBFDT_srcs = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_SRCS)) \ 1415b97f5cSMasahiro Yamada $(obj)/libfdt.i 1515b97f5cSMasahiro Yamada 1615b97f5cSMasahiro Yamadaquiet_cmd_pymod = PYMOD $@ 17f919fbd3SMarek Vasut cmd_pymod = unset CROSS_COMPILE; unset CFLAGS; \ 18f919fbd3SMarek Vasut CC="$(HOSTCC)" LDSHARED="$(HOSTCC) -shared " \ 1915b97f5cSMasahiro Yamada LDFLAGS="$(HOSTLDFLAGS)" \ 2015b97f5cSMasahiro Yamada VERSION="u-boot-$(UBOOTVERSION)" \ 2115b97f5cSMasahiro Yamada CPPFLAGS="$(HOSTCFLAGS) -I$(LIBFDT_srcdir)" OBJDIR=$(obj) \ 2215b97f5cSMasahiro Yamada SOURCES="$(PYLIBFDT_srcs)" \ 2315b97f5cSMasahiro Yamada SWIG_OPTS="-I$(LIBFDT_srcdir) -I$(LIBFDT_srcdir)/.." \ 24*03e6151dSJosef Lusticky $(PYTHON2) $< --quiet build_ext --inplace 2515b97f5cSMasahiro Yamada 2615b97f5cSMasahiro Yamada$(obj)/_libfdt.so: $(src)/setup.py $(PYLIBFDT_srcs) FORCE 2715b97f5cSMasahiro Yamada $(call if_changed,pymod) 2815b97f5cSMasahiro Yamada 2915b97f5cSMasahiro Yamadaalways += _libfdt.so 3015b97f5cSMasahiro Yamada 3115b97f5cSMasahiro Yamadaclean-files += libfdt.i _libfdt.so libfdt.py libfdt_wrap.c 32