From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E07D7C433EF for ; Tue, 5 Oct 2021 18:11:33 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3852E6115B for ; Tue, 5 Oct 2021 18:11:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 3852E6115B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id EFC8281197; Tue, 5 Oct 2021 20:11:30 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="I6RWAlx8"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BFB8982D1C; Tue, 5 Oct 2021 20:11:29 +0200 (CEST) Received: from mail-oo1-xc2d.google.com (mail-oo1-xc2d.google.com [IPv6:2607:f8b0:4864:20::c2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4D7CE807CD for ; Tue, 5 Oct 2021 20:11:26 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=mr.nuke.me@gmail.com Received: by mail-oo1-xc2d.google.com with SMTP id w6-20020a4aa446000000b002b5795cca03so58045ool.6 for ; Tue, 05 Oct 2021 11:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=T+f6PYun+B5u/4B0Owu9ulR5RYi/x6xefb7qsW3/aCM=; b=I6RWAlx8fWw6iTfrWiGYtvIGghelhyQZKHiQvCl4V13ZOgvEDWdo8a1VjbXZIjvHRy evUezdDX8/z57KfuEE/c563zoR6rvgmNg9JJw6rDjdCpTChM71gWcrRgSCoXcCGwJkC3 29VWs/evCWs51eTt9U9wAafp13X6eL5SIaIznkw6NICUjxLOhqRmgqtDDOhboOCH5MZp FFqywYyBhEWBzix4HDB4kuCGwZsyH+ydSxntuJalmcPkCBm1jZm1+M27yVCW8tHAQg61 AHlvyqRdOI8nXIJziN3r/ltS2O2o8Uwns9pOFSry7SyedSQ1H86Fvb9jJxuaK5MSIEvT Mu0Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=T+f6PYun+B5u/4B0Owu9ulR5RYi/x6xefb7qsW3/aCM=; b=atyJgvHvsFsgm7iSoVFnZqiEM9U/aII6VGin5+G8vfFhxcBeUpW41YPmjPh2YX2LsO twKqpy71bxk9w/FjpB0rmOsGoA2GDcAtRI/opviNvSH3fQm6qXaDfEgqWJCZS67ZZWZs VWp87R1ie9JOi1zUWGYS6K9qN4tx52RkYiEkkozGLn2+NaQGFVBqE4u/7kCW8TLo8oFg 5fs68uzCmo+PzF1nf8spmiLrG6Vddrc6m73Z+kvA8SvsOLMVtk9a+O7s3mnVEmZXyV0G UKU8f1zZOvDM9u2uk0OxsLCdxJoLC8ejbHdTX6Q4DCnE328tFFuYBSyD8qDHYDxTAHTl j7Eg== X-Gm-Message-State: AOAM532W5tvYahn3WUtubBE8lnbMXGqziT6FRuk7iWPW76ksMR70dyM9 i7TwpTYgaox+og2U5JsLTZM= X-Google-Smtp-Source: ABdhPJzmTwjiV3gUvupE9ApKkiTtNAw3eCVGqTWFw8cax2duT6Lx1CvvfqpN8Ajf+EGpDtx/MTexOQ== X-Received: by 2002:a4a:ca98:: with SMTP id x24mr7442143ooq.91.1633457484834; Tue, 05 Oct 2021 11:11:24 -0700 (PDT) Received: from nuclearis3.gtech (c-98-195-139-126.hsd1.tx.comcast.net. [98.195.139.126]) by smtp.gmail.com with ESMTPSA id h17sm3472659oog.17.2021.10.05.11.11.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Oct 2021 11:11:24 -0700 (PDT) Subject: Re: [PATCH v5 02/29] kconfig: Add tools support to CONFIG_IS_ENABLED() To: Simon Glass , U-Boot Mailing List Cc: Andre Przywara , Rasmus Villemoes , Robert Marko , Masahiro Yamada , Tom Rini , Masahiro Yamada References: <20210926014342.127913-1-sjg@chromium.org> <20210926014342.127913-3-sjg@chromium.org> From: "Alex G." Message-ID: <72f28e21-4ed5-60f0-f740-07bec51951bb@gmail.com> Date: Tue, 5 Oct 2021 13:11:23 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210926014342.127913-3-sjg@chromium.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On 9/25/21 8:43 PM, Simon Glass wrote: > At present we must separately test for the host build for many options, > since we force them to be enabled. For example, CONFIG_FIT is always > enabled in the host tools, even if CONFIG_FIT is not enabled by the > board itself. > > It would be more convenient if we could use, for example, > CONFIG_IS_ENABLED(FIT) and get CONFIG_HOST_FIT, when building for the > host. Add support for this. > > With this and the tools_build() function, we should be able to remove all > the #ifdefs currently needed in code that is build by tools and targets. > > This will be even nicer when we move to using CONFIG(xxx) everywhere, > since all the #ifdef and IS_ENABLED/CONFIG_IS_ENABLED stuff will go away. > > Signed-off-by: Simon Glass > Suggested-by: Rasmus Villemoes # b4f73886 Under protest, Reviewed-by: Alexandru Gagniuc > --- > > Changes in v5: > - Update commit message > - Use TOOLS_ instead of HOST_ > > Changes in v2: > - Correct comment about USE_HOSTCC being undefined in CONFIG_VAL() > - Fix up comment to put an underscore after every CONFIG > > include/linux/kconfig.h | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/include/linux/kconfig.h b/include/linux/kconfig.h > index d109ed3119e..a1d1a298426 100644 > --- a/include/linux/kconfig.h > +++ b/include/linux/kconfig.h > @@ -31,11 +31,14 @@ > (config_enabled(option)) > > /* > - * U-Boot add-on: Helper macros to reference to different macros > - * (CONFIG_ or CONFIG_SPL_ prefixed), depending on the build context. > + * U-Boot add-on: Helper macros to reference to different macros (prefixed by > + * CONFIG_, CONFIG_SPL_, CONFIG_TPL_ or CONFIG_TOOLS_), depending on the build > + * context. > */ > > -#if defined(CONFIG_TPL_BUILD) > +#ifdef USE_HOSTCC > +#define _CONFIG_PREFIX TOOLS_ > +#elif defined(CONFIG_TPL_BUILD) > #define _CONFIG_PREFIX TPL_ > #elif defined(CONFIG_SPL_BUILD) > #define _CONFIG_PREFIX SPL_ > @@ -49,6 +52,7 @@ > > /* > * CONFIG_VAL(FOO) evaluates to the value of > + * CONFIG_TOOLS_FOO if USE_HOSTCC is defined, > * CONFIG_FOO if CONFIG_SPL_BUILD is undefined, > * CONFIG_SPL_FOO if CONFIG_SPL_BUILD is defined. > * CONFIG_TPL_FOO if CONFIG_TPL_BUILD is defined. > @@ -76,18 +80,21 @@ > > /* > * CONFIG_IS_ENABLED(FOO) expands to > + * 1 if USE_HOSTCC is defined and CONFIG_TOOLS_FOO is set to 'y', > * 1 if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y', > * 1 if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y', > * 1 if CONFIG_TPL_BUILD is defined and CONFIG_TPL_FOO is set to 'y', > * 0 otherwise. > * > * CONFIG_IS_ENABLED(FOO, (abc)) expands to > + * abc if USE_HOSTCC is defined and CONFIG_TOOLS_FOO is set to 'y', > * abc if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y', > * abc if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y', > * abc if CONFIG_TPL_BUILD is defined and CONFIG_TPL_FOO is set to 'y', > * nothing otherwise. > * > * CONFIG_IS_ENABLED(FOO, (abc), (def)) expands to > + * abc if USE_HOSTCC is defined and CONFIG_TOOLS_FOO is set to 'y', > * abc if CONFIG_SPL_BUILD is undefined and CONFIG_FOO is set to 'y', > * abc if CONFIG_SPL_BUILD is defined and CONFIG_SPL_FOO is set to 'y', > * abc if CONFIG_TPL_BUILD is defined and CONFIG_TPL_FOO is set to 'y', >