summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-25 06:40:53 +1300
committerSimon Glass <sjg@chromium.org>2021-03-26 17:03:08 +1300
commit354d2324635cb77b7bf9a9ad80c4d48b7761c4f7 (patch)
treef5bb1071887794d5e95f2d3c3b6c885b3cf33add /scripts
parent56b313d1b637815dd01463698cc722a27ae361e4 (diff)
downloadu-boot-354d2324635cb77b7bf9a9ad80c4d48b7761c4f7.tar.gz
u-boot-354d2324635cb77b7bf9a9ad80c4d48b7761c4f7.tar.xz
u-boot-354d2324635cb77b7bf9a9ad80c4d48b7761c4f7.zip
Makefile: Remove old of-platdata files before regenerating
Which files we generate depends on the setting of OF_PLATDATA_INST in the build. This might change between builds, but the build directory may be reused. Leaving old files around is confusing and switching the OF_PLATDATA_INST setting does not necessarily regenerate the files, e.g. if the devicetree has not changed. Remove all the files before regenerating new ones. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.spl19
1 files changed, 17 insertions, 2 deletions
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 11e9f6a17e..ca988224da 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -121,12 +121,22 @@ u-boot-spl-init := $(head-y)
u-boot-spl-main := $(libs-y)
ifdef CONFIG_$(SPL_TPL_)OF_PLATDATA
platdata-hdr := include/generated/dt-structs-gen.h include/generated/dt-decl.h
+platdata-inst := $(obj)/dts/dt-uclass.o $(obj)/dts/dt-device.o
+platdata-noinst := $(obj)/dts/dt-plat.o
+
ifdef CONFIG_$(SPL_TPL_)OF_PLATDATA_INST
-u-boot-spl-platdata := $(obj)/dts/dt-uclass.o $(obj)/dts/dt-device.o
+u-boot-spl-platdata := $(platdata-inst)
+u-boot-spl-old-platdata := $(platdata-noinst)
else
-u-boot-spl-platdata := $(obj)/dts/dt-plat.o
+u-boot-spl-platdata := $(platdata-noinst)
+u-boot-spl-old-platdata := $(platdata-inst)
endif
+
+# Files we need to generate
u-boot-spl-platdata_c := $(patsubst %.o,%.c,$(u-boot-spl-platdata))
+
+# Files we won't generate and should remove
+u-boot-spl-old-platdata_c := $(patsubst %.o,%.c,$(u-boot-spl-old-platdata))
endif # OF_PLATDATA
# Linker Script
@@ -334,6 +344,11 @@ $(obj)/dts/dt-%.o: $(obj)/dts/dt-%.c $(platdata-hdr)
# Don't use dts_dir here, since it forces running this expensive rule every time
$(platdata-hdr) $(u-boot-spl-platdata_c) &: $(obj)/$(SPL_BIN).dtb
@[ -d $(obj)/dts ] || mkdir -p $(obj)/dts
+ @# Remove old files since which ones we generate depends on the setting
+ @# of OF_PLATDATA_INST and this might change between builds. Leaving old
+ @# ones around is confusing and it is possible that switching the
+ @# setting again will use the old one instead of regenerating it.
+ @rm -f $(u-boot-spl-all-platdata_c) $(u-boot-spl-all-platdata)
$(call if_changed,dtoc)
ifdef CONFIG_SAMSUNG