Skip to content

Commit 9beef52

Browse files
committed
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 <tuomas@tuxera.com>
1 parent f95ab1f commit 9beef52

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,16 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
348348
OBJDUMP = $(CROSS_COMPILE)objdump
349349
AWK = awk
350350
PERL = perl
351-
PYTHON ?= python
352351
DTC ?= $(objtree)/scripts/dtc/dtc
353352
CHECK = sparse
354353

354+
PYTHON ?= python
355+
ifeq ($(PYTHONPATH),)
356+
PYTHONPATH := scripts/dtc/pylibfdt
357+
else
358+
PYTHONPATH := $(PYTHONPATH):scripts/dtc/pylibfdt
359+
endif
360+
355361
CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \
356362
-Wbitwise -Wno-return-void -D__CHECK_ENDIAN__ $(CF)
357363

scripts/Makefile.spl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,13 +244,11 @@ $(obj)/$(SPL_BIN)-pad.bin: $(obj)/$(SPL_BIN)
244244
$(obj)/$(SPL_BIN).dtb: dts/dt-spl.dtb FORCE
245245
$(call if_changed,copy)
246246

247-
pythonpath = PYTHONPATH=scripts/dtc/pylibfdt
248-
249247
quiet_cmd_dtocc = DTOC C $@
250-
cmd_dtocc = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ platdata
248+
cmd_dtocc = $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ platdata
251249

252250
quiet_cmd_dtoch = DTOC H $@
253-
cmd_dtoch = $(pythonpath) $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ struct
251+
cmd_dtoch = $(srctree)/tools/dtoc/dtoc -d $(obj)/$(SPL_BIN).dtb -o $@ struct
254252

255253
quiet_cmd_plat = PLAT $@
256254
cmd_plat = $(CC) $(c_flags) -c $< -o $@

0 commit comments

Comments
 (0)