diff options
author | Masahiro Yamada <yamada.m@jp.panasonic.com> | 2014-12-24 13:35:55 +0900 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-01-08 13:55:39 +0100 |
commit | e7554c0cb245ef4a47297d2b191648b8ff8aecb3 (patch) | |
tree | 3cad8f2069dd561b57ddf554d97250451cb083f2 | |
parent | d6d28acee05db669c55b53095044c6a791127c14 (diff) | |
download | barebox-e7554c0cb245ef4a47297d2b191648b8ff8aecb3.tar.gz barebox-e7554c0cb245ef4a47297d2b191648b8ff8aecb3.tar.xz |
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.
[ imported from Linux Kernel, commit 1c9e70a55b08 ]
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>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | Makefile | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -112,9 +112,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) |