mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-06 05:13:18 +00:00
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>
This commit is contained in:
parent
4fd61277f6
commit
80d0dda3a4
@ -20,9 +20,6 @@ fi
|
|||||||
cat << EOF > Makefile
|
cat << EOF > Makefile
|
||||||
# Automatically generated by $0: don't edit
|
# Automatically generated by $0: don't edit
|
||||||
|
|
||||||
lastword = \$(word \$(words \$(1)),\$(1))
|
|
||||||
makedir := \$(dir \$(call lastword,\$(MAKEFILE_LIST)))
|
|
||||||
|
|
||||||
ifeq ("\$(origin V)", "command line")
|
ifeq ("\$(origin V)", "command line")
|
||||||
VERBOSE := \$(V)
|
VERBOSE := \$(V)
|
||||||
endif
|
endif
|
||||||
@ -30,15 +27,12 @@ ifneq (\$(VERBOSE),1)
|
|||||||
Q := @
|
Q := @
|
||||||
endif
|
endif
|
||||||
|
|
||||||
MAKEARGS := -C $1
|
|
||||||
MAKEARGS += O=\$(if \$(patsubst /%,,\$(makedir)),\$(CURDIR)/)\$(patsubst %/,%,\$(makedir))
|
|
||||||
|
|
||||||
MAKEFLAGS += --no-print-directory
|
MAKEFLAGS += --no-print-directory
|
||||||
|
|
||||||
.PHONY: __sub-make \$(MAKECMDGOALS)
|
.PHONY: __sub-make \$(MAKECMDGOALS)
|
||||||
|
|
||||||
__sub-make:
|
__sub-make:
|
||||||
\$(Q)\$(MAKE) \$(MAKEARGS) \$(MAKECMDGOALS)
|
\$(Q)\$(MAKE) -C $1 O=\$(CURDIR) \$(MAKECMDGOALS)
|
||||||
|
|
||||||
\$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make
|
\$(filter-out __sub-make, \$(MAKECMDGOALS)): __sub-make
|
||||||
@:
|
@:
|
||||||
|
Loading…
Reference in New Issue
Block a user