From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] Makefile: fix out-of-tree builds with multiple targets with 'all'
Date: Tue, 5 Nov 2013 19:48:38 +0100 [thread overview]
Message-ID: <20131105184837.GA3337@free.fr> (raw)
In-Reply-To: <b1481f89-f6b5-4d9e-bdc4-ae572b3c48ff@email.android.com>
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. |
'------------------------------^-------^------------------^--------------------'
next prev parent reply other threads:[~2013-11-05 18:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
-- 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20131105184837.GA3337@free.fr \
--to=yann.morin.1998@free.fr \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox