From patchwork Thu Nov 22 00:06:06 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1789001 Return-Path: X-Original-To: patchwork-linux-kbuild@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id CAE093FCAE for ; Thu, 22 Nov 2012 21:10:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751207Ab2KVVKy (ORCPT ); Thu, 22 Nov 2012 16:10:54 -0500 Received: from mail-we0-f174.google.com ([74.125.82.174]:44535 "EHLO mail-we0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751706Ab2KVVKw (ORCPT ); Thu, 22 Nov 2012 16:10:52 -0500 Received: by mail-we0-f174.google.com with SMTP id d7so2149633wer.19 for ; Thu, 22 Nov 2012 13:10:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=Gxry5BGs4rHzAjLLa/A3/zUFljLxsnec2/ZX1gujfQU=; b=BCFVtc1uv+O+olAJT4UD1WOMug0KaSA0cAZtpDAQBkUcjZU25ABYf8d0FvRlw7KlIt DAlemOdXZvhtym8KoS/WQ7rjbAHi7bDAStlnaH2NDVa6nilJ75hRMa0F4VqgOYYr9B94 UjmeI7BITUfHuiYyz61TEEgchKb9GzOqpD8OvErB4wdFRROuQsKqmePEB/d18nGpqIIE MCD+rP1CvyCEG+MwR4mkhoaZnPhrsf9SUUnPAl4v8ryAc65f4biiyJrfrblhhoiWVGMk TOGaWxQ8wnE6tO0cm4J3fnk1jsXM9TMCSithdRVwmDE50hIjiHSUjihl18Mvk9ZVlCpQ zfmA== Received: by 10.216.204.162 with SMTP id h34mr5307615weo.213.1353542777473; Wed, 21 Nov 2012 16:06:17 -0800 (PST) Received: from localhost.localdomain (ARennes-256-1-138-125.w90-32.abo.wanadoo.fr. [90.32.249.125]) by mx.google.com with ESMTPS id j18sm1608627wiv.9.2012.11.21.16.06.16 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 21 Nov 2012 16:06:17 -0800 (PST) From: "Yann E. MORIN" To: linux-kbuild@vger.kernel.org Cc: Michal Marek , "Yann E. MORIN" Subject: [PATCH 3/3] scripts/kconfig: allow setting the root-menu label from environment Date: Thu, 22 Nov 2012 01:06:06 +0100 Message-Id: <1353542766-24422-4-git-send-email-yann.morin.1998@free.fr> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1353542766-24422-1-git-send-email-yann.morin.1998@free.fr> References: <1353542766-24422-1-git-send-email-yann.morin.1998@free.fr> Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org Currently, the root-menu label is hard-coded in the kconfig frontends executables. This means that two projects that use kconfig and want to display different root-menu labels can not share the same kconfig frontends. Instead of hard-coding the label in the frontends, handle it the same we handle the CONFIG_ prefix: - get the root-menu label from the environment if present - allow to set it at build time (eg. -DROOTMENU='"Root menu label"') - fallback to a hard-coded default (Note: the kconfig 'mainmenu' directive still has precedence) (refresh zconf.tab.c_shipped to match) Signed-off-by: "Yann E. MORIN" --- scripts/kconfig/Makefile | 3 ++- scripts/kconfig/lkc.h | 8 ++++++++ scripts/kconfig/zconf.tab.c_shipped | 2 +- scripts/kconfig/zconf.y | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 231b475..493da53 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile @@ -11,8 +11,9 @@ else Kconfig := Kconfig endif -# We need this, in case the user has it in its environment +# We need these, in case the user has them in its environment unexport CONFIG_ +unexport CONFIG_ROOTMENU xconfig: $(obj)/qconf $< $(Kconfig) diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 5cfd940..93b9e69 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -46,6 +46,14 @@ static inline const char *CONFIG_prefix(void) #undef CONFIG_ #define CONFIG_ CONFIG_prefix() +#ifndef CONFIG_ROOTMENU +#define CONFIG_ROOTMENU "Linux Kernel Configuration" +#endif +static inline const char *CONFIG_rootmenu(void) +{ + return getenv( "CONFIG_ROOTMENU" ) ?: CONFIG_ROOTMENU; +} + #define TF_COMMAND 0x0001 #define TF_PARAM 0x0002 #define TF_OPTION 0x0004 diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index f636141..8c91e69 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped @@ -2259,7 +2259,7 @@ void conf_parse(const char *name) modules_sym = sym_lookup(NULL, 0); modules_sym->type = S_BOOLEAN; modules_sym->flags |= SYMBOL_AUTO; - rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); + rootmenu.prompt = menu_add_prompt(P_MENU, CONFIG_rootmenu(), NULL); if (getenv("ZCONF_DEBUG")) zconfdebug = 1; diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 864da07..9ce6935 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -496,7 +496,7 @@ void conf_parse(const char *name) modules_sym = sym_lookup(NULL, 0); modules_sym->type = S_BOOLEAN; modules_sym->flags |= SYMBOL_AUTO; - rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); + rootmenu.prompt = menu_add_prompt(P_MENU, CONFIG_rootmenu(), NULL); if (getenv("ZCONF_DEBUG")) zconfdebug = 1;