Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2141503imm; Mon, 28 May 2018 02:27:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrz+SGxGSpAcWCkJixPYsfiqPbOKY4vkHJxT2fHzXiW4lXvBcc9l4J/I+e7ZT87AevL/VRP X-Received: by 2002:a17:902:680c:: with SMTP id h12-v6mr13114833plk.113.1527499647298; Mon, 28 May 2018 02:27:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527499647; cv=none; d=google.com; s=arc-20160816; b=TRHbG43jsveLz9Brqg9oLbJczqlE5PYEu0AGcaGJhZImrJHAx9+hpQF6fOfe9wBAxv Ohr/68bS+dhT9TzbBBgJHDP/pvvjzEbOzRZwCmpGj8wn4HvEtpOzFCTHUA09LSpr8D4n S1d2ErBMI3GOzFvHUwlrXaHE0qhRv1fgGyWLNbmrSq49TbvaHCnSNQOE2Fq6hDAHseVG G2KQ0gVasZyt59JEmraHSMTjtYSaS9GW/+SSXCNX/q6KxJZXw0/wf9ay21RLWMUxLdmO TOJklC27vPf3scsoycTktA+fNRqWxg+E4hlcMgdtc9JT/XQcSqxfWDoqxiSBXVi6H2E6 d+dQ== 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 t80-v6si7497281pfe.59.2018.05.28.02.27.12; Mon, 28 May 2018 02:27:27 -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 S933558AbeE1JZF (ORCPT + 99 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 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)) -- 2.7.4