Skip to content

Commit e2bad14

Browse files
committed
kbuild: unexport abs_srctree and abs_objtree
Commit 25b146c ("kbuild: allow Kbuild to start from any directory") exported abs_srctree and abs_objtree to avoid recomputation after the sub-make. However, this approach turned out to be fragile. Commit 5fa94ce ("kbuild: set correct abs_srctree and abs_objtree for package builds") moved them above "ifneq ($(sub_make_done),1)", eliminating the need for exporting them. These are only needed in the top Makefile. If an absolute path is required in sub-directories, you can use $(abspath ) or $(realpath ) as needed. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>
1 parent 75b5ab1 commit e2bad14

4 files changed

Lines changed: 6 additions & 6 deletions

File tree

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ __all:
3939
# prepare rule.
4040

4141
this-makefile := $(lastword $(MAKEFILE_LIST))
42-
export abs_srctree := $(realpath $(dir $(this-makefile)))
43-
export abs_objtree := $(CURDIR)
42+
abs_srctree := $(realpath $(dir $(this-makefile)))
43+
abs_objtree := $(CURDIR)
4444

4545
ifneq ($(sub_make_done),1)
4646

rust/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ rustdoc: rustdoc-core rustdoc-macros rustdoc-compiler_builtins \
100100
-e 's:rust-logo-[0-9a-f]+\.svg:logo.svg:g' \
101101
-e 's:favicon-[0-9a-f]+\.svg:logo.svg:g' \
102102
-e 's:<link rel="alternate icon" type="image/png" href="[/.]+/static\.files/favicon-(16x16|32x32)-[0-9a-f]+\.png">::g' \
103-
-e 's:<a href="srctree/([^"]+)">:<a href="$(abs_srctree)/\1">:g'
103+
-e 's:<a href="srctree/([^"]+)">:<a href="$(realpath $(srctree))/\1">:g'
104104
$(Q)for f in $(rustdoc_output)/static.files/rustdoc-*.css; do \
105105
echo ".logo-container > img { object-fit: contain; }" >> $$f; done
106106

@@ -413,7 +413,7 @@ quiet_cmd_rustc_library = $(if $(skip_clippy),RUSTC,$(RUSTC_OR_CLIPPY_QUIET)) L
413413
rust-analyzer:
414414
$(Q)$(srctree)/scripts/generate_rust_analyzer.py \
415415
--cfgs='core=$(core-cfgs)' --cfgs='alloc=$(alloc-cfgs)' \
416-
$(abs_srctree) $(abs_objtree) \
416+
$(realpath $(srctree)) $(realpath $(objtree)) \
417417
$(RUST_LIB_SRC) $(KBUILD_EXTMOD) > \
418418
$(if $(KBUILD_EXTMOD),$(extmod_prefix),$(objtree))/rust-project.json
419419

scripts/Makefile.package

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ snap-pkg:
135135
mkdir $(objtree)/snap
136136
$(MAKE) clean
137137
sed "s@KERNELRELEASE@$(KERNELRELEASE)@; \
138-
s@SRCTREE@$(abs_srctree)@" \
138+
s@SRCTREE@$(realpath $(srctree))@" \
139139
$(srctree)/scripts/package/snapcraft.template > \
140140
$(objtree)/snap/snapcraft.yaml
141141
cd $(objtree)/snap && \

tools/lib/bpf/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Most of this file is copied from tools/lib/traceevent/Makefile
33

44
RM ?= rm
5-
srctree = $(abs_srctree)
5+
srctree := $(realpath $(srctree))
66

77
VERSION_SCRIPT := libbpf.map
88
LIBBPF_VERSION := $(shell \

0 commit comments

Comments
 (0)