• Masahiro Yamada's avatar
    kbuild: doc: clarify the difference between extra-y and always-y · d0e628cd
    Masahiro Yamada authored
    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=f94e5fd7e5d09a56a60670a9bb211a791654bba8Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
    Reviewed-by: default avatarRandy Dunlap <rdunlap@infradead.org>
    d0e628cd
makefiles.rst 52 KB