Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 1 of 7 v2] infra: consistently use double dollar signs inside inner-xxx-targets
Date: Thu, 22 May 2014 02:02:29 +0200	[thread overview]
Message-ID: <537D3E95.9080707@mind.be> (raw)
In-Reply-To: <CAAXf6LXt9=durmGRQhgav5F0qsDtdeSzKXrks5=WGfo5dzLoQw@mail.gmail.com>

On 21/05/14 15:14, Thomas De Schampheleire wrote:
> Hi Arnout,
> 
> On Tue, May 13, 2014 at 11:25 AM, Arnout Vandecappelle <arnout@mind.be> wrote:
> [..]
>>>
>>> @@ -548,7 +550,7 @@ endif
>>>  $$($(2)_TARGET_RSYNC_SOURCE):                SRCDIR=$$($(2)_OVERRIDE_SRCDIR)
>>>  $$($(2)_TARGET_RSYNC_SOURCE):                PKG=$(2)
>>>  $$($(2)_TARGET_PATCH):                       PKG=$(2)
>>> -$$($(2)_TARGET_PATCH):                       RAWNAME=$(patsubst host-%,%,$(1))
>>> +$$($(2)_TARGET_PATCH):                       RAWNAME=$$(patsubst host-%,%,$(1))
>>>  $$($(2)_TARGET_PATCH):                       PKGDIR=$(pkgdir)
>>>  $$($(2)_TARGET_EXTRACT):             PKG=$(2)
>>>  $$($(2)_TARGET_SOURCE):                      PKG=$(2)
>>> @@ -559,9 +561,9 @@ endif
>>>  # kernel case, the bootloaders case, and the normal packages case.
>>>  ifeq ($(1),linux)
>>>  $(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
>>> -else ifneq ($(filter boot/%,$(pkgdir)),)
>>> +else ifneq ($$(filter boot/%,$(pkgdir)),)
>>
>>  $$(pkgdir) works fine here. Also, it gets evaluated only once anyway, so
>> there's no speedup from using a single $.
>>
> 
> While creating v3 of this patch and retesting, I bumped into a nasty
> situation regarding pkgdir: the foo-patch rule is executed with the
> variable PKGDIR=$(pkgdir) which I changed to PKGDIR=$$(pkgdir).
> However, in that case, the foo-patch rule, which is outside
> inner-targets, gets executed with the literal $(pkgdir) as PKGDIR,
> which is evaluated to docs/manual (the directory of the last makefile
> parsed).
> As a result, package patching does not occur.
> 
> There are two solutions:
> - do not double the $$ here, so keep the originial PKGDIR=$(pkgdir)
> - use :=, so PKGDIR:=$(pkgdir)
> 
> I feel that if we take the first alternative, we should consistently
> use $(pkgdir) like that as it is less error-prone to have it as a
> general exception, than as an
> exception-only-if-you-pass-it-to-non-inner-rules.
> All of this is because the pkgdir variable is rather tricky.

 Okay, I agree: first option is the best one, and then we should use it
everywhere for pkgdir. Also, for pkgdir, not delaying expansion (i.e. single-$)
can never be incorrect. Same goes for pkgname, obviously. Which matches your
earlier observation that pkgname is special.

 Can you add an explanation about this in the leading comment of
inner-generic-package?


 Regards,
 Arnout

> 
> Thanks,
> Thomas
> 


-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

  reply	other threads:[~2014-05-22  0:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-12 14:44 [Buildroot] [PATCH 0 of 7 v2] infra: fix dollar signs; remove some undefined versions Thomas De Schampheleire
2014-05-12 14:44 ` [Buildroot] [PATCH 1 of 7 v2] infra: consistently use double dollar signs inside inner-xxx-targets Thomas De Schampheleire
2014-05-13  9:25   ` Arnout Vandecappelle
2014-05-13 10:59     ` Thomas De Schampheleire
2014-05-13 19:33       ` Arnout Vandecappelle
2014-05-21 13:14     ` Thomas De Schampheleire
2014-05-22  0:02       ` Arnout Vandecappelle [this message]
2014-05-12 14:44 ` [Buildroot] [PATCH 2 of 7 v2] infra: add comment describing single/double dollar-sign rules Thomas De Schampheleire
2014-05-12 14:44 ` [Buildroot] [PATCH 3 of 7 v2] pkg-virtual: simplify definition of FOO_VERSION to 'virtual' Thomas De Schampheleire
2014-05-12 14:44 ` [Buildroot] [PATCH 4 of 7 v2] toolchain/toolchain-buildroot: migrate to virtual package infrastructure Thomas De Schampheleire
2014-05-12 14:44 ` [Buildroot] [PATCH 5 of 7 v2] toolchain-external: change version from 'undefined' to 'virtual' Thomas De Schampheleire
2014-05-12 14:44 ` [Buildroot] [PATCH 6 of 7 v2] makedevs: change version from 'undefined' to 'buildroot-$(BR2_VERSION)' Thomas De Schampheleire
2014-05-12 14:44 ` [Buildroot] [PATCH 7 of 7 v2] 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=537D3E95.9080707@mind.be \
    --to=arnout@mind.be \
    --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