From patchwork Tue Oct 16 09:10:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 148923 Delivered-To: patch@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp4828364lji; Tue, 16 Oct 2018 02:12:13 -0700 (PDT) X-Google-Smtp-Source: ACcGV6110d0V2TjGcN/ElGDkfd2SLt0oUXpqPEERHHEcj3UlfbLR+++Vy0liWc+CdH1TarWzWKgX X-Received: by 2002:a62:6bc7:: with SMTP id g190-v6mr10037515pfc.60.1539681133614; Tue, 16 Oct 2018 02:12:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539681133; cv=none; d=google.com; s=arc-20160816; b=YZ0KN2ridQIUz0wazVVgupochBCylhBQTjx4Ouz7xltrZUgPQ9h8pD/meYVdjQ7Ing i7GpaAuK5t0kZBUgAKL9s6ZrPNt1x2vO94Q39/0PvCDi/b83UMLQ5Mpz6Zhe3so9OdeA re/WjWOM0kWOwxGAB2be2CdSKHA9XS2sebhvhUqBoO14pBIAcbNRdt/ajTecsOIBeU/W i+UAOdbwp5iacXGWEsklIcpEueoeW8BWCB6iuZAb+YQgIeS4ql3JvT2GhKswOSbVuEGF hQN2OHBAtlsS/ySWLpVYGBmPVAGecxdpc9gFAwNk9DgcH1DCcjHRtV9IQ+7xtQ+M52cx 11HQ== 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; bh=bXpviXkYAhvFT7qG6xXXNbPHFseOjHvbyF4Xhb2IpBA=; b=nGNSrsrgwm2aS57O4IB8CMLINV80HtBJXrerU7BCeHkjodWa2Od785h9EIRfJPeb9z 2QdmJVGRNt582qXk8n69ahIFiqXeAl9KUX4U37VO0LnOYtRqcdTlaKbeC+3CJYofQH01 W+WvUayzZQCllMGTBdAul1tceYJlrdk+xTKA3cxDi/IVpI/iMkayHP97cvbkGtLHuYT5 UP1DxsI4cddwFUwBEFE6XTIaSILNwAfAUK/NKG1oGzGdpXYnqVai/FKbV8KCNtoWg/4p f+EiA8VtnJsS+SkY2Efwx+g+2yq2CTsjECxdsoIldGry5ASnrOly81qsvUCJTlr2dHNP si+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nifty.com header.s=dec2015msa header.b=zn1dGnan; 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 f62-v6si14378831plf.288.2018.10.16.02.12.13; Tue, 16 Oct 2018 02:12:13 -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=zn1dGnan; 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 S1727259AbeJPRBi (ORCPT + 32 others); Tue, 16 Oct 2018 13:01:38 -0400 Received: from conuserg-09.nifty.com ([210.131.2.76]:57571 "EHLO conuserg-09.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727032AbeJPRBh (ORCPT ); Tue, 16 Oct 2018 13:01:37 -0400 Received: from pug.e01.socionext.com (p14092-ipngnfx01kyoto.kyoto.ocn.ne.jp [153.142.97.92]) (authenticated) by conuserg-09.nifty.com with ESMTP id w9G9BLLv029692; Tue, 16 Oct 2018 18:11:22 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conuserg-09.nifty.com w9G9BLLv029692 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1539681083; bh=bXpviXkYAhvFT7qG6xXXNbPHFseOjHvbyF4Xhb2IpBA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zn1dGnanzsIvhFqKk6xLja7en9LBahNuNgeJN7L/sUhQGIADqRV19Dwju/lZ7yj7c FJ815cyptAXC/wIoILrUDhKdtvHfl8Ow0fIjOMb5F+1yj/YSh1UENJ5P3I1PG6B9hZ 5tZQA+P1phhE3BAULEJB4oAtGMt1Tpj4/n2uU5uyGsdHlnrRFBfBiqAk1nT6o5hTMU /KOuh/47kD6h2tGmc+2/Nkx71OYInSFhSMU6PLGvc1bJeIROVU+atuxGI8Uw3/jz/Q dw0NJ9Bt7irfbb6UOm2AMj152Hm1w8DAgUJ39PXeqwqybE/QAZ36xFNoeNsiRZrbtM dtOncDU/HwwbA== X-Nifty-SrcIP: [153.142.97.92] From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Ingo Molnar , Josh Poimboeuf , Bernd Edlinger , Borislav Petkov , Sam Ravnborg , Masahiro Yamada , Michal Marek , linux-kernel@vger.kernel.org Subject: [PATCH 1/3] kbuild: provide a new place to check necessary host tools Date: Tue, 16 Oct 2018 18:10:51 +0900 Message-Id: <1539681053-24388-2-git-send-email-yamada.masahiro@socionext.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1539681053-24388-1-git-send-email-yamada.masahiro@socionext.com> References: <1539681053-24388-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 Enabling CONFIG options often requires additional features, like target compiler capabilities, host tools, etc. As for the target compiler capabilities, Kconfig is able to add proper dependencies. For example, config STACKPROTECTOR ... depends on $(cc-option,-fstack-protector) The CONFIG option is simply disabled if unsupported by the compiler. This seems sensible since otherwise, there is no way to avoid the build error. In the discussion [1], doing similar for host tools was unacceptable. Build errors caused by missing host tools are easy to fix; just install them to your build machine. So, let the build fail instead of disabling CONFIG options silently. We already have such checks in random places in makefiles. What I do not like is that people tend to do that in the top Makefile. The top Makefile is too cluttered, and what is worse, $(error ...) functions in the top Makefile could be false positive. (Please note the top Makefile includes the stale include/config/auto.conf before syncconfig updates it.) This adds a new file scripts/Makefile.toolcheck to check additional tools depending on the kernel configuration. This check is run immediately after syncconfig, i.e., when a user attempts to build something with a new set of CONFIG options. [1] https://patchwork.kernel.org/patch/10516049/ Signed-off-by: Masahiro Yamada --- Makefile | 1 + scripts/Makefile.toolcheck | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 scripts/Makefile.toolcheck -- 2.7.4 diff --git a/Makefile b/Makefile index bf3786e..23a204a 100644 --- a/Makefile +++ b/Makefile @@ -633,6 +633,7 @@ $(KCONFIG_CONFIG) include/config/auto.conf.cmd: ; # include/config/auto.conf (which mirrors .config). include/config/%.conf: $(KCONFIG_CONFIG) include/config/auto.conf.cmd $(Q)$(MAKE) -f $(srctree)/Makefile syncconfig + $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.toolcheck else # External modules and some install targets need include/generated/autoconf.h # and include/config/auto.conf but do not care if they are up-to-date. diff --git a/scripts/Makefile.toolcheck b/scripts/Makefile.toolcheck new file mode 100644 index 0000000..f3c165d --- /dev/null +++ b/scripts/Makefile.toolcheck @@ -0,0 +1,35 @@ +# SPDX-License-Identifier: GPL-2.0 +# =========================================================================== +# Host tools check +# =========================================================================== +# +# Some additional tools might be required depending on the kernel configuration. +# Check if they are installed on the host machine, and if missing, error out +# with a user-friendly message. + +include include/config/auto.conf + +__toolcheck: + @: + +PHONY += $(toolcheck-y) +__toolcheck: $(toolcheck-y) + +define populate_toolcheck +__toolcheck: check_$(1) +PHONY += check_$(1) +check_$(1): + $(Q){ $(chk_$(1)); } >/dev/null 2>&1 || { \ + echo "*" >&2; \ + for msg in $(msg_$(1)); \ + do \ + echo "* $$$${msg}" >&2; \ + done; \ + echo "*" >&2; \ + /bin/false; \ + } +endef + +$(foreach c, $(toolcheck-y), $(eval $(call populate_toolcheck,$(c)))) + +.PHONY: $(PHONY)