diff options
| author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-09-18 04:45:54 -0400 |
|---|---|---|
| committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-10-04 09:56:02 -0400 |
| commit | 80d0dda3a4e5ba00ae6a45fa840096dc9633aad7 (patch) | |
| tree | 4f2bb427115c65725c267d2917a3dc7ffeffa695 /scripts/mkmakefile | |
| parent | 4fd61277f66278d7ce4a77accb662d00e800cce7 (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-x | scripts/mkmakefile | 8 |
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 | |||
| 20 | cat << EOF > Makefile | 20 | cat << EOF > Makefile |
| 21 | # Automatically generated by $0: don't edit | 21 | # Automatically generated by $0: don't edit |
| 22 | 22 | ||
| 23 | lastword = \$(word \$(words \$(1)),\$(1)) | ||
| 24 | makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST))) | ||
| 25 | |||
| 26 | ifeq ("\$(origin V)", "command line") | 23 | ifeq ("\$(origin V)", "command line") |
| 27 | VERBOSE := \$(V) | 24 | VERBOSE := \$(V) |
| 28 | endif | 25 | endif |
| @@ -30,15 +27,12 @@ ifneq (\$(VERBOSE),1) | |||
| 30 | Q := @ | 27 | Q := @ |
| 31 | endif | 28 | endif |
| 32 | 29 | ||
| 33 | MAKEARGS := -C $1 | ||
| 34 | MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir)) | ||
| 35 | |||
| 36 | MAKEFLAGS += --no-print-directory | 30 | MAKEFLAGS += --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 | @: |
