From patchwork Mon Jun 26 23:30:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 113156 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7834244vqr; Mon, 26 Jun 2023 17:01:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7iwXg8PCaE4FWcLo/sqx6KTj9rCtC5npWRi5RL+6asPqvk6MK8aR0ngGJocEGgs5zw8eZi X-Received: by 2002:a05:6a21:6d88:b0:11d:5b5d:ddf0 with SMTP id wl8-20020a056a216d8800b0011d5b5dddf0mr18876202pzb.49.1687824086146; Mon, 26 Jun 2023 17:01:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687824086; cv=none; d=google.com; s=arc-20160816; b=f71aiIkhdbgoDCUpP8d9OoLIzpXl1p5cCFfnTm52r/3nb3Q9mVZYKqAzhtfWv95VBt aP+yP73B2VNGnjhQOzRg2cZizUHbAUTDvdqVYOaczp+AcUYGL12R8QR8D57DZmUI8oLs noBlj5j+K3QCfYQu1VgIW0oZw7atCs/ykKIdRBSNkltccRlWzeDhcriOG3kM/1gqd1Tg j6uIloFrOhV1lQJDAWiJ0Wokpwo3EWKr7wH1Iip8VfAEs51ftFXwYc6zHbdqEMoL+f+3 qNPBVXKsXNbbS7BCMw6/dsty8YRsVmQ61bQihbSbf5by67lqM4H4EL/Qj2UqyuODUEoo O5uQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=MweGXf9Xzq+x0Clij8AKqvWwHgKlYg2vGlTp22RSz5Q=; fh=wKrPioF+0wPaktGqmf0aQvlk8PY4Pc32rTAsBSAiP8I=; b=rgrXwjGT5qgSnqJ3RnjwTaLJsDvO8NiSHyfgsD7LZ2tt+UXEGQou8eOEg0G/CFD661 0OmdWJM6a6zVYiEl1Bq+8E3mkS3DHKQaUvjdTdgTTk5NcV5xUNnmMDe6V5WB6J8mTPSo 7ews2LlszxOUqSgb+lEAzzzqXGj+LWXONccwROvtdQiD9Rnd7iwqvioo0Y6P/e3vw2fz ttRWVADGgYhi21GPALKIm0w2TsZfO5wJCyH42Nhq5zddw+LrjrRJt9rKTn7nYDQLcd8/ /aRHTXxd+4uRR6NVW6S7/Q95Q9iy1nzxrKB/VVYU1EoVnH5zlQKOTt+FVKAzOkh8O4Bi nXwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TxIfBg0w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p19-20020a170902c71300b001b18c3ee3fasi2544319plp.225.2023.06.26.17.01.13; Mon, 26 Jun 2023 17:01:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TxIfBg0w; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229828AbjFZXa2 (ORCPT + 99 others); Mon, 26 Jun 2023 19:30:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229495AbjFZXaW (ORCPT ); Mon, 26 Jun 2023 19:30:22 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 764E9FB; Mon, 26 Jun 2023 16:30:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 0208460F9D; Mon, 26 Jun 2023 23:30:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3914CC433C8; Mon, 26 Jun 2023 23:30:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687822220; bh=cjJsx6TjubpGMxRoEjJsSsu/4pIX4weGQrf/DhGnRwM=; h=From:To:Cc:Subject:Date:From; b=TxIfBg0wkRWHpL0I3cKAWbAYQvCwixUZRiHMJ5JvVbrGo3yea6cFyXZiT3cDkorn6 6Wv/Fbyh3aiTqyAqDJCuJEwUybPSX9E4ryQdrKPyzzcOQCqWT8qr+EgQ7MaNVA9txD vOuS+ZxRar2p91fvXePl+2VVURM+oYIqPIeUhNh5Gu0PsR2x6fqXTzITteMcyH5lmA 0D1W7ZD4PX9MwIk1ojtPGgWd7DnlYPgTkjKeAP3MWrlHuKu0jdHqlRhGzEAUmtW6vm hUA8JcZRhcq1w4evon/LoZN/Nco4NkRqXCo5KnbYBI5IbPkxoXl7C94xaZe4tGtTrZ couq/E4em9y+w== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH v4 1/3] kbuild: set correct abs_srctree and abs_objtree for package builds Date: Tue, 27 Jun 2023 08:30:12 +0900 Message-Id: <20230626233014.66549-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769811828957928002?= X-GMAIL-MSGID: =?utf-8?q?1769811828957928002?= When you run 'make rpm-pkg', the rpmbuild tool builds the kernel in rpmbuild/BUILD, but $(abs_srctree) and $(abs_objtree) point to the directory path where make was started, not the kernel is actually being built. The same applies to 'make snap-pkg'. Fix it. Signed-off-by: Masahiro Yamada --- Changes in v4: - Export abs_{src,obj}tree again Changes in v3: - New patch Makefile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f18d59c81241..70b314059d8b 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,10 @@ __all: # descending is started. They are now explicitly listed as the # prepare rule. +this-makefile := $(lastword $(MAKEFILE_LIST)) +export abs_srctree := $(realpath $(dir $(this-makefile))) +export abs_objtree := $(CURDIR) + ifneq ($(sub_make_done),1) # Do not use make's built-in rules and variables @@ -185,8 +189,6 @@ $(if $(abs_objtree),, \ # $(realpath ...) resolves symlinks abs_objtree := $(realpath $(abs_objtree)) -else -abs_objtree := $(CURDIR) endif # ifneq ($(KBUILD_OUTPUT),) ifeq ($(abs_objtree),$(CURDIR)) @@ -196,9 +198,6 @@ else need-sub-make := 1 endif -this-makefile := $(lastword $(MAKEFILE_LIST)) -abs_srctree := $(realpath $(dir $(this-makefile))) - ifneq ($(words $(subst :, ,$(abs_srctree))), 1) $(error source directory cannot contain spaces or colons) endif @@ -211,7 +210,6 @@ need-sub-make := 1 $(this-makefile): ; endif -export abs_srctree abs_objtree export sub_make_done := 1 ifeq ($(need-sub-make),1) From patchwork Mon Jun 26 23:30:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 113157 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7834298vqr; Mon, 26 Jun 2023 17:01:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5PRD9tiwilid7aPfJgZVi2OBNpNwVzWSIJvf+kBiUtjncKHw7ubKqIks+N979mb1JLaWe/ X-Received: by 2002:a05:6358:f59:b0:132:db22:85d4 with SMTP id c25-20020a0563580f5900b00132db2285d4mr7901036rwj.15.1687824091127; Mon, 26 Jun 2023 17:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687824091; cv=none; d=google.com; s=arc-20160816; b=Kb1deAIVKtHDJGBvYK8HHmioARORQp+iaL7HAh0Ke5PzBDf7usLpBsYAkNPL8NE14V tgbWghiTou2VcGpEpuv2Ew+L0u/ldl8pKlBN24pGPwUSUU0fhLONyA32dyko5e6EH0EX oHV+JRtesKIB+kDM2SHkPq4jRjEqZLgQcB5jkk40gqcqgIV9Oou8uJPrNA175C+cooBO 6BJ2nvx0iquhTk28FQad+HGjLvYooopztZGDhuT0mZT3fryvjuCYywQN0HomOVFGcBoo me152Rz5oW6ajLrc+50MTL1UKhWAnQODir3InHvxLOzV9EgpCYUe4eE5evIwAlzynHYo NPnw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z7pYGa8rDo99ghNQUWKZBXWSKqiq2LeIqr9oSPEXTEE=; fh=wrVSAms63+L6z8krOjyglG1F29qH3ROX8soVAPpYEZQ=; b=hmiqNGHM3kwhS915/sPwKLQYP27gOrng0IFep/FHjHEDLGlqFa/3TmhA7ta5F4Hicd 7DTW4Ywexih48AZuKo/h9GOjBZ5556hZUZJxDLt3U65mUosRKlsNPBgweFHHNbfwXPZJ VFAK9//BOF6rSFmJbijwzqOxwYgZYlSqroLWzx6lkjFTGBSrH4r2QJkunPbE9n1wwEEo 2CjNQ3sVNJxtaXBh4XaS5v06ET9GP83gvjJ8WFmBOMBv4iGQn2KZunJ9ygeUcktT6DSf r4YOEcfxLb/6nUQxLMvw6DGep+fNSXZd9cPdhsoY8Y3X5gP8P5Nh9e5rBulu1QggS9r+ Bn2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Uuc7KWgg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c5-20020a6566c5000000b0055b07fcb6easi260393pgw.401.2023.06.26.17.01.18; Mon, 26 Jun 2023 17:01:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Uuc7KWgg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229835AbjFZXaa (ORCPT + 99 others); Mon, 26 Jun 2023 19:30:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229788AbjFZXaY (ORCPT ); Mon, 26 Jun 2023 19:30:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1F4471993; Mon, 26 Jun 2023 16:30:23 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id B103860FA1; Mon, 26 Jun 2023 23:30:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB517C433CB; Mon, 26 Jun 2023 23:30:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687822222; bh=rut2x3x4/ddYs7ZIIxGjOf4PLVPQzvlEqaLfEvu/H10=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uuc7KWggAR6MILprZr7tr5vxwtkm19rF9vLIIgs7TXgAMlY84ZEwZbqdWcWaap6pp U+iIZm5wA/48CRUl09Yckyk0oFlGTmh1n5dL+b1sfsPvj6f4IrxPiPbd5KHWi2CkGX Imh8uf3Goah4/nQTtgkXUFvPbi8u0BpmCPIgWqAz04YFcwFTPA6eJeBt3UhdT3XkAJ 84ZLA/FXqy4Z/HAEZXT2O9K1ys1q/lciT+VNwzBLxosGCe2W1i/S3dp9w+CwISvs2J G65F8UUr1zckoIoS7TvaGbN62i6wmfdz/Pp82jpeVS3lnfZa5H9MPrHS3KblHeeYoe M2r72dbqiZl0A== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , David Howells , Nicolas Schier , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH v4 2/3] kbuild: revive "Entering directory" for Make >= 4.4.1 Date: Tue, 27 Jun 2023 08:30:13 +0900 Message-Id: <20230626233014.66549-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230626233014.66549-1-masahiroy@kernel.org> References: <20230626233014.66549-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769811833926979935?= X-GMAIL-MSGID: =?utf-8?q?1769811833926979935?= With commit 9da0763bdd82 ("kbuild: Use relative path when building in a subdir of the source tree"), compiler messages in out-of-tree builds include relative paths, which are relative to the build directory, not the directory where make was started. To help IDEs/editors find the source files, Kbuild lets GNU Make print "Entering directory ..." when it changes the working directory. It has been working fine for a long time, but David reported it is broken with the latest GNU Make. The behavior was changed by GNU Make commit 8f9e7722ff0f ("[SV 63537] Fix setting -w in makefiles"). Previously, setting --no-print-directory to MAKEFLAGS only affected child makes, but it is now interpreted in the current make as soon as it is set. [test code] $ cat /tmp/Makefile ifneq ($(SUBMAKE),1) MAKEFLAGS += --no-print-directory all: ; $(MAKE) SUBMAKE=1 else all: ; : endif [before 8f9e7722ff0f] $ make -C /tmp make: Entering directory '/tmp' make SUBMAKE=1 : make: Leaving directory '/tmp' [after 8f9e7722ff0f] $ make -C /tmp make SUBMAKE=1 : Previously, the effect of --no-print-directory was delayed until Kbuild started the directory descending, but it is no longer true with GNU Make 4.4.1. This commit adds one more recursion to cater to GNU Make >= 4.4.1. When Kbuild needs to change the working directory, __submake will be executed twice. __submake without --no-print-directory --> show "Entering directory ..." __submake with --no-print-directory --> parse the rest of Makefile We end up with one more recursion than needed for GNU Make < 4.4.1, but I do not want to complicate the version check. Reported-by: David Howells Closes: https://lore.kernel.org/all/2427604.1686237298@warthog.procyon.org.uk/ Signed-off-by: Masahiro Yamada Tested-by: Nicolas Schier --- (no changes since v3) Changes in v3: - Fix build breakage of 'make rpm-pkg'. Changes in v2: - Fix the code. V1 did not work. - Remove the version check to simplify the code Makefile | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 70b314059d8b..7edb00603b7e 100644 --- a/Makefile +++ b/Makefile @@ -191,13 +191,6 @@ $(if $(abs_objtree),, \ abs_objtree := $(realpath $(abs_objtree)) endif # ifneq ($(KBUILD_OUTPUT),) -ifeq ($(abs_objtree),$(CURDIR)) -# Suppress "Entering directory ..." unless we are changing the work directory. -MAKEFLAGS += --no-print-directory -else -need-sub-make := 1 -endif - ifneq ($(words $(subst :, ,$(abs_srctree))), 1) $(error source directory cannot contain spaces or colons) endif @@ -212,6 +205,23 @@ endif export sub_make_done := 1 +endif # sub_make_done + +ifeq ($(abs_objtree),$(CURDIR)) +# Suppress "Entering directory ..." if we are at the final work directory. +no-print-directory := --no-print-directory +else +# Recursion to show "Entering directory ..." +need-sub-make := 1 +endif + +ifeq ($(filter --no-print-directory, $(MAKEFLAGS)),) +# If --no-print-directory is unset, recurse once again to set it. +# You may end up recursing into __sub-make twice. This is needed due to the +# behavior change in GNU Make 4.4.1. +need-sub-make := 1 +endif + ifeq ($(need-sub-make),1) PHONY += $(MAKECMDGOALS) __sub-make @@ -221,18 +231,12 @@ $(filter-out $(this-makefile), $(MAKECMDGOALS)) __all: __sub-make # Invoke a second make in the output directory, passing relevant variables __sub-make: - $(Q)$(MAKE) -C $(abs_objtree) -f $(abs_srctree)/Makefile $(MAKECMDGOALS) + $(Q)$(MAKE) $(no-print-directory) -C $(abs_objtree) \ + -f $(abs_srctree)/Makefile $(MAKECMDGOALS) -endif # need-sub-make -endif # sub_make_done +else # need-sub-make # We process the rest of the Makefile if this is the final invocation of make -ifeq ($(need-sub-make),) - -# Do not print "Entering directory ...", -# but we want to display it when entering to the output directory -# so that IDEs/editors are able to understand relative filenames. -MAKEFLAGS += --no-print-directory ifeq ($(abs_srctree),$(abs_objtree)) # building in the source tree From patchwork Mon Jun 26 23:30:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 113158 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp7834302vqr; Mon, 26 Jun 2023 17:01:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7Fa0wbPFZrPAIYyyGyLXWoOvb3349k9q4sKAx8aZDTPMXT1QDs2ZnYJFSGOjINzRI6/1ed X-Received: by 2002:a17:90a:b89:b0:260:ba1e:9590 with SMTP id 9-20020a17090a0b8900b00260ba1e9590mr28713800pjr.3.1687824091290; Mon, 26 Jun 2023 17:01:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687824091; cv=none; d=google.com; s=arc-20160816; b=JdZMCaX5tLMM/X+8CqXNA56lKqmAXTjQ2DpA5cTMOGfWEDIi6tEK2mzSdTFq52XQRD JcLpChn/RPZKYthOe64OmS5fhUplAUEbvtVLg/w1q+WUEOx0thjGb1YONSHFo0kJdV2g qWRL2LYMbMi4MWog+jT+TRanl46IDtS18bytLmrTl0eyCFPNRe2aNgPbxrf5i+8Z9ILb b8B+K4C6P32xT0CcrLK9uyHMO6UeGzuCxpFI+OxTLsaa0+gsGbZBzlcKsDvYW78AF55V zqgvzZjomZ8RlHqRrw+NCE1GrJXAPuDwKr/a9w4u4Bx+7MbBUwTCzvvGKtxXigUBgy8L nRTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=hkliroXwefU/7JoIT8aGm3m2NDEwvzNhyVm6sJNPjG8=; fh=qgIzYgvECUXJghh1iOX7rAv7x0Rmr05bDpeEqkKR2TA=; b=Y3fXZlONFqxIVm61mdNZULC9AOgII1amiem0gRZ0P7W0G0bJ0onAQ/oAGsDWfVt8Ks ydAFlSa4nsjRHdLJIX5pGPLhyuYRC/79UZ4Zdb/ZEO3rVwV17uRny8M4iq7cMBa7DCJS 0HHE++wRha3j4SILJcgYgdG/jy2i0+T2ytDvEJ8yEr3PXh83UG/x2qlGkvm99wU908+p bClfzGFEf1AFn6hJCLE1h4oqBygwWnMif4efF2azgeF/LgqPe+lvNBAP1X4Svm6fymck EkBkR3wUpxzG5SxK4VZp1OQts5qijQYqn3eaGekK2bBuW2G8UDPZziKmsj+1C47q2dx7 ytXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fI2hZvts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mh9-20020a17090b4ac900b00250d10c6fe7si9431693pjb.67.2023.06.26.17.01.18; Mon, 26 Jun 2023 17:01:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fI2hZvts; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229578AbjFZXad (ORCPT + 99 others); Mon, 26 Jun 2023 19:30:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229841AbjFZXa1 (ORCPT ); Mon, 26 Jun 2023 19:30:27 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CDC3C19A2; Mon, 26 Jun 2023 16:30:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5AB0760FA2; Mon, 26 Jun 2023 23:30:24 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 88FEDC433CC; Mon, 26 Jun 2023 23:30:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687822223; bh=AkTW18VRFm3aTIK6VmGPviMroWucajIDz7AXevpDt4g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fI2hZvtsgQcib8dtlCMxbdZzfe6K44XYN+DUS+FsUW64uLhr/otCBQXo7Y15Ofz2d UnEiosmv4Ws7w1c5jPTtoz8/7wlF3jPZfb4S1tUgrw+sm8dCLKmLE/czZbrPR/JuKY 7xike14a+dtWTgrCDTSZyrbnAuJFZG78IaZRZdbn8Udi4rOjYQij2ROC7JSNGy/xdw ccPdhzZH2KB23DGWnYjY2N8kkMcCz/2ZsaD/DsD8Xc7ZlvCvehxYjoE5AAeT9yZCXU LijpBR437U82jckTyleFkWTVn4ZwKpIH/aMBlh10PiaNrq0ZSwRm3DCSeN3m6VM45P 8ytF5BjzEV8/Q== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Masahiro Yamada , Nicolas Schier , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Subject: [PATCH v4 3/3] kbuild: respect GNU Make -w flag Date: Tue, 27 Jun 2023 08:30:14 +0900 Message-Id: <20230626233014.66549-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230626233014.66549-1-masahiroy@kernel.org> References: <20230626233014.66549-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1769811834353797459?= X-GMAIL-MSGID: =?utf-8?q?1769811834353797459?= Currently, -w (--print-directory) option is ignored, but it is better to respect the user's choice. This commit changes the behavior of "Entering directory ..." logging. If -w (or --print-directory) is given via the command line or the MAKEFLAGS environment variable, print "Entering directory ..." for every sub make. If --no-print-directory is given via the command line or the MAKEFLAGS environment variable, suppress "Entering directory ..." completely. If none of them is given, print "Entering directory ..." when Kbuild changes the working directory at the start of building. (default) Signed-off-by: Masahiro Yamada Tested-by: Nicolas Schier --- (no changes since v2) Changes in v2: - new patch Makefile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 7edb00603b7e..c9864f83a3d2 100644 --- a/Makefile +++ b/Makefile @@ -38,6 +38,12 @@ __all: # descending is started. They are now explicitly listed as the # prepare rule. +ifeq ($(filter 3.%,$(MAKE_VERSION)),) +short-opts := $(firstword -$(MAKEFLAGS)) +else +short-opts := $(filter-out --%,$(MAKEFLAGS)) +endif + this-makefile := $(lastword $(MAKEFILE_LIST)) export abs_srctree := $(realpath $(dir $(this-makefile))) export abs_objtree := $(CURDIR) @@ -95,12 +101,6 @@ endif # commands # make-4.0 (and later) keep single letter options in the 1st word of MAKEFLAGS. -ifeq ($(filter 3.%,$(MAKE_VERSION)),) -short-opts := $(firstword -$(MAKEFLAGS)) -else -short-opts := $(filter-out --%,$(MAKEFLAGS)) -endif - ifneq ($(findstring s,$(short-opts)),) quiet=silent_ override KBUILD_VERBOSE := @@ -215,12 +215,16 @@ else need-sub-make := 1 endif +ifeq ($(findstring w, $(short-opts)),) ifeq ($(filter --no-print-directory, $(MAKEFLAGS)),) # If --no-print-directory is unset, recurse once again to set it. # You may end up recursing into __sub-make twice. This is needed due to the # behavior change in GNU Make 4.4.1. need-sub-make := 1 endif +else +no-print-directory := +endif ifeq ($(need-sub-make),1)