Commit c8391a0e926feeb55e3d9087e74f9d39b1f4ae21

Authored by Stephen Warren
Committed by Tom Rini
1 parent cc4f427bbd

dts/Makefile: unify cpp/dtc include paths

*.dts may use #include (via cpp) or /include/ (via dtc; assuming a newer
dtc). The choice is up to the creator of the DT. Create a common variable
DTC_INCDIRS that lists the paths searched by include statements, and
update cpp and dtc invocation to use them.

For cpp, also specify -nostdinc to ensure the same set of paths is
available to both type of include statement.

For dtc, create a new DTC_FLAGS variable to hold all the flags passed to
dtc.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Simon Glass <sjg@chromium.org>

Showing 1 changed file with 9 additions and 2 deletions Side-by-side Diff

... ... @@ -21,12 +21,19 @@
21 21 $(error Your architecture does not have device tree support enabled. \
22 22 Please define CONFIG_ARCH_DEVICE_TREE))
23 23  
  24 +DTS_INCDIRS = $(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts
  25 +DTS_INCDIRS += $(SRCTREE)/board/$(VENDOR)/dts
  26 +DTS_INCDIRS += $(SRCTREE)/arch/$(ARCH)/dts
  27 +
24 28 # We preprocess the device tree file provide a useful define
25 29 DTS_CPPFLAGS := -x assembler-with-cpp \
26 30 -DARCH_CPU_DTS=\"$(SRCTREE)/arch/$(ARCH)/dts/$(CONFIG_ARCH_DEVICE_TREE).dtsi\" \
27 31 -DBOARD_DTS=\"$(SRCTREE)/board/$(VENDOR)/$(BOARD)/dts/$(DEVICE_TREE).dts\" \
28   - -I$(SRCTREE)/board/$(VENDOR)/dts -I$(SRCTREE)/arch/$(ARCH)/dts
  32 + -nostdinc $(addprefix -I,$(DTS_INCDIRS))
29 33  
  34 +DTC_FLAGS := -R 4 -p 0x1000 \
  35 + $(addprefix -i ,$(DTS_INCDIRS))
  36 +
30 37 all: $(obj).depend $(LIB)
31 38  
32 39 # Use a constant name for this so we can access it from C code.
... ... @@ -36,7 +43,7 @@
36 43  
37 44 $(DT_BIN): $(TOPDIR)/board/$(VENDOR)/dts/$(DEVICE_TREE).dts
38 45 $(CPP) -P $(DTS_CPPFLAGS) $< -o $(DT_BIN).dts.tmp
39   - $(DTC) -R 4 -p 0x1000 -O dtb -o ${DT_BIN} $(DT_BIN).dts.tmp
  46 + $(DTC) $(DTC_FLAGS) -O dtb -o ${DT_BIN} $(DT_BIN).dts.tmp
40 47  
41 48 process_lds = \
42 49 $(1) | sed -r -n 's/^OUTPUT_$(2)[ ("]*([^")]*).*/\1/p'