summary refs log tree commit diff
path: root/scripts
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-09-18 17:45:54 +0900
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-10-04 22:56:02 +0900
commit80d0dda3a4e5ba00ae6a45fa840096dc9633aad7 (patch)
tree4f2bb427115c65725c267d2917a3dc7ffeffa695 /scripts
parent4fd61277f66278d7ce4a77accb662d00e800cce7 (diff)
downloadlinux-80d0dda3a4e5ba00ae6a45fa840096dc9633aad7.tar.gz
kbuild: simplify command line creation in scripts/mkmakefile
Assuming we never invoke the generated Makefile from outside of
the $(objtree) directory, $(CURDIR) points to the absolute path
of $(objtree).

BTW, 'lastword' is natively supported by GNU Make 3.81+, which
is the current requirement for building the kernel.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/mkmakefile8
1 files changed, 1 insertions, 7 deletions
diff --git a/scripts/mkmakefile b/scripts/mkmakefile
index 85995f90e5c8..412f13fdff52 100755
--- a/scripts/mkmakefile
+++ b/scripts/mkmakefile
@@ -20,9 +20,6 @@ fi
 cat << EOF > Makefile
 # Automatically generated by $0: don't edit
 
-lastword = \$(word \$(words \$(1)),\$(1))
-makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
-
 ifeq ("\$(origin V)", "command line")
 VERBOSE := \$(V)
 endif
@@ -30,15 +27,12 @@ ifneq (\$(VERBOSE),1)
 Q := @
 endif
 
-MAKEARGS := -C $1
-MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
-
 MAKEFLAGS += --no-print-directory
 
 .PHONY: __sub-make \$(MAKECMDGOALS)
 
 __sub-make:
-	\$(Q)\$(MAKE) \$(MAKEARGS) \$(MAKECMDGOALS)
+	\$(Q)\$(MAKE) -C $1 O=\$(CURDIR) \$(MAKECMDGOALS)
 
 \$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make
 	@: