Skip to content

Commit

Permalink
Makefile: Extend PYTHONPATH rather than overriding it
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
dezgeg committed Mar 13, 2018
1 parent f95ab1f commit 9beef52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 2 additions & 4 deletions scripts/Makefile.spl
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@
Expand Down

0 comments on commit 9beef52

Please sign in to comment.