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