From patchwork Sun Jun 25 14:06:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 112598 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6941043vqr; Sun, 25 Jun 2023 07:22:00 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5l6oHEDmOcs6fJxa4XHWEhWULupojAY5IlTqJ//C9tjswclDNx1R/V7X9TdfsRFPbII3RG X-Received: by 2002:a17:902:c944:b0:1b0:6038:2982 with SMTP id i4-20020a170902c94400b001b060382982mr4665165pla.41.1687702920663; Sun, 25 Jun 2023 07:22:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687702920; cv=none; d=google.com; s=arc-20160816; b=Yqg6rb/0Jxs86Ne5qIDkZU747tcVyr4IXQp22jMxgAuBErOQULa0qoFhM6L1bqal/s cNG8zdkog0toaiE+rTgfXn+HPhY6Yo4q86P1qycoPhVEXLNr5tqvNPM8virIvLa26szz Bk4MzBWSeD0Joi59QNitN7jUs6YNviEhrwSwMD246E7bAscOnmSCUoVWjbNEd7n3CTYF 2AR9xiqqGkYc03PSudamcckWCEWNSo4S4ApnxjSR0WNWZpddi/U/gNYEZER3UPhcniod EJO0JK6tkp/VKNotaLutAXXL/ZH/aCx3aJYlDF4o21kFAJIpNDwtDk9h5Z2PbnLtA2gz Y4og== 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=I+aqBUyfH/cWc+L4gQDVgAnC5ox0C+7jjxeuZONnLPs=; fh=wKrPioF+0wPaktGqmf0aQvlk8PY4Pc32rTAsBSAiP8I=; b=TXfPOFNRvANMe2f5iRCLw5VrzaCg1AVdiGENzJuyKSXEa7e4d19UwbE1WNy4+TEEWv QfmZMS8mKjARvd+RLLUYzc1/3VAsfwVBtIAwCzic7KgLfCNX3sYICCMk2xPjBrvK0FnB eKlU7tyxGh4P7mUGLtnSYt0JwaqHu/1m49Mt+dOHwE13n2A0Sf3QBGiG+D9ju9mKzhfJ zhj/558FmSbwtdinJj0v9Tx+ofEX35+ueTzz5j5Zky0zzzQvHKGtTfBIhN8CFd12t0Oz JJyB2ytTqoZPYz8hOLBf1T72BUAXKt0JUCqBSjZNb1JGxx1OlwVQSLLPGKQ8VceGVg/X VZ2w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=hR+Wy0YV; 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 jl23-20020a170903135700b001b241f8a865si3041491plb.117.2023.06.25.07.21.48; Sun, 25 Jun 2023 07:22:00 -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=hR+Wy0YV; 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 S229735AbjFYOGn (ORCPT + 99 others); Sun, 25 Jun 2023 10:06:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229447AbjFYOGl (ORCPT ); Sun, 25 Jun 2023 10:06:41 -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 AD11A1B1; Sun, 25 Jun 2023 07:06:40 -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 03F1E602E2; Sun, 25 Jun 2023 14:06:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2F87C433C0; Sun, 25 Jun 2023 14:06:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687701999; bh=S3NHgH5zR4/XnZv9Sf+BiVy8WcLky1GXrScxBb3Sw4o=; h=From:To:Cc:Subject:Date:From; b=hR+Wy0YVxhHo8php6titEefdXjx1gFvxWnuNQ2CDek9qP7xqcXDn37IlecsY2msYL jkXNhtz9OlfCckR2GvVk86VSaIwzBturcRYHT8arRZpD0C/0z6PMmgKtZIEhDjdVQQ LhfU8lnolLSy30nXxUoBTbZP2jB4FjNhQrnrrl45tVEWSW66ZaUULokO9D/5U48oJT 1BwlFtlc9IGSLPBdqLpdRwWB2+x8OpEdm4wDG7Xv1Yy9rq6MnUsfG9NOKJtgTS6b+u QISLl0aNzk+1KyyrMDpOuU6Ei6NUAHSn6mBIDdUa6tcqbQJpOEknnnlw+tN3BP4xXG 6A5BBFwRKwUYQ== 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 v3 1/3] kbuild: unexport abs_srctree and abs_objtree Date: Sun, 25 Jun 2023 23:06:28 +0900 Message-Id: <20230625140630.2134298-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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?1769684777349945368?= X-GMAIL-MSGID: =?utf-8?q?1769684777349945368?= 'make rpm-pkg' 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. Fix it. In hindsight, there was no need to export abs_srctree and abs_objtree. Signed-off-by: Masahiro Yamada --- Changes in v3: - New patch Makefile | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index f18d59c81241..6f9bbb0d9172 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)) +abs_srctree := $(realpath $(dir $(this-makefile))) +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 Sun Jun 25 14:06:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 112595 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6938535vqr; Sun, 25 Jun 2023 07:16:15 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6VdClwkKYxKUI8YE+dt3cCw3pELJmLd938jpmPGEr0hgbogyCFzmx/JGQ+kXyWR11NLYYT X-Received: by 2002:a17:907:803:b0:973:ca9c:3e43 with SMTP id wv3-20020a170907080300b00973ca9c3e43mr23019884ejb.45.1687702575259; Sun, 25 Jun 2023 07:16:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687702575; cv=none; d=google.com; s=arc-20160816; b=OG7TSx3cNa8uK3FhbabSIaFfaWluEtqb2ZEb12sryhWDfTXR+u8hLS5/H8uMOU5gMt thotETUNYcjCA8kcsyReo7t3f5Xh/2cn1XzgU6gXj7YOyGj70QZfCwaAD76EEySXJL/1 Z86suyomldn5v3BT5bXI64oitfkCwUB+rYFu5XByyzy3pr2tGgNwHBLodSHABNMkdMc0 agPWJmC49QYVZFUrIYsAikQpuVxIIGm2Jx8iDzjk3S/Gk+cWkWVkul/o5DaLlyCh2+pj 3n++E4dcTK9CDuXk0hCUNkpIHJj0aEIcoCaPLlW60njZjefU8tl0JOfzfTSwqqE/99yW BKDw== 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=5Jn3xUtm7MVRkfnzIKro5l7XA37rk9fTVoo/0229wSo=; fh=wrVSAms63+L6z8krOjyglG1F29qH3ROX8soVAPpYEZQ=; b=UC6J7LfNP2/b66RxafZoU8VN3MgG3Ar4RP3ISmHHPVfrDGgK8sJkmw7B/Qe6UPNIO2 +yW0SPrARmdjV+VQu/hjIJbDfH+cbJ9DDwDfNdPfyNh9ku/Li53HWSS6pjAQxpmdQwPM vPiB+2v/hptoEmdY5Jy0vOdf6/Rt2yYBgbeZLwgilPeKWCfpO9/Fnzw5o+R4PrBCBvHN ECXkXIpKbA98d9CQyu7/3LnM7gLJk/AJPw6gzZioEXp6lxfK+NrtQIne+hapxYjkFD52 sm53XOF9Ttzj/50nmEIhLR3TCXVogJ3bdEmUiGRMD/R9ndlN0FBvjnNFHlOSaiThAj8e mgoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GwUmkGw+; 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 j24-20020aa7c0d8000000b005187c1e1b9fsi1514922edp.349.2023.06.25.07.15.50; Sun, 25 Jun 2023 07:16:15 -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=GwUmkGw+; 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 S229831AbjFYOGp (ORCPT + 99 others); Sun, 25 Jun 2023 10:06:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229777AbjFYOGn (ORCPT ); Sun, 25 Jun 2023 10:06:43 -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 926731B1; Sun, 25 Jun 2023 07:06:42 -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 2941660A27; Sun, 25 Jun 2023 14:06:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1316C433CB; Sun, 25 Jun 2023 14:06:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687702001; bh=dvDrQ39eJfUmS1xCtZGwDsgxhBGFWLRiRVbAAdfWTdg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GwUmkGw+0aF6chF4Gmy+8AeX27Kr2v8Zaqr1xwUTNzD0x/4jETPVJ8WA+YHYlevTc 4zQJy/x3NvnTVr5HQWl04sOU2AlvXw5l7oVqcihvXGDAUNgrMpHwWX9mNG3oGbeRcO skkpyeYAhT5zPQthghkWftQ9qvlZxPHJw/dCIr0HanHhqxVxL+JwdKuz0THOKGTath cy7MIU0h7K65twvaEnHryArMZOflQwbjXEEhVQl5BBseBwWOKbZUEHLD6EN0p2heAR v+LnsYzx4BHeJUlWcXvR/bud/365Wr1acswMHy7gjoirBREc63QSF7afTj8Xc4vf6O jU0j/iH11jouQ== 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 v3 2/3] kbuild: revive "Entering directory" for Make >= 4.4.1 Date: Sun, 25 Jun 2023 23:06:29 +0900 Message-Id: <20230625140630.2134298-2-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230625140630.2134298-1-masahiroy@kernel.org> References: <20230625140630.2134298-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, 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?1769684415420863560?= X-GMAIL-MSGID: =?utf-8?q?1769684415420863560?= 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 --- 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 6f9bbb0d9172..0663c99e050b 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 Sun Jun 25 14:06:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 112596 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp6939360vqr; Sun, 25 Jun 2023 07:18:02 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7NO3UJQy3T1WHQ22Y3kL20DyKguQdd2ZitT+HkVX71D6LJ0Kt1o2Vppv8NZXWP0zQJp8eS X-Received: by 2002:a17:90a:190:b0:262:dbdc:fc28 with SMTP id 16-20020a17090a019000b00262dbdcfc28mr963073pjc.26.1687702682105; Sun, 25 Jun 2023 07:18:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687702682; cv=none; d=google.com; s=arc-20160816; b=zN20t9ZJDZlQ4YA4AasPE4Jg1W8QdMfcnlFvhU8/Iz9iP1xa+yckIMal+CqRAhFP1F HVk0m1AdfsNZUpqKqPR7FtFy4UqVou+2mPC7ZTObWzKe9NeeQShzl9f9rS0lAviWsHSD IA6GxnjuFGw+c1nT2nh7I1bgJBwwafdJmQCloRIr5cpuZ6RdFgY4+aNOpVGsHVisdPbQ NUPOSBo3hO23EBmvnYZDUnn80kyg04j1WFsACtXvQzGBqgeDf324w42Vmtt8Q1biuN9/ nwXJkX+7bNxu5MlSSJly4LkBFE+h/hZwO11BziLRHuy9s1L78mKHF6iLlLLJAN03zGQW YZSQ== 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=wBW98X5CqqZ2GSB2W+1fjczK0sdtV9DsVyCDZjCXZNE=; fh=qgIzYgvECUXJghh1iOX7rAv7x0Rmr05bDpeEqkKR2TA=; b=qZ8cU8zP673ywR/tOJVeIReHh/+1xP1UdYYV8xF2nuDygTD5pBdZivD8l7473fEd3m OyqW6yXnrgdtsiJL3ITb/lkwiTSpHJDUF/RpyiLD6yyj1/m6PmnaoGkyI6rmKYa9eRTz eDthl61uI4ijhimh1l+uHYsvHvao+fOymLQBtVgHm1KsT6x3oHzaWUBHZkcnmSPdpxrN Bt2JBgsOqi8fkjC6TPmX1t3lTB4nk+bKrLwtOVoSCcidwWgVWEFWxmJrh5xz/CU0u74e rB8/OvQUj5z6ny83lEPQE6w5muwh6GVL6+phIdtp/yFr4EXjG/WsIasC8/qUcGwJbMKR XI5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=B6IXNYoE; 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 oo6-20020a17090b1c8600b00259b2f52633si3731686pjb.166.2023.06.25.07.17.49; Sun, 25 Jun 2023 07:18:02 -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=B6IXNYoE; 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 S229886AbjFYOGx (ORCPT + 99 others); Sun, 25 Jun 2023 10:06:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229824AbjFYOGp (ORCPT ); Sun, 25 Jun 2023 10:06:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96E541B1; Sun, 25 Jun 2023 07:06:44 -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 2695A60B61; Sun, 25 Jun 2023 14:06:44 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0AB47C433CC; Sun, 25 Jun 2023 14:06:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1687702003; bh=LAnePInFTnRhKb87x/CaVMcrQiTLwmFbhtHKuP+EhFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B6IXNYoElnIJB+nxpDA/twO8hNvg7k6sT0wmM1EO+vASYCLDnEGfc5VDhGZcH28Wr Ia4/J4+cLvC/Y2FfAbf+p5MCCAFPcH7j4/Xcdzc/JkZBWogGRIncrI9tNnauIPF3DV wwD4nhfGieTlPAZV+QDPHfTo7G7ijrNh3gobtW+7gHMCe7nnf0iKYdP20KJeo21NqW +IYvquwwjLc+qdx8+srH8ABNyy7vjP5T5tirzC+wtTNWhuD+wDmcu5Z4km/CupeqD3 cE1SQEKns/NrPY/Cn2GuQ0SbIzID4l+bC/y8n6+cNy8hR/kPy3589r/YsWuYM4M2VN J4xY2gZ60Lo+g== 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 v3 3/3] kbuild: respect GNU Make -w flag Date: Sun, 25 Jun 2023 23:06:30 +0900 Message-Id: <20230625140630.2134298-3-masahiroy@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230625140630.2134298-1-masahiroy@kernel.org> References: <20230625140630.2134298-1-masahiroy@kernel.org> MIME-Version: 1.0 X-Spam-Status: No, score=-4.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1769684527166572072?= X-GMAIL-MSGID: =?utf-8?q?1769684527166572072?= 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 --- Changes in v3: - new patch Makefile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 0663c99e050b..aab8e149feec 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)) abs_srctree := $(realpath $(dir $(this-makefile))) 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)