aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.m@jp.panasonic.com>2014-03-31 16:41:36 +0900
committerTARKZiM <tom8476oo@gmail.com>2021-11-04 02:02:16 +0800
commit59c929bdcef5a39d9b1aac3fbf2e66dd0ac0c382 (patch)
treeaf8a729b090694f37755baa127f7fdad8cfb015b
parent8a5c29d5786e531b3249533f760308f149d0663e (diff)
kbuild: create a build directory automatically for out-of-tree buildHEADs12.0
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>
-rw-r--r--Makefile5
1 files changed, 3 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index cd5f74333d3..8db0fd4369a 100644
--- a/Makefile
+++ b/Makefile
@@ -117,9 +117,10 @@ ifneq ($(KBUILD_OUTPUT),)
# Invoke a second make in the output directory, passing relevant variables
# check that the output directory actually exists
saved-output := $(KBUILD_OUTPUT)
-KBUILD_OUTPUT := $(shell cd $(KBUILD_OUTPUT) && /bin/pwd)
+KBUILD_OUTPUT := $(shell mkdir -p $(KBUILD_OUTPUT) && cd $(KBUILD_OUTPUT) \
+ && /bin/pwd)
$(if $(KBUILD_OUTPUT),, \
- $(error output directory "$(saved-output)" does not exist))
+ $(error failed to create output directory "$(saved-output)"))
PHONY += $(MAKECMDGOALS) sub-make