Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Arnout Vandecappelle <arnout@mind.be>
To: buildroot@busybox.net
Subject: [Buildroot] pkg-generic.mk question
Date: Fri, 11 Jan 2013 13:53:02 +0100	[thread overview]
Message-ID: <50F00B2E.5080900@mind.be> (raw)
In-Reply-To: <F9C551623D2CBB4C9488801D14F864C610B9E3A3@ex-mb1.corp.adtran.com>

On 01/10/13 19:58, ANDY KENNEDY wrote:
> All,
>
> Consider the following (from pkg-generic.mk):
>
> define inner-generic-package
>
> <snip>
>
> $(2)_TYPE                       =  $(5)
>
> <snip>
>
> $(2)_DIR        =  $$(BUILD_DIR)/$$($(2)_BASE_NAME)
>
>
> The<PKG>_TYPE is set to "$" (5), however, the<PKG>_DIR is set to
> "$$" (BUILD_DIR)/$$<the rest>.  My question is why the need for the $$
> for BUILD_DIR?  I THINK I understand the reason for the
> $$($(2)_BASE_NAME):  The eval will boil this down to $(<PKG>_BASE_NAME),
> which will the get POST interrupted AFTER<PKG>_BASE_NAME is assigned
> LATER, right?
>
> But, I'm confused as to the reason for the $$(BUILD_DIR).  It is
> assigned well before the reading of this file and is essentially a
> static variable.

  AFAICS, there is no specific reason to do that, except for consistency. 
It is quite difficult to understand what is hapening with these make 
functions, and things become easier if you just follow the rule: 
everything should be $$(...), except for the function arguments.

  Note that the real question should be: why is $$(...) used for 
BUILD_DIR, but $(...) for the patsubst in $(2)_RAWNAME? Because that 
really is inconsistent.

  A potential reason to really use $$ instead of $ is to allow for late 
evaluation. It makes it possible, for instance, to override the BUILD_DIR 
in a rule variable.


  Regards,
  Arnout


>
> NOTE:  This question is for my own edification and learning.  I'm not
> questioning the ability/logic of this Makefile as I know it works
> perfectly.  I'm attempting to do something similar in a Makefile of my
> own.
>
> Thanks in advance for the information!
>
> Andy
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
>


-- 
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:[~2013-01-11 12:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-10 18:58 [Buildroot] pkg-generic.mk question ANDY KENNEDY
2013-01-11 12:53 ` Arnout Vandecappelle [this message]

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=50F00B2E.5080900@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