[Buildroot] [PATCH] Makefile: fix out-of-tree builds with multiple targets with 'all'

Thomas De Schampheleire patrickdepinguin at gmail.com
Tue Nov 5 18:39:54 UTC 2013


"Yann E. MORIN" <yann.morin.1998 at free.fr> wrote:
>From: "Yann E. MORIN" <yann.morin.1998 at 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 at rockwellcollins.com>
>Signed-off-by: "Yann E. MORIN" <yann.morin.1998 at free.fr>
>Cc: Ryan Barnett <rjbarnet at rockwellcollins.com>
>Cc: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
>Tested-by: Ryan Barnett <rjbarnet at 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





More information about the buildroot mailing list