Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

kbuild: make wrapper Makefile more convenient for external modules

When Kbuild starts building in a separate output directory, it generates
a wrapper Makefile, allowing you to invoke 'make' from the output
directory.

This commit makes it more convenient, so you can invoke 'make' without
M= or MO=.

First, you need to build external modules in a separate directory:

$ make M=/path/to/module/source/dir MO=/path/to/module/build/dir

Once the wrapper Makefile is generated in /path/to/module/build/dir,
you can proceed as follows:

$ cd /path/to/module/build/dir
$ make

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nicolas Schier <nicolas@fjasle.eu>

+11 -1
+11 -1
Makefile
··· 642 642 # At the same time when output Makefile generated, generate .gitignore to 643 643 # ignore whole output directory 644 644 645 + ifdef KBUILD_EXTMOD 646 + print_env_for_makefile = \ 647 + echo "export KBUILD_OUTPUT = $(objtree)"; \ 648 + echo "export KBUILD_EXTMOD = $(realpath $(srcroot))" ; \ 649 + echo "export KBUILD_EXTMOD_OUTPUT = $(CURDIR)" 650 + else 651 + print_env_for_makefile = \ 652 + echo "export KBUILD_OUTPUT = $(CURDIR)" 653 + endif 654 + 645 655 quiet_cmd_makefile = GEN Makefile 646 656 cmd_makefile = { \ 647 657 echo "\# Automatically generated by $(abs_srctree)/Makefile: don't edit"; \ 648 - echo "export KBUILD_OUTPUT = $(CURDIR)"; \ 658 + $(print_env_for_makefile); \ 649 659 echo "include $(abs_srctree)/Makefile"; \ 650 660 } > Makefile 651 661