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

Petr Štetiar ynezz at true.cz
Mon Mar 28 23:34:41 PDT 2022


Make it clear, that for `make kernel_{menu,old}config` it's possible to
use only following values for CONFIG_TARGET variable:

 * env
 * platform
 * subtarget
 * subtarget_platform

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

Signed-off-by: Petr Štetiar <ynezz at true.cz>
---
 include/target.mk | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/include/target.mk b/include/target.mk
index 72fe493776b9..444cc032400f 100644
--- a/include/target.mk
+++ b/include/target.mk
@@ -177,18 +177,17 @@ LINUX_RECONFIG_TARGET = $(if $(USE_SUBTARGET_CONFIG),$(LINUX_SUBTARGET_CONFIG),$
 ifeq ($(CONFIG_TARGET),platform)
   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_platform)
   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)" invalid, use one of `platform`, `subtarget`, `subtarget_platform` or `env`)
 endif
 
 __linux_confcmd = $(2) $(patsubst %,+,$(wordlist 2,9999,$(1))) $(1)



More information about the openwrt-devel mailing list