diff options
author | Masahiro Yamada <yamada.m@jp.panasonic.com> | 2014-03-31 03:41:36 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2014-03-31 16:47:16 -0400 |
commit | 1c9e70a55b088d97a59241744fe459409d0c3582 (patch) | |
tree | bcb49fb8471c641d8d321c1af9d4e82d349f6998 /Makefile | |
parent | a03fcb50e816a69acffb13b5e56db75063aeba8a (diff) |
kbuild: create a build directory automatically for out-of-tree build
Kbuild supports saving output files in a separate directory.
But the build directory must be created beforehand. For example,
$ mkdir -p dir/to/store/output/files
$ make O=dir/to/store/output/files defconfig
Creating a build directory automatically would be useful.
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -120,9 +120,10 @@ ifneq ($(KBUILD_OUTPUT),) | |||
120 | # Invoke a second make in the output directory, passing relevant variables | 120 | # Invoke a second make in the output directory, passing relevant variables |
121 | # check that the output directory actually exists | 121 | # check that the output directory actually exists |
122 | saved-output := $(KBUILD_OUTPUT) | 122 | saved-output := $(KBUILD_OUTPUT) |
123 | KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd) | 123 | KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \ |
124 | && /bin/pwd) | ||
124 | $(if $(KBUILD_OUTPUT),, \ | 125 | $(if $(KBUILD_OUTPUT),, \ |
125 | $(error output directory "$(saved-output)" does not exist)) | 126 | $(error failed to create output directory "$(saved-output)")) |
126 | 127 | ||
127 | PHONY += $(MAKECMDGOALS) sub-make | 128 | PHONY += $(MAKECMDGOALS) sub-make |
128 | 129 | ||