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