From patchwork Mon May 28 09:21:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 137044 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp2592340lji; Mon, 28 May 2018 02:25:07 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpOwrwwj0EeXiypHgE1TfQCS8UMXwoAcFwV9uBvjsAdUY18EaaAhavdxHa/bdxz4+mNGMMu X-Received: by 2002:a63:b215:: with SMTP id x21-v6mr9541371pge.393.1527499507486; Mon, 28 May 2018 02:25:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527499507; cv=none; d=google.com; s=arc-20160816; b=QTAwIV1+7e9/EJTDK84PhtzESwW8VUGAikauosfVCBI+bRTD4D9OP6xHe5MKwx8nrz GNKEik5/mB4ko7st9lw0cvJF6bgRGpDex+1Y778IN6ORlNEFdeHV4dqErHoUPVtMyUSA t8fw+qLHAd0ttp1DR1opl8d9z0hx74QHgGRI+OAi5ITQ68VrgY7hOC9JIfBfyYhiWbUV h1Rl78NDVjxqhdvn+iIdhflkvRLg9nxBQWS+lA8qfgwi9LCM/2/KgIFbZ75edox/RvEW tCo/NiI7eoqGqTrntq2RFjPPIra4dkHSE/Xm6ngQiAbF39LxmDlTFL+Xu9M7jn4c3cGa b8qg== 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=unsFiFi/xtm2oBI/in0Sb3ZGNiZANg5KGMUcVIKyl38=; b=KUZ3WUCLMFFUK7pTdZRW9JFKAZ5oZb4bR7jFUbkgIS95l1VtmUJHfGqc/naD8afgzN g2hQR9pp/iySHE01DrFbEUq48WFnhBTowGx/EzzQGhgtJaDMKJaTfwMKZsxPP/eHdRuL dh07goNjGHUzFCaJO4EsSjiPxVzoBRwPcdOKfi+B6SD69H/MJkWsNc+RIs0DHz9OAQ+J MCh/7dqnH7/KlHzrFqvS1hqpgPqnyjDGUrG0JzaleQYBnbQefACXDE2kBApD1O9V7K1/ scF/HMbPJWM8zdX55BPXAYgwX8iSidWaVEHBOyCLpwEbc3sc7Vi/LEMp96ZBrEk9j6Ci QJrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=U5PeggRi; 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 m11-v6si17795287plt.284.2018.05.28.02.25.07; Mon, 28 May 2018 02:25:07 -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=U5PeggRi; 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 S933585AbeE1JZF (ORCPT + 30 others); Mon, 28 May 2018 05:25:05 -0400 Received: from conuserg-10.nifty.com ([210.131.2.77]:22960 "EHLO conuserg-10.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933509AbeE1JZD (ORCPT ); Mon, 28 May 2018 05:25:03 -0400 Received: from grover.sesame (FL1-125-199-20-195.osk.mesh.ad.jp [125.199.20.195]) (authenticated) by conuserg-10.nifty.com with ESMTP id w4S9MInd027506; Mon, 28 May 2018 18:22:37 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-10.nifty.com w4S9MInd027506 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1527499357; bh=unsFiFi/xtm2oBI/in0Sb3ZGNiZANg5KGMUcVIKyl38=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=U5PeggRiwBkNpnTrduk97u9+lwV/7KXV4Pgwt11I52uTQ1oEorfFGldv6ARPf8L0x TxiWNPZlV4t/gHj6j144Zrfwn/zhlOUMfSgmLF1N83bCm4rlGzs+wQ3ZyTfLzoYHaX Eq355Z31PhMRXYRFdPGyBSilpGxcUIoutWhyHtQ+HRXM2f2gDA7KR46mzFsf7d8dij 5BS3vP2XpTAAfCp8ANSyDyVfn4UANKtP08TIuA4LgA4MpP96WWkSkvV4cLiZrujkAO C+rwh7QBRGslm1dirpLdvLVo5kYqTQfhX9jPAPK9h6j4CdNSrMaQPlkE+Jf52MyIib yqtrDC5LZnG6Q== X-Nifty-SrcIP: [125.199.20.195] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Kees Cook , Nicholas Piggin , "Luis R . Rodriguez" , Randy Dunlap , Ulf Magnusson , Sam Ravnborg , Linus Torvalds , Masahiro Yamada Subject: [PATCH v5 22/31] kconfig: add basic helper macros to scripts/Kconfig.include Date: Mon, 28 May 2018 18:21:59 +0900 Message-Id: <1527499328-13213-23-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527499328-13213-1-git-send-email-yamada.masahiro@socionext.com> References: <1527499328-13213-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 v5: - Add dollar, right_paren, left_paren variables 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 | 27 +++++++++++++++++++++++++++ 4 files changed, 32 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 b87723a..79decb1 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7639,6 +7639,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..bf7c0c9 --- /dev/null +++ b/scripts/Kconfig.include @@ -0,0 +1,27 @@ +# Kconfig helper macros + +# Convenient variables +comma := , +quote := " +squote := ' +empty := +space := $(empty) $(empty) +dollar := $ +right_paren := ) +left_paren := ( + +# $(if-success,,,) +# Return if exits with 0, otherwise. +if-success = $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)") + +# $(success,) +# Return y if exits with 0, n otherwise +success = $(if-success,$(1),y,n) + +# $(cc-option,) +# Return y if the compiler supports , n otherwise +cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null) + +# $(ld-option,) +# Return y if the linker supports , n otherwise +ld-option = $(success,$(LD) -v $(1))