Skip to contentSkip to conversation

Makefile: fix out-of-tree builds with multiple targets with 'all'

PATCH Superseded Yann E. MORIN 1 participant 2 messages Nov 3, 2013

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: fix out-of-tree builds with multiple targets with 'all'

From: "Yann E. MORIN" <[email protected]>

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.

---
 support/scripts/mkmakefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
support/scripts/mkmakefile +3 -3
index cef2ec7..89dc649 100755
@@ -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
Signature · 1 line
1.8.1.2
#1 lore raw

PATCH 1/1 Makefile: fix out-of-tree builds with multiple targets with 'all'

Hello All,

On 2013-11-03 11:18 +0100, Yann E. MORIN spake thusly:

Quoted 5 lines

From: "Yann E. MORIN" <[email protected]>

For out-of-tree builds, this use-case fails to build:

    $ make clean all
Quoted 8 lines

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.

Quoted 32 lines
---
 support/scripts/mkmakefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
support/scripts/mkmakefile +3 -3
index cef2ec7..89dc649 100755
@@ -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
Signature · 1 line
1.8.1.2
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'