mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-12-25 12:33:41 +00:00
15b97f5c5e
The pylibfdt is used by dtoc (and, indirectly by binman), but there is no reason why it must be generated in the tools/ directory. Recently, U-Boot switched over to the bundled DTC, and the directory structure under scripts/dtc/ now mirrors the upstream DTC project. So, scripts/dtc/pylibfdt is the best location. I also rewrote the Makefile in a cleaner Kbuild style. The scripts from the upstream have been moved as follows: lib/libfdt/pylibfdt/setup.py -> scripts/dtc/pylibfdt/setup.py lib/libfdt/pylibfdt/libfdt.i -> scripts/dtc/pylibfdt/libfdt.i_shipped The .i_shipped is coped to .i during building because the .i must be located in the objtree when we build it out of tree. Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
30 lines
1.1 KiB
Makefile
30 lines
1.1 KiB
Makefile
# Unfortunately setup.py below cannot handle srctree being ".." which it often
|
|
# is. It fails with an error like:
|
|
# Fatal error: can't create build/temp.linux-x86_64-2.7/../lib/libfdt/fdt.o:
|
|
# No such file or directory
|
|
# To fix this, use an absolute path.
|
|
LIBFDT_srcdir = $(abspath $(srctree)/$(src)/../libfdt)
|
|
|
|
include $(LIBFDT_srcdir)/Makefile.libfdt
|
|
|
|
# Unfortunately setup.py (or actually the Python distutil implementation) puts
|
|
# files into the same directory as the .i file. We cannot touch the source
|
|
# directory, so we "ship" .i file into the objtree.
|
|
PYLIBFDT_srcs = $(addprefix $(LIBFDT_srcdir)/,$(LIBFDT_SRCS)) \
|
|
$(obj)/libfdt.i
|
|
|
|
quiet_cmd_pymod = PYMOD $@
|
|
cmd_pymod = unset CC; unset CROSS_COMPILE; unset CFLAGS;\
|
|
LDFLAGS="$(HOSTLDFLAGS)" \
|
|
VERSION="u-boot-$(UBOOTVERSION)" \
|
|
CPPFLAGS="$(HOSTCFLAGS) -I$(LIBFDT_srcdir)" OBJDIR=$(obj) \
|
|
SOURCES="$(PYLIBFDT_srcs)" \
|
|
SWIG_OPTS="-I$(LIBFDT_srcdir) -I$(LIBFDT_srcdir)/.." \
|
|
$(PYTHON) $< --quiet build_ext --inplace
|
|
|
|
$(obj)/_libfdt.so: $(src)/setup.py $(PYLIBFDT_srcs) FORCE
|
|
$(call if_changed,pymod)
|
|
|
|
always += _libfdt.so
|
|
|
|
clean-files += libfdt.i _libfdt.so libfdt.py libfdt_wrap.c
|