aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSimon Glass2020-12-28 20:34:53 -0700
committerSimon Glass2021-01-05 12:26:35 -0700
commitbe3bd3bb177ec913050745131687089c1ff69c44 (patch)
tree7374763e5d0f9aa1d473ab63bd63ea1890a461cc /scripts
parent10cbd3b7da12e993c67d56182d30294661a93619 (diff)
Makefile: Invoke dtoc only once
Update the Makefile to run dtoc only once, generating all required files. This saves time since there is a lot of processing in each invocation of dtoc. We already have a variable for the object files to build, so use that instead of repeating the same filenames. Add a C version of this also, for the same reason. This makes it easier to add new C files (generated by dtoc) to the build later, as needed. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.spl21
1 files changed, 9 insertions, 12 deletions
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 161c15b200e..3d60cf5120e 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -121,6 +121,7 @@ u-boot-spl-init := $(head-y)
u-boot-spl-main := $(libs-y)
ifdef CONFIG_$(SPL_TPL_)OF_PLATDATA
u-boot-spl-platdata := $(obj)/dts/dt-platdata.o
+u-boot-spl-platdata_c := $(patsubst %.o,%.c,$(u-boot-spl-platdata))
endif
# Linker Script
@@ -310,17 +311,15 @@ pythonpath = PYTHONPATH=scripts/dtc/pylibfdt
DTOC_ARGS := $(pythonpath) $(srctree)/tools/dtoc/dtoc \
-d $(obj)/$(SPL_BIN).dtb
-quiet_cmd_dtocc = DTOC C $@
-cmd_dtocc = $(DTOC_ARGS) -o $@ platdata
-
-quiet_cmd_dtoch = DTOC H $@
-cmd_dtoch = $(DTOC_ARGS) -o $@ struct
+quiet_cmd_dtoc = DTOC $@
+cmd_dtoc = $(DTOC_ARGS) -c $(obj)/dts -C include/generated all
quiet_cmd_plat = PLAT $@
cmd_plat = $(CC) $(c_flags) -c $< -o $(filter-out $(PHONY),$@)
-targets += $(obj)/dts/dt-platdata.o
-$(obj)/dts/dt-platdata.o: $(obj)/dts/dt-platdata.c \
+targets += $(u-boot-spl-platdata)
+
+$(obj)/dts/dt-%.o: $(obj)/dts/dt-%.c \
include/generated/dt-structs-gen.h prepare FORCE
$(call if_changed,plat)
@@ -328,11 +327,9 @@ PHONY += dts_dir
dts_dir:
$(shell [ -d $(obj)/dts ] || mkdir -p $(obj)/dts)
-include/generated/dt-structs-gen.h: $(obj)/$(SPL_BIN).dtb dts_dir FORCE
- $(call if_changed,dtoch)
-
-$(obj)/dts/dt-platdata.c: $(obj)/$(SPL_BIN).dtb dts_dir FORCE
- $(call if_changed,dtocc)
+include/generated/dt-structs-gen.h $(u-boot-spl-platdata_c) &: \
+ $(obj)/$(SPL_BIN).dtb dts_dir FORCE
+ $(call if_changed,dtoc)
ifdef CONFIG_SAMSUNG
ifdef CONFIG_VAR_SIZE_SPL