Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0 of 2] 'make clean' improvements
@ 2013-09-30 11:09 Thomas De Schampheleire
  2013-09-30 11:09 ` [Buildroot] [PATCH 1 of 2] make clean: improve when no .config present Thomas De Schampheleire
  2013-09-30 11:09 ` [Buildroot] [PATCH 2 of 2] make clean: remove redundant removal of STAGING_DIR Thomas De Schampheleire
  0 siblings, 2 replies; 8+ messages in thread
From: Thomas De Schampheleire @ 2013-09-30 11:09 UTC (permalink / raw)
  To: buildroot

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

---
 Makefile |  25 +++++++++++--------------
 1 files changed, 11 insertions(+), 14 deletions(-)

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

* [Buildroot] [PATCH 1 of 2] make clean: improve when no .config present
  2013-09-30 11:09 [Buildroot] [PATCH 0 of 2] 'make clean' improvements Thomas De Schampheleire
@ 2013-09-30 11:09 ` Thomas De Schampheleire
  2013-09-30 12:04   ` Thomas Petazzoni
  2013-09-30 11:09 ` [Buildroot] [PATCH 2 of 2] make clean: remove redundant removal of STAGING_DIR Thomas De Schampheleire
  1 sibling, 1 reply; 8+ messages in thread
From: Thomas De Schampheleire @ 2013-09-30 11:09 UTC (permalink / raw)
  To: buildroot

The 'make clean' recipe is using variables that are not defined without .config
file, causing only a partial cleanup when the .config file is accidentally
deleted.

This patch moves those variables that do not depend on values from .config
outside the BR2_HAVE_DOT_CONFIG check, so that 'make clean' is much more similar
with and without .config.

The HOST_DIR (and the derived STAGING_DIR) are determined from BR2_HOST_DIR in
.config, so the host directory can still not be cleaned correctly without making
assumptions, if no .config is present.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

---
Note: we could improve the HOST_DIR cleanup by removing 'output/host'
unconditionally, but it's an assumption. Let me know your thoughts on this, it
could be fixed in another patch.

 Makefile |  23 ++++++++++-------------
 1 files changed, 10 insertions(+), 13 deletions(-)

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -193,7 +193,17 @@ BASE_DIR := $(shell mkdir -p $(O) && cd 
 $(if $(BASE_DIR),, $(error output directory "$(O)" does not exist))
 
 BUILD_DIR:=$(BASE_DIR)/build
+STAMP_DIR:=$(BASE_DIR)/stamps
+BINARIES_DIR:=$(BASE_DIR)/images
+TARGET_DIR:=$(BASE_DIR)/target
 
+LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
+REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
+LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
+LEGAL_MANIFEST_CSV=$(LEGAL_INFO_DIR)/manifest.csv
+LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
+LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
+LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
 
 ifeq ($(BR2_HAVE_DOT_CONFIG),y)
 
@@ -262,21 +272,8 @@ HOST_DIR:=$(call qstrip,$(BR2_HOST_DIR))
 # locales to generate
 GENERATE_LOCALE=$(call qstrip,$(BR2_GENERATE_LOCALE))
 
-# stamp (dependency) files go here
-STAMP_DIR:=$(BASE_DIR)/stamps
-
-BINARIES_DIR:=$(BASE_DIR)/images
-TARGET_DIR:=$(BASE_DIR)/target
 TARGET_SKELETON=$(TOPDIR)/system/skeleton
 
-LEGAL_INFO_DIR=$(BASE_DIR)/legal-info
-REDIST_SOURCES_DIR=$(LEGAL_INFO_DIR)/sources
-LICENSE_FILES_DIR=$(LEGAL_INFO_DIR)/licenses
-LEGAL_MANIFEST_CSV=$(LEGAL_INFO_DIR)/manifest.csv
-LEGAL_LICENSES_TXT=$(LEGAL_INFO_DIR)/licenses.txt
-LEGAL_WARNINGS=$(LEGAL_INFO_DIR)/.warnings
-LEGAL_REPORT=$(LEGAL_INFO_DIR)/README
-
 # Location of a file giving a big fat warning that output/target
 # should not be used as the root filesystem.
 TARGET_DIR_WARNING_FILE=$(TARGET_DIR)/THIS_IS_NOT_YOUR_ROOT_FILESYSTEM

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

* [Buildroot] [PATCH 2 of 2] make clean: remove redundant removal of STAGING_DIR
  2013-09-30 11:09 [Buildroot] [PATCH 0 of 2] 'make clean' improvements Thomas De Schampheleire
  2013-09-30 11:09 ` [Buildroot] [PATCH 1 of 2] make clean: improve when no .config present Thomas De Schampheleire
@ 2013-09-30 11:09 ` Thomas De Schampheleire
  2013-10-01 17:21   ` Arnout Vandecappelle
  2013-10-01 19:59   ` Peter Korsgaard
  1 sibling, 2 replies; 8+ messages in thread
From: Thomas De Schampheleire @ 2013-09-30 11:09 UTC (permalink / raw)
  To: buildroot

Since STAGING_DIR is defined as (package/Makefile.in):

STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
STAGING_DIR    = $(HOST_DIR)/$(STAGING_SUBDIR)

removing HOST_DIR will automatically remove STAGING_DIR. This patch updates
'make clean' based on this knowledge.

Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

---
 Makefile |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Makefile b/Makefile
--- a/Makefile
+++ b/Makefile
@@ -748,7 +748,7 @@ printvars:
 		$(info $V=$($V) ($(value $V)))))
 
 clean:
-	rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
+	rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
 		$(STAMP_DIR) $(BUILD_DIR) $(BASE_DIR)/staging \
 		$(LEGAL_INFO_DIR)
 

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

* [Buildroot] [PATCH 1 of 2] make clean: improve when no .config present
  2013-09-30 11:09 ` [Buildroot] [PATCH 1 of 2] make clean: improve when no .config present Thomas De Schampheleire
@ 2013-09-30 12:04   ` Thomas Petazzoni
  2013-10-01 17:20     ` Arnout Vandecappelle
  0 siblings, 1 reply; 8+ messages in thread
From: Thomas Petazzoni @ 2013-09-30 12:04 UTC (permalink / raw)
  To: buildroot

Dear Thomas De Schampheleire,

On Mon, 30 Sep 2013 13:09:26 +0200, Thomas De Schampheleire wrote:
> The 'make clean' recipe is using variables that are not defined without .config
> file, causing only a partial cleanup when the .config file is accidentally
> deleted.
> 
> This patch moves those variables that do not depend on values from .config
> outside the BR2_HAVE_DOT_CONFIG check, so that 'make clean' is much more similar
> with and without .config.

Yeah, this has bothered me for a while, so I agree with that.

> The HOST_DIR (and the derived STAGING_DIR) are determined from BR2_HOST_DIR in
> .config, so the host directory can still not be cleaned correctly without making
> assumptions, if no .config is present.
> 
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> 
> ---
> Note: we could improve the HOST_DIR cleanup by removing 'output/host'
> unconditionally, but it's an assumption. Let me know your thoughts on this, it
> could be fixed in another patch.

Hum, yeah, indeed. This means that the contents of output/host are not
removed, which is quite annoying. I don't immediately see a solution to
this problem, though.

Best regards,

Thomas
-- 
Thomas Petazzoni, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

* [Buildroot] [PATCH 1 of 2] make clean: improve when no .config present
  2013-09-30 12:04   ` Thomas Petazzoni
@ 2013-10-01 17:20     ` Arnout Vandecappelle
  2013-10-01 19:55       ` Peter Korsgaard
  0 siblings, 1 reply; 8+ messages in thread
From: Arnout Vandecappelle @ 2013-10-01 17:20 UTC (permalink / raw)
  To: buildroot

On 09/30/13 14:04, Thomas Petazzoni wrote:
> Dear Thomas De Schampheleire,
>
> On Mon, 30 Sep 2013 13:09:26 +0200, Thomas De Schampheleire wrote:
>> The 'make clean' recipe is using variables that are not defined without .config
>> file, causing only a partial cleanup when the .config file is accidentally
>> deleted.
>>
>> This patch moves those variables that do not depend on values from .config
>> outside the BR2_HAVE_DOT_CONFIG check, so that 'make clean' is much more similar
>> with and without .config.
>
> Yeah, this has bothered me for a while, so I agree with that.
>
>> The HOST_DIR (and the derived STAGING_DIR) are determined from BR2_HOST_DIR in
>> .config, so the host directory can still not be cleaned correctly without making
>> assumptions, if no .config is present.
>>
>> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
>>
>> ---
>> Note: we could improve the HOST_DIR cleanup by removing 'output/host'
>> unconditionally, but it's an assumption. Let me know your thoughts on this, it
>> could be fixed in another patch.
>
> Hum, yeah, indeed. This means that the contents of output/host are not
> removed, which is quite annoying. I don't immediately see a solution to
> this problem, though.

  I would be OK with defining HOST_DIR as $(BASE_DIR)/host before .config 
is included. If .config exists, it will be overridden afterwards.


  Regards,
  Arnout


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

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

* [Buildroot] [PATCH 2 of 2] make clean: remove redundant removal of STAGING_DIR
  2013-09-30 11:09 ` [Buildroot] [PATCH 2 of 2] make clean: remove redundant removal of STAGING_DIR Thomas De Schampheleire
@ 2013-10-01 17:21   ` Arnout Vandecappelle
  2013-10-01 19:59   ` Peter Korsgaard
  1 sibling, 0 replies; 8+ messages in thread
From: Arnout Vandecappelle @ 2013-10-01 17:21 UTC (permalink / raw)
  To: buildroot

On 09/30/13 13:09, Thomas De Schampheleire wrote:
> Since STAGING_DIR is defined as (package/Makefile.in):
>
> STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
> STAGING_DIR    = $(HOST_DIR)/$(STAGING_SUBDIR)
>
> removing HOST_DIR will automatically remove STAGING_DIR. This patch updates
> 'make clean' based on this knowledge.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

Acked-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>

>
> ---
>   Makefile |  2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/Makefile b/Makefile
> --- a/Makefile
> +++ b/Makefile
> @@ -748,7 +748,7 @@ printvars:
>   		$(info $V=$($V) ($(value $V)))))
>
>   clean:
> -	rm -rf $(STAGING_DIR) $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
> +	rm -rf $(TARGET_DIR) $(BINARIES_DIR) $(HOST_DIR) \
>   		$(STAMP_DIR) $(BUILD_DIR) $(BASE_DIR)/staging \
>   		$(LEGAL_INFO_DIR)
>
>


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

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

* [Buildroot] [PATCH 1 of 2] make clean: improve when no .config present
  2013-10-01 17:20     ` Arnout Vandecappelle
@ 2013-10-01 19:55       ` Peter Korsgaard
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Korsgaard @ 2013-10-01 19:55 UTC (permalink / raw)
  To: buildroot

>>>>> "Arnout" == Arnout Vandecappelle <arnout@mind.be> writes:

Hi,

 >>> Note: we could improve the HOST_DIR cleanup by removing
 >>> 'output/host' unconditionally, but it's an assumption. Let me know
 >>> your thoughts on this, it could be fixed in another patch.
 >> 
 >> Hum, yeah, indeed. This means that the contents of output/host are not
 >> removed, which is quite annoying. I don't immediately see a solution to
 >> this problem, though.

 Arnout>  I would be OK with defining HOST_DIR as $(BASE_DIR)/host before
 Arnout> .config is included. If .config exists, it will be overridden
 Arnout> afterwards.

Yes, that sounds like a plan. The only potential issue is if somebody
builds out of tree _AND_ has changed the BR2_HOST_DIR _AND_ runs make clean
in a directory where they have an important 'host' subdir.

That's probably all fairly unlikely to be a real issue.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [PATCH 2 of 2] make clean: remove redundant removal of STAGING_DIR
  2013-09-30 11:09 ` [Buildroot] [PATCH 2 of 2] make clean: remove redundant removal of STAGING_DIR Thomas De Schampheleire
  2013-10-01 17:21   ` Arnout Vandecappelle
@ 2013-10-01 19:59   ` Peter Korsgaard
  1 sibling, 0 replies; 8+ messages in thread
From: Peter Korsgaard @ 2013-10-01 19:59 UTC (permalink / raw)
  To: buildroot

>>>>> "Thomas" == Thomas De Schampheleire <patrickdepinguin@gmail.com> writes:

 Thomas> Since STAGING_DIR is defined as (package/Makefile.in):
 Thomas> STAGING_SUBDIR = usr/$(GNU_TARGET_NAME)/sysroot
 Thomas> STAGING_DIR    = $(HOST_DIR)/$(STAGING_SUBDIR)

 Thomas> removing HOST_DIR will automatically remove STAGING_DIR. This
 Thomas> patch updates 'make clean' based on this knowledge.

 Thomas> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>

Committed, thanks.

-- 
Bye, Peter Korsgaard

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

end of thread, other threads:[~2013-10-01 19:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-09-30 11:09 [Buildroot] [PATCH 0 of 2] 'make clean' improvements Thomas De Schampheleire
2013-09-30 11:09 ` [Buildroot] [PATCH 1 of 2] make clean: improve when no .config present Thomas De Schampheleire
2013-09-30 12:04   ` Thomas Petazzoni
2013-10-01 17:20     ` Arnout Vandecappelle
2013-10-01 19:55       ` Peter Korsgaard
2013-09-30 11:09 ` [Buildroot] [PATCH 2 of 2] make clean: remove redundant removal of STAGING_DIR Thomas De Schampheleire
2013-10-01 17:21   ` Arnout Vandecappelle
2013-10-01 19:59   ` Peter Korsgaard

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