Skip to content

Commit 30cef68

Browse files
committed
kbuild: reuse this-makefile to define abs_srctree
Move this-makefile up, and reuse it to define abs_srctree. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent f91e46b commit 30cef68

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ else
145145
need-sub-make := 1
146146
endif
147147

148-
abs_srctree := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
148+
this-makefile := $(lastword $(MAKEFILE_LIST))
149+
abs_srctree := $(realpath $(dir $(this-makefile)))
149150

150151
ifneq ($(words $(subst :, ,$(abs_srctree))), 1)
151152
$(error source directory cannot contain spaces or colons)
@@ -160,8 +161,6 @@ MAKEFLAGS += --include-dir=$(abs_srctree)
160161
need-sub-make := 1
161162
endif
162163

163-
this-makefile := $(lastword $(MAKEFILE_LIST))
164-
165164
ifneq ($(filter 3.%,$(MAKE_VERSION)),)
166165
# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x
167166
# We need to invoke sub-make to avoid implicit rules in the top Makefile.

0 commit comments

Comments
 (0)