From patchwork Thu May 17 06:17:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 136098 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1878800lji; Wed, 16 May 2018 23:21:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrGINkatwxQLogtYzdaXuEFnQV5+/BvHfVADa37W8bQitRBPs7mpLrXxfDw7Qj89G/p3xuk X-Received: by 2002:a63:6fc3:: with SMTP id k186-v6mr3135950pgc.111.1526538062089; Wed, 16 May 2018 23:21:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526538062; cv=none; d=google.com; s=arc-20160816; b=IgNxdNGPX+Z/hAjmRz9Jjm5Lfe9IbKWlSI/Zhg7l3WhT+qYQKvSyAQpPUL8ChPL9yF G64kuQoNFNmcXwTmKCBoACQctxfMj4Bhpg+YoGVgfjFUO0E8bQPHdrP67YA+E8kuGeoK 6NQtf5arCezvaRNT0j2cFf25KyDsupH3wk7A3FTjfUJkAe0bH/QeXb3OjRopZXGAu8l2 nViJQ2BpyoFv8j0cv0VZ0Rs7SnLkj57qJgruUK8hdunwK1Se6dSwFw49uHVgsEAhepjG 4NiDJzQfj2gtf2JbDbJaLIWDzBpjQgHOB8z1NmV6LxHv6de5t15hRn2CVPLkKoIhkrFg s1LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:dkim-filter :arc-authentication-results; bh=5mJlL/t+ozUtBhJCFdxYpng+Ff1pUYw/yo8QejCackc=; b=SJWf05Jfj0xj3yz0fyn+SfNwQuorg+qAa3LrJvczK+xW/+K/OAw8712PUZzKaLb373 gAQ69WonO4nGTE3rn3wuVZhJ8oCi5ua7f9HuR4q24Q4MOOFCN/VUbRQIEZP6jwcdxcd3 QC7UNxFbX4/0UxC1paYhv+UGjGTVJLHk7P8jo1Go2Q593M+VZayHNSM6HVUMxxSduVaJ ajdP2djK4Co3+wnMn5a2qcsFB5SkXahFk7OlSoFegMIDllbP4FAL7Dcw5ffYn9/ZqXRR 0oO5+EdtehMtSzfPEj51qykr1NjPVoHv/8O6zUTLSteh0wJQCn5gICBClSiVCHjcMVZx 63rw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=K3urevTc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay5-v6si4227649plb.459.2018.05.16.23.21.01; Wed, 16 May 2018 23:21:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=K3urevTc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752485AbeEQGUf (ORCPT + 29 others); Thu, 17 May 2018 02:20:35 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:26311 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752380AbeEQGT7 (ORCPT ); Thu, 17 May 2018 02:19:59 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-10.nifty.com with ESMTP id w4H6HbUK002841; Thu, 17 May 2018 15:17:59 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com w4H6HbUK002841 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1526537880; bh=5mJlL/t+ozUtBhJCFdxYpng+Ff1pUYw/yo8QejCackc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K3urevTckZmHPz7VU07K3hYm0IQtc4UP/5dPvXZ15UJWOEIVx1KItFvDvgCR/3/Pz +clIgiJEMXPg+uDTaOxwvxBVwgskKyfFBa7ChjhCmq+hS4FhCleXP5Y8/CH9jwlJnJ 3PzGycX/w83+CjNkMGFOul1NwRmNShk9PhdeR0IziM3k1OAmD/WfwFr9W0g0kuHiPA 8e8/NZ0PMNRcP4myKCnTkiy5VZKswtU2tlhayB9h850eQoGW8axeI7tbSz31gk/HkK VxkJoyNEhMcJQoBuZpxLUqTQ7nDxGEnzMeDnNtZXmGB9XmIawEVf0b4u2AAfDN2YPa cVG6SPfaHbI+g== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Linus Torvalds , Sam Ravnborg , Ulf Magnusson , "Luis R . Rodriguez" , linux-kernel@vger.kernel.org, Nicholas Piggin , Kees Cook , Emese Revfy , x86@kernel.org, Masahiro Yamada Subject: [PATCH v4 22/31] kconfig: add basic helper macros to scripts/Kconfig.include Date: Thu, 17 May 2018 15:17:01 +0900 Message-Id: <1526537830-22606-23-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1526537830-22606-1-git-send-email-yamada.masahiro@socionext.com> References: <1526537830-22606-1-git-send-email-yamada.masahiro@socionext.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Kconfig got text processing tools like we see in Make. Add Kconfig helper macros to scripts/Kconfig.include like we collect Makefile macros in scripts/Kbuild.include. Signed-off-by: Masahiro Yamada Reviewed-by: Kees Cook Reviewed-by: Ulf Magnusson --- Changes in v4: - source scripts/Kconfig.include from arch/x86/um/Kconfig since UML is special - Use { $(1); } for 'success' macro for better performance - Use -E instead of -c for 'cc-option' macro for better performance - Add 'if-success' macro Changes in v3: - Move helpers to scripts/Kconfig.include Changes in v2: None Kconfig | 2 ++ MAINTAINERS | 1 + arch/x86/um/Kconfig | 2 ++ scripts/Kconfig.include | 24 ++++++++++++++++++++++++ 4 files changed, 29 insertions(+) create mode 100644 scripts/Kconfig.include -- 2.7.4 diff --git a/Kconfig b/Kconfig index 5b55d87..a90d9f9 100644 --- a/Kconfig +++ b/Kconfig @@ -7,4 +7,6 @@ mainmenu "Linux/$(ARCH) $(KERNELVERSION) Kernel Configuration" comment "Compiler: $(CC_VERSION_TEXT)" +source "scripts/Kconfig.include" + source "arch/$(SRCARCH)/Kconfig" diff --git a/MAINTAINERS b/MAINTAINERS index b7d7ae61..1667cee 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7634,6 +7634,7 @@ L: linux-kbuild@vger.kernel.org S: Maintained F: Documentation/kbuild/kconfig* F: scripts/kconfig/ +F: scripts/Kconfig.include KDUMP M: Dave Young diff --git a/arch/x86/um/Kconfig b/arch/x86/um/Kconfig index a992f8e..9d529f2 100644 --- a/arch/x86/um/Kconfig +++ b/arch/x86/um/Kconfig @@ -3,6 +3,8 @@ mainmenu "User Mode Linux/$(SUBARCH) $(KERNELVERSION) Kernel Configuration" comment "Compiler: $(CC_VERSION_TEXT)" +source "scripts/Kconfig.include" + source "arch/um/Kconfig.common" menu "UML-specific options" diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include new file mode 100644 index 0000000..b1502f4 --- /dev/null +++ b/scripts/Kconfig.include @@ -0,0 +1,24 @@ +# Kconfig helper macros + +# Convenient variables +comma := , +quote := " +squote := ' +empty := +space := $(empty) $(empty) + +# $(if-success,,,) +# if exits with 0, otherwise. +if-success = $(shell, { $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)") + +# $(success,) +# y if exits with 0, n otherwise +success = $(if-success, $(1),y,n) + +# $(cc-option,) +# y if the compiler supports , n otherwise +cc-option = $(success, $(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) + +# $(ld-option,) +# y if the linker supports , n otherwise +ld-option = $(success, $(LD) -v $(1))