diff mbox

[1/3] Makefile: internally use absolute paths to BR2_EXTERNAL

Message ID fe4af64de250841875483a827e6f4684fad64f71.1393020340.git.yann.morin.1998@free.fr
State Accepted
Headers show

Commit Message

Yann E. MORIN Feb. 21, 2014, 10:17 p.m. UTC
From: "Yann E. MORIN" <yann.morin.1998@free.fr>

Using a relative path for BR2_EXTERNAL, and using an external defconfig,
such as in (from a Buildroot top-dir):
    make O=.. BR2_EXTERNAL=.. foo_defconfig

is broken. It is unclear why the %_defconfig rule recurses in that case.

This patch internaly makes BR2_EXTERNAL canonical (ie. makes it an absolute
path), and checks the directory exists.

Reported-by: Jérémy Rosen <jeremy.rosen@openwide.fr>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Peter Korsgaard <jacmet@uclibc.org>
Cc: Romain Naour <romain.naour@openwide.fr>
Cc: Arnout Vandecappelle <arnout@mind.be>

---
Changes v1->v2:
  - fix override BR2_EXTERNAL  (Jérémy)
  - only one error message  (Arnout)
---
 Makefile | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Thomas De Schampheleire Feb. 22, 2014, 12:06 p.m. UTC | #1
"Yann E. MORIN" <yann.morin.1998@free.fr> schreef:
>From: "Yann E. MORIN" <yann.morin.1998@free.fr>
>
>Using a relative path for BR2_EXTERNAL, and using an external defconfig,
>such as in (from a Buildroot top-dir):
>    make O=.. BR2_EXTERNAL=.. foo_defconfig
>
>is broken. It is unclear why the %_defconfig rule recurses in that case.
>
>This patch internaly makes BR2_EXTERNAL canonical (ie. makes it an absolute
>path), and checks the directory exists.
>
>Reported-by: Jérémy Rosen <jeremy.rosen@openwide.fr>
>Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>Cc: Peter Korsgaard <jacmet@uclibc.org>
>Cc: Romain Naour <romain.naour@openwide.fr>
>Cc: Arnout Vandecappelle <arnout@mind.be>
>
>---
>Changes v1->v2:
>  - fix override BR2_EXTERNAL  (Jérémy)
>  - only one error message  (Arnout)
>---
> Makefile | 5 +++++
> 1 file changed, 5 insertions(+)
>
>diff --git a/Makefile b/Makefile
>index 98d32c0..4766160 100644
>--- a/Makefile
>+++ b/Makefile
>@@ -119,6 +119,11 @@ ifeq ($(BR2_EXTERNAL),)
>   override BR2_EXTERNAL = support/dummy-external
>   $(shell rm -f $(BR2_EXTERNAL_FILE))
> else
>+  _BR2_EXTERNAL = $(shell cd $(BR2_EXTERNAL) >/dev/null 2>&1 && pwd)
>+  ifeq ($(_BR2_EXTERNAL),)
>+    $(error BR2_EXTERNAL='$(BR2_EXTERNAL)' does not exist, relatively to $(TOPDIR))

I think this should be 'relative to'.

Best regards,
Thomas
Peter Korsgaard Feb. 22, 2014, 8:40 p.m. UTC | #2
>>>>> "Thomas" == Thomas De Schampheleire <patrickdepinguin@gmail.com> writes:

 > "Yann E. MORIN" <yann.morin.1998@free.fr> schreef:
 >> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
 >> 
 >> Using a relative path for BR2_EXTERNAL, and using an external defconfig,
 >> such as in (from a Buildroot top-dir):
 >> make O=.. BR2_EXTERNAL=.. foo_defconfig
 >> 
 >> is broken. It is unclear why the %_defconfig rule recurses in that case.
 >> 
 >> This patch internaly makes BR2_EXTERNAL canonical (ie. makes it an absolute
 >> path), and checks the directory exists.
 >> 
 >> Reported-by: Jérémy Rosen <jeremy.rosen@openwide.fr>
 >> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
 >> Cc: Peter Korsgaard <jacmet@uclibc.org>
 >> Cc: Romain Naour <romain.naour@openwide.fr>
 >> Cc: Arnout Vandecappelle <arnout@mind.be>
 >> 
 >> ---
 >> Changes v1->v2:
 >> - fix override BR2_EXTERNAL  (Jérémy)
 >> - only one error message  (Arnout)
 >> ---
 >> Makefile | 5 +++++
 >> 1 file changed, 5 insertions(+)
 >> 
 >> diff --git a/Makefile b/Makefile
 >> index 98d32c0..4766160 100644
 >> --- a/Makefile
 >> +++ b/Makefile
 >> @@ -119,6 +119,11 @@ ifeq ($(BR2_EXTERNAL),)
 >> override BR2_EXTERNAL = support/dummy-external
 >> $(shell rm -f $(BR2_EXTERNAL_FILE))
 >> else
 >> +  _BR2_EXTERNAL = $(shell cd $(BR2_EXTERNAL) >/dev/null 2>&1 && pwd)
 >> +  ifeq ($(_BR2_EXTERNAL),)
 >> +    $(error BR2_EXTERNAL='$(BR2_EXTERNAL)' does not exist, relatively to $(TOPDIR))

 > I think this should be 'relative to'.

Committed with that changed, thanks.
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 98d32c0..4766160 100644
--- a/Makefile
+++ b/Makefile
@@ -119,6 +119,11 @@  ifeq ($(BR2_EXTERNAL),)
   override BR2_EXTERNAL = support/dummy-external
   $(shell rm -f $(BR2_EXTERNAL_FILE))
 else
+  _BR2_EXTERNAL = $(shell cd $(BR2_EXTERNAL) >/dev/null 2>&1 && pwd)
+  ifeq ($(_BR2_EXTERNAL),)
+    $(error BR2_EXTERNAL='$(BR2_EXTERNAL)' does not exist, relatively to $(TOPDIR))
+  endif
+  override BR2_EXTERNAL := $(_BR2_EXTERNAL)
   $(shell echo BR2_EXTERNAL ?= $(BR2_EXTERNAL) > $(BR2_EXTERNAL_FILE))
 endif