Skip to content

Commit

Permalink
kbuild: reuse this-makefile to define abs_srctree
Browse files Browse the repository at this point in the history
Move this-makefile up, and reuse it to define abs_srctree.

Signed-off-by: Masahiro Yamada <[email protected]>
  • Loading branch information
masahir0y committed Feb 24, 2021
1 parent f91e46b commit 30cef68
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ else
need-sub-make := 1
endif

abs_srctree := $(realpath $(dir $(lastword $(MAKEFILE_LIST))))
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)
Expand All @@ -160,8 +161,6 @@ MAKEFLAGS += --include-dir=$(abs_srctree)
need-sub-make := 1
endif

this-makefile := $(lastword $(MAKEFILE_LIST))

ifneq ($(filter 3.%,$(MAKE_VERSION)),)
# 'MAKEFLAGS += -rR' does not immediately become effective for GNU Make 3.x
# We need to invoke sub-make to avoid implicit rules in the top Makefile.
Expand Down

0 comments on commit 30cef68

Please sign in to comment.