All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [RFC] Package infrastructure: make variables or make targets ?
Date: Thu, 29 Oct 2009 16:42:53 +0100	[thread overview]
Message-ID: <20091029164253.5ffa870c@surf> (raw)
In-Reply-To: <20091025224056.59c9a6ef@surf>

Hello,

Le Sun, 25 Oct 2009 22:40:56 +0100,
Thomas Petazzoni <thomas.petazzoni@free-electrons.com> a ?crit :

>  1. Use make variables, such as :

FWIW, since only Lionel gave his opinion and because as him I was more
convinced by make variables, I followed this path.

>     This approach is the one used by OpenWRT. The only drawback of
> this approach is that since the variables are defined *before* calling
>     the generating function $(eval $(call ...)), we don't have access
>     to any variable that could be defined by the generating function.
>     So, for example, the ICU_COMPILE variable must use
>     $(@D)/$(ICU_SUBDIR) as the directory for the sources, instead of
>     something like $(ICU_SRCDIR) that could be defined by the package
>     infrastructure. In OpenWRT, they solved this problem by having a
>     "include package.mk" after the package definition (name, version,
>     URL, etc.), but before the definition of the different steps. But
>     in our case, this means having two $(eval $(call ...)).

In fact this is not true. By escaping the variable expansions, it is
possible to post-pone the moment at which variables are expanded.

If you do :

======================================================================
define PKG_COMPILE
 make -C $($(PKG)_SRCDIR)
endef

$(eval $(call PKGTARGETS,package,foo,target))
======================================================================

Then it doesn't work since $(PKG)_SRCDIR is defined while evaluating
PKGTARGETS. But if you do:

======================================================================
define PKG_COMPILE
 make -C $$($$(PKG)_SRCDIR)
endef

$(eval $(call PKGTARGETS,package,foo,target))
======================================================================

Then things work as expected. Therefore, I've solved what I thought to
be the main drawback of the "make variables" solution, which is also
why I've choosen to go deeper into this direction.

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers and embedded Linux development,
consulting, training and support.
http://free-electrons.com

      parent reply	other threads:[~2009-10-29 15:42 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-25 21:40 [Buildroot] [RFC] Package infrastructure: make variables or make targets ? Thomas Petazzoni
2009-10-25 23:51 ` Lionel Landwerlin
2009-10-26  8:35   ` Thomas Petazzoni
2009-10-27  8:06 ` Thomas Petazzoni
2009-10-29 15:39   ` Thomas Petazzoni
2009-10-29 17:11     ` H Hartley Sweeten
2009-10-29 21:01       ` Lionel Landwerlin
2009-10-29 17:41     ` Will Newton
2009-11-02 23:24     ` Thomas Petazzoni
2009-11-03  1:14       ` Lionel Landwerlin
2009-11-03  8:15         ` Thomas Petazzoni
2009-11-01 21:26   ` Lionel Landwerlin
2009-11-03  8:14     ` Thomas Petazzoni
2009-11-03 14:01       ` Lionel Landwerlin
2009-10-29 15:42 ` Thomas Petazzoni [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=20091029164253.5ffa870c@surf \
    --to=thomas.petazzoni@free-electrons.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.