diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2020-05-11 05:50:13 +0200 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2020-05-25 17:03:16 +0200 |
commit | 121c2a137767df5f9f301795e7d3757d1af04b21 (patch) | |
tree | a50e6a717fe79f686369c0fe861007ee1693efda /Makefile | |
parent | kbuild: add this-makefile as a shorthand for $(lastword $(MAKEFILE_LIST)) (diff) | |
download | linux-121c2a137767df5f9f301795e7d3757d1af04b21.tar.xz linux-121c2a137767df5f9f301795e7d3757d1af04b21.zip |
kbuild: error out if targets prefixed with '__' are directly run
Some targets are internal-use only.
It is tedious to care about "what if __build_one_by_one is contained
in $(MAKECMDGOALS)?" etc.
Prefix internal targets with double underscores. Stop parsing Makefile
if they are directly run.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -11,9 +11,12 @@ NAME = Kleptomaniac Octopus # Comments in this file are targeted only to the developer, do not # expect to learn how to build the kernel reading this file. +$(if $(filter __%, $(MAKECMDGOALS)), \ + $(error targets prefixed with '__' are only for internal use)) + # That's our default target when none is given on the command line -PHONY := _all -_all: +PHONY := __all +__all: # We are using a recursive build, so we need to do a little thinking # to get the ordering right. @@ -172,13 +175,13 @@ export sub_make_done := 1 ifeq ($(need-sub-make),1) -PHONY += $(MAKECMDGOALS) sub-make +PHONY += $(MAKECMDGOALS) __sub-make -$(filter-out _all sub-make $(this-makefile), $(MAKECMDGOALS)) _all: sub-make +$(filter-out $(this-makefile), $(MAKECMDGOALS)) __all: __sub-make @: # Invoke a second make in the output directory, passing relevant variables -sub-make: +__sub-make: $(Q)$(MAKE) -C $(abs_objtree) -f $(abs_srctree)/Makefile $(MAKECMDGOALS) endif # need-sub-make @@ -323,7 +326,7 @@ ifdef mixed-build PHONY += $(MAKECMDGOALS) __build_one_by_one -$(filter-out __build_one_by_one, $(MAKECMDGOALS)): __build_one_by_one +$(MAKECMDGOALS): __build_one_by_one @: __build_one_by_one: @@ -598,12 +601,12 @@ else #!config-build # targets and others. In general all targets except *config targets. # If building an external module we do not care about the all: rule -# but instead _all depend on modules +# but instead __all depend on modules PHONY += all ifeq ($(KBUILD_EXTMOD),) -_all: all +__all: all else -_all: modules +__all: modules endif # Decide whether to build built-in, modular, or both. @@ -625,7 +628,7 @@ endif # in addition to whatever we do anyway. # Just "make" or "make all" shall build modules as well -ifneq ($(filter all _all modules nsdeps,$(MAKECMDGOALS)),) +ifneq ($(filter all modules nsdeps,$(MAKECMDGOALS)),) KBUILD_MODULES := 1 endif |