linux-stable/Documentation/kbuild
Masahiro Yamada d0e628cd81 kbuild: doc: clarify the difference between extra-y and always-y
The difference between extra-y and always-y is obscure.

Basically, Kbuild builds targets listed in extra-y and always-y in
visited Makefiles without relying on any dependency.

The difference is that extra-y is used to list the targets needed for
vmlinux whereas always-y is used to list the targets that must be always
built irrespective of final targets.

Kbuild skips extra-y when it is building only modules (i.e.
'make modules'). This is the long-standing behavior since extra-y was
introduced in 2003, and it is explained in that commit log [1].

For clarification, this is the extra-y vs always-y table:

                  extra-y    always-y
  'make'             y          y
  'make vmlinux'     y          y
  'make modules'     n          y

Kbuild skips extra-y also when building external modules since obviously
it never builds vmlinux.

Unfortunately, extra-y is wrongly used in many places of upstream code,
and even in external modules.

Using extra-y in external module Makefiles is wrong. What you should
use is probably always-y or 'targets'.

The current documentation for extra-y is misleading. I rewrote it, and
moved it to the section 3.7.

always-y is not documented anywhere. I added.

[1]: https://git.kernel.org/pub/scm/linux/kernel/git/history/history.git/commit/?id=f94e5fd7e5d09a56a60670a9bb211a791654bba8

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Randy Dunlap <rdunlap@infradead.org>
2020-12-21 13:57:07 +09:00
..
gcc-plugins.rst docs: move gcc-plugins to the kbuild manual 2020-03-10 11:20:46 -06:00
headers_install.rst Kbuild updates for v5.3 2019-07-12 16:03:16 -07:00
index.rst Kbuild updates for v5.7 2020-03-31 16:03:39 -07:00
issues.rst docs: kbuild: fix build with pdf and fix some minor issues 2019-07-15 11:03:04 -03:00
kbuild.rst kbuild: support LLVM=1 to switch the default tools to Clang/LLVM 2020-04-09 03:18:21 +09:00
kconfig-language.rst Kbuild updates for v5.9 2020-08-09 14:10:26 -07:00
kconfig-macro-language.rst kbuild: doc: fix references to other documents 2020-03-13 10:02:27 +09:00
Kconfig.recursion-issue-01 kbuild: document recursive dependency limitation / resolution 2015-10-08 15:36:16 +02:00
Kconfig.recursion-issue-02 kbuild: Replace HTTP links with HTTPS ones 2020-08-10 01:32:59 +09:00
kconfig.rst kbuild: create modules.builtin without Makefile.modbuiltin or tristate.conf 2020-01-07 02:18:39 +09:00
Kconfig.select-break kbuild: document recursive dependency limitation / resolution 2015-10-08 15:36:16 +02:00
llvm.rst kbuild: remove unused OBJSIZE 2020-11-02 11:31:00 +09:00
makefiles.rst kbuild: doc: clarify the difference between extra-y and always-y 2020-12-21 13:57:07 +09:00
modules.rst kbuild: doc: replace arch/$(ARCH)/ with arch/$(SRCARCH)/ 2020-12-21 13:56:58 +09:00
reproducible-builds.rst gcc-plugins: fix gcc-plugins directory path in documentation 2020-06-28 12:16:55 +09:00