aboutsummaryrefslogtreecommitdiffstats
path: root/scripts/mkmakefile
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2018-09-18 04:45:54 -0400
committerMasahiro Yamada <yamada.masahiro@socionext.com>2018-10-04 09:56:02 -0400
commit80d0dda3a4e5ba00ae6a45fa840096dc9633aad7 (patch)
tree4f2bb427115c65725c267d2917a3dc7ffeffa695 /scripts/mkmakefile
parent4fd61277f66278d7ce4a77accb662d00e800cce7 (diff)
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/mkmakefile')
-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
20cat << EOF > Makefile 20cat << EOF > Makefile
21# Automatically generated by $0: don't edit 21# Automatically generated by $0: don't edit
22 22
23lastword = \$(word \$(words \$(1)),\$(1))
24makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
25
26ifeq ("\$(origin V)", "command line") 23ifeq ("\$(origin V)", "command line")
27VERBOSE := \$(V) 24VERBOSE := \$(V)
28endif 25endif
@@ -30,15 +27,12 @@ ifneq (\$(VERBOSE),1)
30Q := @ 27Q := @
31endif 28endif
32 29
33MAKEARGS := -C $1
34MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
35
36MAKEFLAGS += --no-print-directory 30MAKEFLAGS += --no-print-directory
37 31
38.PHONY: __sub-make \$(MAKECMDGOALS) 32.PHONY: __sub-make \$(MAKECMDGOALS)
39 33
40__sub-make: 34__sub-make:
41 \$(Q)\$(MAKE) \$(MAKEARGS) \$(MAKECMDGOALS) 35 \$(Q)\$(MAKE) -C $1 O=\$(CURDIR) \$(MAKECMDGOALS)
42 36
43\$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make 37\$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make
44 @: 38 @: