diff mbox series

[v2] build: target: improve UX of CONFIG_TARGET handling

Message ID 20220412123957.9576-1-ynezz@true.cz
State Accepted
Delegated to: Petr Štetiar
Headers show
Series [v2] build: target: improve UX of CONFIG_TARGET handling | expand

Commit Message

Petr Štetiar April 12, 2022, 12:39 p.m. UTC
Make it clear, that for `make kernel_{menu,old}config` it's possible to
use only following values for CONFIG_TARGET variable:

 * env
 * target
 * subtarget
 * subtarget_target

This should prevent misuse like `make kernel_menuconfig
CONFIG_TARGET=bcm2710` etc.

Keep support for obsolete `platform` and `subtarget_platform` targets
with deprecation notice so this compat stuff could be removed in the
future.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
---

Changes since v1:

 * added `platform` and `subtarget_platform` compat with deprecation warning (pepe2k)

 include/target.mk | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

Comments

Piotr Dymacz April 14, 2022, 9:05 a.m. UTC | #1
On 12.04.2022 14:39, Petr Štetiar wrote:
> Make it clear, that for `make kernel_{menu,old}config` it's possible to
> use only following values for CONFIG_TARGET variable:
> 
>   * env
>   * target
>   * subtarget
>   * subtarget_target
> 
> This should prevent misuse like `make kernel_menuconfig
> CONFIG_TARGET=bcm2710` etc.
> 
> Keep support for obsolete `platform` and `subtarget_platform` targets
> with deprecation notice so this compat stuff could be removed in the
> future.
> 
> Signed-off-by: Petr Štetiar <ynezz@true.cz>

Acked-by: Piotr Dymacz <pepe2k@gmail.com>

Thanks!
diff mbox series

Patch

diff --git a/include/target.mk b/include/target.mk
index 72fe493776b9..8790b1eeae5c 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -173,22 +173,29 @@  USE_SUBTARGET_CONFIG = $(if $(wildcard $(LINUX_TARGET_CONFIG)),,$(if $(LINUX_SUB
 LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG) $(if $(USE_SUBTARGET_CONFIG),$(LINUX_SUBTARGET_CONFIG)))
 LINUX_RECONFIG_TARGET = $(if $(USE_SUBTARGET_CONFIG),$(LINUX_SUBTARGET_CONFIG),$(LINUX_TARGET_CONFIG))
 
-# select the config file to be changed by kernel_menuconfig/kernel_oldconfig
 ifeq ($(CONFIG_TARGET),platform)
+  CONFIG_TARGET=target
+  $(warning Deprecation warning: use CONFIG_TARGET=target instead.)
+else ifeq ($(CONFIG_TARGET),subtarget_platform)
+  CONFIG_TARGET=subtarget_target
+  $(warning Deprecation warning: use CONFIG_TARGET=subtarget_target instead.)
+endif
+
+# select the config file to be changed by kernel_menuconfig/kernel_oldconfig
+ifeq ($(CONFIG_TARGET),target)
   LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG))
   LINUX_RECONFIG_TARGET = $(LINUX_TARGET_CONFIG)
-endif
-ifeq ($(CONFIG_TARGET),subtarget)
+else ifeq ($(CONFIG_TARGET),subtarget)
   LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_TARGET_CONFIG) $(LINUX_SUBTARGET_CONFIG))
   LINUX_RECONFIG_TARGET = $(LINUX_SUBTARGET_CONFIG)
-endif
-ifeq ($(CONFIG_TARGET),subtarget_platform)
+else ifeq ($(CONFIG_TARGET),subtarget_target)
   LINUX_RECONFIG_LIST = $(wildcard $(GENERIC_LINUX_CONFIG) $(LINUX_SUBTARGET_CONFIG) $(LINUX_TARGET_CONFIG))
   LINUX_RECONFIG_TARGET = $(LINUX_TARGET_CONFIG)
-endif
-ifeq ($(CONFIG_TARGET),env)
+else ifeq ($(CONFIG_TARGET),env)
   LINUX_RECONFIG_LIST = $(LINUX_KCONFIG_LIST)
   LINUX_RECONFIG_TARGET = $(TOPDIR)/env/kernel-config
+else ifneq ($(strip $(CONFIG_TARGET)),)
+ $(error ERROR: CONFIG_TARGET="$(CONFIG_TARGET)" is invalid, use one of `target`, `subtarget`, `subtarget_target` or `env`)
 endif
 
 __linux_confcmd = $(2) $(patsubst %,+,$(wordlist 2,9999,$(1))) $(1)