From 9beef522926a543e19abd7eacdf5c4c2fe0637ba Mon Sep 17 00:00:00 2001 From: Tuomas Tynkkynen Date: Tue, 7 Nov 2017 16:58:38 +0200 Subject: [PATCH] Makefile: Extend PYTHONPATH rather than overriding it Currently, if the user has compiled the libfdt Python module from dtc upstream to a non-default location, it cannot be used because the 'PYTHONPATH=tools' assignment wipes out the user's PYTHONPATH. Instead, extend PYTHONPATH in the main Makefile instead of overriding it. Signed-off-by: Tuomas Tynkkynen --- Makefile | 8 +++++++- scripts/Makefile.spl | 6 ++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 6b2aac6713c4..fab1e8e32917 100644 --- a/Makefile +++ b/Makefile @@ -348,10 +348,16 @@ OBJCOPY = $(CROSS_COMPILE)objcopy OBJDUMP = $(CROSS_COMPILE)objdump AWK = awk PERL = perl -PYTHON ?= python DTC ?= $(objtree)/scripts/dtc/dtc CHECK = sparse +PYTHON ?= python +ifeq ($(PYTHONPATH),) +PYTHONPATH := scripts/dtc/pylibfdt +else +PYTHONPATH := $(PYTHONPATH):scripts/dtc/pylibfdt +endif + CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ -Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF) diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl index 2993ade41e25..27546a12df30 100644 --- a/scripts/Makefile.spl +++ b/scripts/Makefile.spl @@ -244,13 +244,11 @@ $(obj)/$(SPL_BIN)-pad.bin: $(obj)/$(SPL_BIN) $(obj)/$(SPL_BIN).dtb: dts/dt-spl.dtb FORCE $(call if_changed,copy) -pythonpath = PYTHONPATH=scripts/dtc/pylibfdt - quiet_cmd_dtocc = DTOC C $@ -cmd_dtocc = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ platdata +cmd_dtocc = $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ platdata quiet_cmd_dtoch = DTOC H $@ -cmd_dtoch = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ struct +cmd_dtoch = $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ struct quiet_cmd_plat = PLAT $@ cmd_plat = $(CC) $(c_flags) -c $< -o $@