From: Masahiro Yamada <masahiroy@kernel.org>
To: linux-kbuild@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
Masahiro Yamada <masahiroy@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Nick Desaulniers <ndesaulniers@google.com>,
Nicolas Schier <nicolas@fjasle.eu>
Subject: [PATCH v3 1/3] kbuild: unexport abs_srctree and abs_objtree
Date: Sun, 25 Jun 2023 23:06:28 +0900 [thread overview]
Message-ID: <20230625140630.2134298-1-masahiroy@kernel.org> (raw)
'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 <masahiroy@kernel.org>
---
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)
--
2.39.2
next reply other threads:[~2023-06-25 14:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-25 14:06 Masahiro Yamada [this message]
2023-06-25 14:06 ` [PATCH v3 2/3] kbuild: revive "Entering directory" for Make >= 4.4.1 Masahiro Yamada
2023-06-25 14:06 ` [PATCH v3 3/3] kbuild: respect GNU Make -w flag Masahiro Yamada
2023-06-26 2:49 ` [PATCH v3 1/3] kbuild: unexport abs_srctree and abs_objtree Masahiro Yamada
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230625140630.2134298-1-masahiroy@kernel.org \
--to=masahiroy@kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=nicolas@fjasle.eu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox