All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] Makefile: fix out-of-tree builds with multiple targets with 'all'
@ 2013-11-05 18:33 Yann E. MORIN
  2013-11-05 18:39 ` Thomas De Schampheleire
  0 siblings, 1 reply; 5+ messages in thread
From: Yann E. MORIN @ 2013-11-05 18:33 UTC (permalink / raw)
  To: buildroot

From: "Yann E. MORIN" <yann.morin.1998@free.fr>

For out-of-tree builds, this use-case fails to build:
    $ make clean all

This is because 'all' is filtered-out in the Makefile wrapper, since
the wrapper itself has a 'all' target.

The 'all' target is just the usual naming for the default target in a
Makefile. In fact, the first target is the default one, so we can name
it whatever we want.

Rename the Makefile wrapper 'all' target to avoid name-clashing.

Fixes #6644.

Reported-by: Ryan Barnett <rjbarnet@rockwellcollins.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Ryan Barnett <rjbarnet@rockwellcollins.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tested-by: Ryan Barnett <rjbarnet@rockwellcollins.com>
---
Changes v2->v3:
  - add bug reference  (Ryan)

Changes v1->v2
  - fix one missed 'all' occurence

---
 support/scripts/mkmakefile | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/support/scripts/mkmakefile b/support/scripts/mkmakefile
index cef2ec7..27b1507 100755
--- a/support/scripts/mkmakefile
+++ b/support/scripts/mkmakefile
@@ -32,16 +32,16 @@ MAKEFLAGS += --no-print-directory
 
 .PHONY: all \$(MAKECMDGOALS)
 
-all	:= \$(filter-out all Makefile,\$(MAKECMDGOALS))
+all	:= \$(filter-out Makefile,\$(MAKECMDGOALS))
 
-all:
+_all:
 	\$(MAKE) \$(MAKEARGS) \$(all)
 
 Makefile:;
 
-\$(all): all
+\$(all): _all
 	@:
 
-%/: all
+%/: _all
 	@:
 EOF
-- 
1.8.1.2

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

* [Buildroot] [PATCH] Makefile: fix out-of-tree builds with multiple targets with 'all'
  2013-11-05 18:33 [Buildroot] [PATCH] Makefile: fix out-of-tree builds with multiple targets with 'all' Yann E. MORIN
@ 2013-11-05 18:39 ` Thomas De Schampheleire
  2013-11-05 18:48   ` Yann E. MORIN
  0 siblings, 1 reply; 5+ messages in thread
From: Thomas De Schampheleire @ 2013-11-05 18:39 UTC (permalink / raw)
  To: buildroot

"Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
>From: "Yann E. MORIN" <yann.morin.1998@free.fr>
>
>For out-of-tree builds, this use-case fails to build:
>    $ make clean all
>
>This is because 'all' is filtered-out in the Makefile wrapper, since
>the wrapper itself has a 'all' target.
>
>The 'all' target is just the usual naming for the default target in a
>Makefile. In fact, the first target is the default one, so we can name
>it whatever we want.
>
>Rename the Makefile wrapper 'all' target to avoid name-clashing.
>
>Fixes #6644.
>
>Reported-by: Ryan Barnett <rjbarnet@rockwellcollins.com>
>Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>Cc: Ryan Barnett <rjbarnet@rockwellcollins.com>
>Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
>Tested-by: Ryan Barnett <rjbarnet@rockwellcollins.com>
>---
>Changes v2->v3:
>  - add bug reference  (Ryan)
>
>Changes v1->v2
>  - fix one missed 'all' occurence
>
>---
> support/scripts/mkmakefile | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
>diff --git a/support/scripts/mkmakefile b/support/scripts/mkmakefile
>index cef2ec7..27b1507 100755
>--- a/support/scripts/mkmakefile
>+++ b/support/scripts/mkmakefile
>@@ -32,16 +32,16 @@ MAKEFLAGS += --no-print-directory
> 
> .PHONY: all \$(MAKECMDGOALS)
> 
>-all	:= \$(filter-out all Makefile,\$(MAKECMDGOALS))
>+all	:= \$(filter-out Makefile,\$(MAKECMDGOALS))
> 
>-all:
>+_all:
> 	\$(MAKE) \$(MAKEARGS) \$(all)
> 
> Makefile:;
> 
>-\$(all): all
>+\$(all): _all
> 	@:
> 
>-%/: all
>+%/: _all
> 	@:
> EOF

Just curious: if you now type 'make all', which of the above rules gets executed? Can you explain what is going on here?

Thanks,
Thomas

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

* [Buildroot] [PATCH] Makefile: fix out-of-tree builds with multiple targets with 'all'
  2013-11-05 18:39 ` Thomas De Schampheleire
@ 2013-11-05 18:48   ` Yann E. MORIN
  0 siblings, 0 replies; 5+ messages in thread
From: Yann E. MORIN @ 2013-11-05 18:48 UTC (permalink / raw)
  To: buildroot

Thomas DS, All,

On 2013-11-05 19:39 +0100, Thomas De Schampheleire spake thusly:
> "Yann E. MORIN" <yann.morin.1998@free.fr> wrote:
> >From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> >
> >For out-of-tree builds, this use-case fails to build:
> >    $ make clean all
> >
> >This is because 'all' is filtered-out in the Makefile wrapper, since
> >the wrapper itself has a 'all' target.
> >
> >The 'all' target is just the usual naming for the default target in a
> >Makefile. In fact, the first target is the default one, so we can name
> >it whatever we want.
> >
> >Rename the Makefile wrapper 'all' target to avoid name-clashing.


[moved the question here, it's easier to answer below]
> Just curious: if you now type 'make all', which of the above rules 
> gets executed? Can you explain what is going on here?

Please, follow the numbers, below:

> >diff --git a/support/scripts/mkmakefile b/support/scripts/mkmakefile
> >index cef2ec7..27b1507 100755
> >--- a/support/scripts/mkmakefile
> >+++ b/support/scripts/mkmakefile
> >@@ -32,16 +32,16 @@ MAKEFLAGS += --no-print-directory
> > 
> > .PHONY: all \$(MAKECMDGOALS)
> > 
> >-all	:= \$(filter-out all Makefile,\$(MAKECMDGOALS))
> >+all	:= \$(filter-out Makefile,\$(MAKECMDGOALS))

(1)
With 'make all', the variable $(MAKECMDGOALS) is the string "all"
(without the quotes). So the variable $(all) is assigned the string
"all" (still without quotes).

> > 
> >-all:
> >+_all:
> > 	\$(MAKE) \$(MAKEARGS) \$(all)

(3)
And finally here, the rulle is:
    make -C /path/to/buildroot O=$(pwd) all
         `----------------------------' `-'
                $(MAKEARGS)             $(all)

> > 
> > Makefile:;
> > 

> >-\$(all): all
> >+\$(all): _all

(2)
And here the variable $(all) ix expanded, and as it depends on _all, the
rulle _all above is executed

> > 	@:
> > 
> >-%/: all
> >+%/: _all
> > 	@:
> > EOF
> 

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH] Makefile: fix out-of-tree builds with multiple targets with 'all'
  2013-11-03 10:18 Yann E. MORIN
@ 2013-11-03 10:24 ` Yann E. MORIN
  0 siblings, 0 replies; 5+ messages in thread
From: Yann E. MORIN @ 2013-11-03 10:24 UTC (permalink / raw)
  To: buildroot

Hello All,

On 2013-11-03 11:18 +0100, Yann E. MORIN spake thusly:
> From: "Yann E. MORIN" <yann.morin.1998@free.fr>
> 
> For out-of-tree builds, this use-case fails to build:
>     $ make clean all
> 
> This is because 'all' is filtered-out in the Makefile wrapper, since
> the wrapper itself has a 'all' target.
> 
> The 'all' target is just the usual naming for the default target in a
> Makefile. In fact, the first target is the default one, so we can name
> it whatever we want.
> 
> Rename the Makefile wrapper 'all' target to avoid name-clashing.

Sorry, I forgot one occurence of 'all'. New patch on its way...

Regards,
Yann E. MORIN.

> Reported-by: Ryan Barnett <rjbarnet@rockwellcollins.com>
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Ryan Barnett <rjbarnet@rockwellcollins.com>
> ---
>  support/scripts/mkmakefile | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/support/scripts/mkmakefile b/support/scripts/mkmakefile
> index cef2ec7..89dc649 100755
> --- a/support/scripts/mkmakefile
> +++ b/support/scripts/mkmakefile
> @@ -32,14 +32,14 @@ MAKEFLAGS += --no-print-directory
>  
>  .PHONY: all \$(MAKECMDGOALS)
>  
> -all	:= \$(filter-out all Makefile,\$(MAKECMDGOALS))
> +all	:= \$(filter-out Makefile,\$(MAKECMDGOALS))
>  
> -all:
> +_all:
>  	\$(MAKE) \$(MAKEARGS) \$(all)
>  
>  Makefile:;
>  
> -\$(all): all
> +\$(all): _all
>  	@:
>  
>  %/: all
> -- 
> 1.8.1.2
> 

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH] Makefile: fix out-of-tree builds with multiple targets with 'all'
@ 2013-11-03 10:18 Yann E. MORIN
  2013-11-03 10:24 ` Yann E. MORIN
  0 siblings, 1 reply; 5+ messages in thread
From: Yann E. MORIN @ 2013-11-03 10:18 UTC (permalink / raw)
  To: buildroot

From: "Yann E. MORIN" <yann.morin.1998@free.fr>

For out-of-tree builds, this use-case fails to build:
    $ make clean all

This is because 'all' is filtered-out in the Makefile wrapper, since
the wrapper itself has a 'all' target.

The 'all' target is just the usual naming for the default target in a
Makefile. In fact, the first target is the default one, so we can name
it whatever we want.

Rename the Makefile wrapper 'all' target to avoid name-clashing.

Reported-by: Ryan Barnett <rjbarnet@rockwellcollins.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Ryan Barnett <rjbarnet@rockwellcollins.com>
---
 support/scripts/mkmakefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/support/scripts/mkmakefile b/support/scripts/mkmakefile
index cef2ec7..89dc649 100755
--- a/support/scripts/mkmakefile
+++ b/support/scripts/mkmakefile
@@ -32,14 +32,14 @@ MAKEFLAGS += --no-print-directory
 
 .PHONY: all \$(MAKECMDGOALS)
 
-all	:= \$(filter-out all Makefile,\$(MAKECMDGOALS))
+all	:= \$(filter-out Makefile,\$(MAKECMDGOALS))
 
-all:
+_all:
 	\$(MAKE) \$(MAKEARGS) \$(all)
 
 Makefile:;
 
-\$(all): all
+\$(all): _all
 	@:
 
 %/: all
-- 
1.8.1.2

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

end of thread, other threads:[~2013-11-05 18:48 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-05 18:33 [Buildroot] [PATCH] Makefile: fix out-of-tree builds with multiple targets with 'all' Yann E. MORIN
2013-11-05 18:39 ` Thomas De Schampheleire
2013-11-05 18:48   ` Yann E. MORIN
  -- strict thread matches above, loose matches on Subject: below --
2013-11-03 10:18 Yann E. MORIN
2013-11-03 10:24 ` Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.