diff mbox series

[v3,1/3] kbuild: unexport abs_srctree and abs_objtree

Message ID 20230625140630.2134298-1-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series [v3,1/3] kbuild: unexport abs_srctree and abs_objtree | expand

Commit Message

Masahiro Yamada June 25, 2023, 2:06 p.m. UTC
'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(-)

Comments

Masahiro Yamada June 26, 2023, 2:49 a.m. UTC | #1
On Sun, Jun 25, 2023 at 11:06 PM Masahiro Yamada <masahiroy@kernel.org> wrote:
>
> '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>
> ---

Tools Makefiles rely on abs_*.
I will keep them exported. Sigh.
diff mbox series

Patch

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)