BUILD: Makefile: extend the capabilities of EXTRA_MAKE
Allow external Makefile.mk loaded through EXTRA_MAKE to extend the main
build without adding addon-specific logic to the root Makefile.
Provide the following extension points:
- EXTRA_USE_OPTS registers additional USE_* switches. Check unknown
options after loading the fragments so ERR=1 accepts these switches.
- EXTRA_CFLAGS and EXTRA_LDFLAGS append compiler and linker flags.
- EXTRA_INCLUDES adds headers to the build dependencies so changes to
addon headers trigger recompilation.
- EXTRA_LATE_HOOK evaluates addon logic after the object lists and
compiler options have been collected, for example to generate
metadata from the final build options.
- EXTRA_INSTALL and EXTRA_UNINSTALL add targets to the install and
uninstall prerequisites.
Reuse the existing EXTRA_OBJS variable for objects supplied by addons.
Keep all as the default goal so rules in an external fragment do not
change what a plain make invocation builds.