kbuild: set correct abs_srctree and abs_objtree for package builds
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 <masahiroy@kernel.org>
This commit is contained in:
parent
71025b8565
commit
5fa94ceb79
1 changed files with 4 additions and 6 deletions
10
Makefile
10
Makefile
|
@ -38,6 +38,10 @@ __all:
|
||||||
# descending is started. They are now explicitly listed as the
|
# descending is started. They are now explicitly listed as the
|
||||||
# prepare rule.
|
# prepare rule.
|
||||||
|
|
||||||
|
this-makefile := $(lastword $(MAKEFILE_LIST))
|
||||||
|
export abs_srctree := $(realpath $(dir $(this-makefile)))
|
||||||
|
export abs_objtree := $(CURDIR)
|
||||||
|
|
||||||
ifneq ($(sub_make_done),1)
|
ifneq ($(sub_make_done),1)
|
||||||
|
|
||||||
# Do not use make's built-in rules and variables
|
# Do not use make's built-in rules and variables
|
||||||
|
@ -185,8 +189,6 @@ $(if $(abs_objtree),, \
|
||||||
|
|
||||||
# $(realpath ...) resolves symlinks
|
# $(realpath ...) resolves symlinks
|
||||||
abs_objtree := $(realpath $(abs_objtree))
|
abs_objtree := $(realpath $(abs_objtree))
|
||||||
else
|
|
||||||
abs_objtree := $(CURDIR)
|
|
||||||
endif # ifneq ($(KBUILD_OUTPUT),)
|
endif # ifneq ($(KBUILD_OUTPUT),)
|
||||||
|
|
||||||
ifeq ($(abs_objtree),$(CURDIR))
|
ifeq ($(abs_objtree),$(CURDIR))
|
||||||
|
@ -196,9 +198,6 @@ else
|
||||||
need-sub-make := 1
|
need-sub-make := 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
this-makefile := $(lastword $(MAKEFILE_LIST))
|
|
||||||
abs_srctree := $(realpath $(dir $(this-makefile)))
|
|
||||||
|
|
||||||
ifneq ($(words $(subst :, ,$(abs_srctree))), 1)
|
ifneq ($(words $(subst :, ,$(abs_srctree))), 1)
|
||||||
$(error source directory cannot contain spaces or colons)
|
$(error source directory cannot contain spaces or colons)
|
||||||
endif
|
endif
|
||||||
|
@ -211,7 +210,6 @@ need-sub-make := 1
|
||||||
$(this-makefile): ;
|
$(this-makefile): ;
|
||||||
endif
|
endif
|
||||||
|
|
||||||
export abs_srctree abs_objtree
|
|
||||||
export sub_make_done := 1
|
export sub_make_done := 1
|
||||||
|
|
||||||
ifeq ($(need-sub-make),1)
|
ifeq ($(need-sub-make),1)
|
||||||
|
|
Loading…
Add table
Reference in a new issue