From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 2 of 7 v3] infra: add comment describing single/double dollar-sign rules
Date: Fri, 6 Jun 2014 23:23:40 +0200 [thread overview]
Message-ID: <20140606212340.GF3481@free.fr> (raw)
In-Reply-To: <c09add9a59c5afc09926.1402085578@localhost>
Thomas, All,
On 2014-06-06 22:12 +0200, Thomas De Schampheleire spake thusly:
> As the rules with respect to variable and function references and the need
> for single or double dollar signs are not trivial, add a comment in
> pkg-generic.mk describing them.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Regards,
Yann E. MORIN.
> ---
> v3: expand exception for pkgdir and pkgname
> v2: clarify exception for pkgdir and pkgname
>
> package/pkg-generic.mk | 23 +++++++++++++++++++++++
> 1 files changed, 23 insertions(+), 0 deletions(-)
>
> diff -r b1861ead4977 -r c09add9a59c5 package/pkg-generic.mk
> --- a/package/pkg-generic.mk Thu May 08 21:53:48 2014 +0200
> +++ b/package/pkg-generic.mk Sat May 10 10:04:45 2014 +0200
> @@ -269,6 +269,29 @@
> # argument 3 is the uppercase package name, without the HOST_ prefix
> # for host packages
> # argument 4 is the type (target or host)
> +#
> +# Note about variable and function references: inside all blocks that are
> +# evaluated with $(eval), which includes all 'inner-xxx-package' blocks,
> +# specific rules apply with respect to variable and function references.
> +# - Numbered variables (parameters to the block) can be referenced with a single
> +# dollar sign: $(1), $(2), $(3), etc.
> +# - pkgdir and pkgname should be referenced with a single dollar sign too. These
> +# functions rely on 'the most recently parsed makefile' which is supposed to
> +# be the package .mk file. If we defer the evaluation of these functions using
> +# double dollar signs, then they may be evaluated too late, when other
> +# makefiles have already been parsed. One specific case is when $$(pkgdir) is
> +# assigned to a variable using deferred evaluation with '=' and this variable
> +# is used in a target rule outside the eval'ed inner block. In this case, the
> +# pkgdir will be that of the last makefile parsed by buildroot, which is not
> +# the expected value. This mechanism is for example used for the TARGET_PATCH
> +# rule.
> +# - All other variables should be referenced with a double dollar sign:
> +# $$(TARGET_DIR), $$($(2)_VERSION), etc. Also all make functions should be
> +# referenced with a double dollar sign: $$(subst), $$(call), $$(filter-out),
> +# etc. This rule ensures that these variables and functions are only expanded
> +# during the $(eval) step, and not earlier. Otherwise, unintuitive and
> +# undesired behavior occurs with respect to these variables and functions.
> +#
> ################################################################################
>
> define inner-generic-package
--
.-----------------.--------------------.------------------.--------------------.
| 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:[~2014-06-06 21:23 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-06 20:12 [Buildroot] [PATCH 0 of 7 v3] infra: fix dollar signs; remove some undefined versions Thomas De Schampheleire
2014-06-06 20:12 ` [Buildroot] [PATCH 1 of 7 v3] infra: consistently use double dollar signs inside inner-xxx-targets Thomas De Schampheleire
2014-06-06 21:21 ` Yann E. MORIN
2014-06-08 14:09 ` Thomas De Schampheleire
2014-06-07 8:49 ` Thomas Petazzoni
2014-06-08 14:29 ` Thomas De Schampheleire
2014-06-11 15:56 ` Thomas Petazzoni
2014-06-06 20:12 ` [Buildroot] [PATCH 2 of 7 v3] infra: add comment describing single/double dollar-sign rules Thomas De Schampheleire
2014-06-06 21:23 ` Yann E. MORIN [this message]
2014-06-07 8:52 ` Thomas Petazzoni
2014-06-06 20:12 ` [Buildroot] [PATCH 3 of 7 v3] pkg-virtual: simplify definition of FOO_VERSION to 'virtual' Thomas De Schampheleire
2014-06-06 20:13 ` [Buildroot] [PATCH 4 of 7 v3] toolchain/toolchain-buildroot: migrate to virtual package infrastructure Thomas De Schampheleire
2014-06-07 8:56 ` Thomas Petazzoni
2014-06-06 20:13 ` [Buildroot] [PATCH 5 of 7 v3] toolchain-external: change version from 'undefined' to 'virtual' Thomas De Schampheleire
2014-06-07 8:57 ` Thomas Petazzoni
2014-06-08 15:04 ` Thomas De Schampheleire
2014-06-08 16:10 ` Thomas Petazzoni
2014-06-08 17:23 ` Thomas De Schampheleire
2014-06-16 5:17 ` Arnout Vandecappelle
2014-06-16 6:54 ` Thomas De Schampheleire
2014-06-16 7:18 ` Thomas Petazzoni
2014-06-06 20:13 ` [Buildroot] [PATCH 6 of 7 v3] makedevs: change version from 'undefined' to 'buildroot-$(BR2_VERSION)' Thomas De Schampheleire
2014-06-06 20:13 ` [Buildroot] [PATCH 7 of 7 v3] mkpasswd: " Thomas De Schampheleire
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=20140606212340.GF3481@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