public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kbuild: create a build directory automatically for out-of-tree build
@ 2014-03-31  7:41 Masahiro Yamada
  2014-03-31 20:36 ` Sam Ravnborg
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2014-03-31  7:41 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-kbuild, Masahiro Yamada

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>
---
 Makefile | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 575e1f8..35b5b7e 100644
--- a/Makefile
+++ b/Makefile
@@ -120,9 +120,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
 
-- 
1.8.3.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: create a build directory automatically for out-of-tree build
  2014-03-31  7:41 [PATCH] kbuild: create a build directory automatically for out-of-tree build Masahiro Yamada
@ 2014-03-31 20:36 ` Sam Ravnborg
  2014-03-31 20:50   ` Michal Marek
  2014-04-01 17:44   ` Randy Dunlap
  0 siblings, 2 replies; 5+ messages in thread
From: Sam Ravnborg @ 2014-03-31 20:36 UTC (permalink / raw)
  To: Masahiro Yamada; +Cc: linux-kernel, linux-kbuild

On Mon, Mar 31, 2014 at 04:41:36PM +0900, Masahiro Yamada wrote:
> 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>
> ---
>  Makefile | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 575e1f8..35b5b7e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -120,9 +120,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

Hi Masahiro.

In the past I have rejected such patches - but today I fail to recall why.
I did a very quick test-spin on this and worked nicely.

So you get my:

Acked-by: Sam Ravnborg <sam@ravnborg.org>

	Sam

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: create a build directory automatically for out-of-tree build
  2014-03-31 20:36 ` Sam Ravnborg
@ 2014-03-31 20:50   ` Michal Marek
  2014-04-01 17:44   ` Randy Dunlap
  1 sibling, 0 replies; 5+ messages in thread
From: Michal Marek @ 2014-03-31 20:50 UTC (permalink / raw)
  To: Sam Ravnborg, Masahiro Yamada; +Cc: linux-kernel, linux-kbuild

Dne 31.3.2014 22:36, Sam Ravnborg napsal(a):
> On Mon, Mar 31, 2014 at 04:41:36PM +0900, Masahiro Yamada wrote:
>> 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>
>> ---
>>  Makefile | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 575e1f8..35b5b7e 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -120,9 +120,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
> 
> Hi Masahiro.
> 
> In the past I have rejected such patches - but today I fail to recall why.
> I did a very quick test-spin on this and worked nicely.
> 
> So you get my:
> 
> Acked-by: Sam Ravnborg <sam@ravnborg.org>

Applied to kbuild.git#kbuild, thanks.

Michal


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: create a build directory automatically for out-of-tree build
  2014-03-31 20:36 ` Sam Ravnborg
  2014-03-31 20:50   ` Michal Marek
@ 2014-04-01 17:44   ` Randy Dunlap
  2014-04-08 15:19     ` Michal Marek
  1 sibling, 1 reply; 5+ messages in thread
From: Randy Dunlap @ 2014-04-01 17:44 UTC (permalink / raw)
  To: Sam Ravnborg, Masahiro Yamada; +Cc: linux-kernel, linux-kbuild

On 03/31/2014 01:36 PM, Sam Ravnborg wrote:
> On Mon, Mar 31, 2014 at 04:41:36PM +0900, Masahiro Yamada wrote:
>> 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>
>> ---
>>  Makefile | 5 +++--
>>  1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 575e1f8..35b5b7e 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -120,9 +120,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
> 
> Hi Masahiro.
> 
> In the past I have rejected such patches - but today I fail to recall why.

I believe that it was due this kind of patch allowing typos to cause
builds that one does not want to make.

E.g., if I already have O=OUT1 directory and I mistype O=OUT2, this will cause
a full build (potentially) in OUT2, even if it should do a small rebuild in
OUT1 instead.

I think this is bad, but I won't exactly nak it.

> I did a very quick test-spin on this and worked nicely.
> 
> So you get my:
> 
> Acked-by: Sam Ravnborg <sam@ravnborg.org>


-- 
~Randy

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] kbuild: create a build directory automatically for out-of-tree build
  2014-04-01 17:44   ` Randy Dunlap
@ 2014-04-08 15:19     ` Michal Marek
  0 siblings, 0 replies; 5+ messages in thread
From: Michal Marek @ 2014-04-08 15:19 UTC (permalink / raw)
  To: Randy Dunlap; +Cc: Sam Ravnborg, Masahiro Yamada, linux-kernel, linux-kbuild

On 2014-04-01 19:44, Randy Dunlap wrote:
> On 03/31/2014 01:36 PM, Sam Ravnborg wrote:
>> In the past I have rejected such patches - but today I fail to recall why.
> 
> I believe that it was due this kind of patch allowing typos to cause
> builds that one does not want to make.
> 
> E.g., if I already have O=OUT1 directory and I mistype O=OUT2, this will cause
> a full build (potentially) in OUT2, even if it should do a small rebuild in
> OUT1 instead.

I thought about this possibility before applying the patch. But if this
happens, then a build in the mistyped directory will immediately fail
due to lack of .config.

Michal


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-04-08 15:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-31  7:41 [PATCH] kbuild: create a build directory automatically for out-of-tree build Masahiro Yamada
2014-03-31 20:36 ` Sam Ravnborg
2014-03-31 20:50   ` Michal Marek
2014-04-01 17:44   ` Randy Dunlap
2014-04-08 15:19     ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox