diff mbox series

[13/17] Makefile: Include the config for the phase being built

Message ID 20210917161741.1275871-14-sjg@chromium.org
State RFC
Delegated to: Tom Rini
Headers show
Series RFC: Split configs between U-Boot proper and SPL builds | expand

Commit Message

Simon Glass Sept. 17, 2021, 4:17 p.m. UTC
At present there is only a single auto.conf file used within the
makefiles. Update them to use the correct one for each phase.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 Makefile               | 11 ++++++++++-
 scripts/Makefile.build | 10 +++++++++-
 scripts/Makefile.spl   |  8 +++++++-
 3 files changed, 26 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index 3014788e14e..0bf846b5640 100644
--- a/Makefile
+++ b/Makefile
@@ -581,8 +581,17 @@  scripts: scripts_basic scripts_dtc include/config/auto.conf
 	$(Q)$(MAKE) $(build)=$(@)
 
 ifeq ($(dot-config),1)
-# Read in config
+
+# Read in the config for this phase
+ifdef CONFIG_TPL_BUILD
+-include include/config/auto_tpl.conf
+else
+ifdef CONFIG_SPL_BUILD
+-include include/config/auto_spl.conf
+else
 -include include/config/auto.conf
+endif
+endif
 
 # Read in dependencies to all Kconfig* files, make sure to run
 # oldconfig if changes are detected.
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 5df8f61aa58..aaa960b51ce 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -40,9 +40,17 @@  ldflags-y  :=
 subdir-asflags-y :=
 subdir-ccflags-y :=
 
-# Read auto.conf if it exists, otherwise ignore
+# Read appropriate auto.conf if it exists, otherwise ignore
 # Modified for U-Boot
+
+ifeq ($(SPL_NAME),tpl)
+-include include/config/auto_tpl.conf
+else ifeq ($(SPL_NAME),spl)
+-include include/config/auto_spl.conf
+else
 -include include/config/auto.conf
+endif
+
 -include $(prefix)/include/autoconf.mk
 include scripts/Makefile.uncmd_spl
 
diff --git a/scripts/Makefile.spl b/scripts/Makefile.spl
index 25a3e7fa52e..02dd85b8e1c 100644
--- a/scripts/Makefile.spl
+++ b/scripts/Makefile.spl
@@ -19,9 +19,15 @@  _dummy := $(shell [ -d $(obj) ] || mkdir -p $(obj))
 
 include $(srctree)/scripts/Kbuild.include
 
--include include/config/auto.conf
 -include $(obj)/include/autoconf.mk
 
+# Read in the config for this SPL phase
+ifdef CONFIG_TPL_BUILD
+-include include/config/auto_tpl.conf
+else
+-include include/config/auto_spl.conf
+endif
+
 UBOOTINCLUDE := -I$(obj)/include $(UBOOTINCLUDE)
 
 KBUILD_CPPFLAGS += -DCONFIG_SPL_BUILD