public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
* How to share variables with a sub-make command in a Kbuild Makefile?
@ 2013-02-09 16:34 Joel A Fernandes
  2013-02-09 16:42 ` Joel A Fernandes
  2013-02-21 23:01 ` Michal Marek
  0 siblings, 2 replies; 3+ messages in thread
From: Joel A Fernandes @ 2013-02-09 16:34 UTC (permalink / raw)
  To: linux-kbuild

Hi,
I am trying to create a patch that involves a call to a submake and
sharing a variable with it.

The the top level Makefile is arch/arm/Makefile and has something like:
dtbs: scripts
   $(Q)$(MAKE) -e $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs
   # Make use of share-var modified by the submake
   echo $(share-var)

In the sub-make Makefile, I want to modify a variable and have it
reflect in the top Makefile
dtbs: $(addprefix $(obj)/, $(dtb-y))
   $(Q)rm -f $(obj)/../*.dtb
   share-var += "new stuff"

I tried exporting share-var from the top-level Makefile but it doesn't work.
Is there an easy way to do this?
How does the kernel do it with obj-y variables where it recursively
has the variable updated?

The reason I need this variable in the top-level Makefile is because
there are other targets in the top-level Makefile (arch/arm/Makefile)
that need access to this variable for its purpose.

Thanks in advance,
  Joel Fernandes

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to share variables with a sub-make command in a Kbuild Makefile?
  2013-02-09 16:34 How to share variables with a sub-make command in a Kbuild Makefile? Joel A Fernandes
@ 2013-02-09 16:42 ` Joel A Fernandes
  2013-02-21 23:01 ` Michal Marek
  1 sibling, 0 replies; 3+ messages in thread
From: Joel A Fernandes @ 2013-02-09 16:42 UTC (permalink / raw)
  To: linux-kbuild

Per the Mailing list FAQ, I would like to indicate that I prefer to be
CC'd on replies, thanks.

Thanks,
  Joel Fernandes

On Sat, Feb 9, 2013 at 10:34 AM, Joel A Fernandes <agnel.joel@gmail.com> wrote:
> Hi,
> I am trying to create a patch that involves a call to a submake and
> sharing a variable with it.
>
> The the top level Makefile is arch/arm/Makefile and has something like:
> dtbs: scripts
>    $(Q)$(MAKE) -e $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs
>    # Make use of share-var modified by the submake
>    echo $(share-var)
>
> In the sub-make Makefile, I want to modify a variable and have it
> reflect in the top Makefile
> dtbs: $(addprefix $(obj)/, $(dtb-y))
>    $(Q)rm -f $(obj)/../*.dtb
>    share-var += "new stuff"
>
> I tried exporting share-var from the top-level Makefile but it doesn't work.
> Is there an easy way to do this?
> How does the kernel do it with obj-y variables where it recursively
> has the variable updated?
>
> The reason I need this variable in the top-level Makefile is because
> there are other targets in the top-level Makefile (arch/arm/Makefile)
> that need access to this variable for its purpose.
>
> Thanks in advance,
>   Joel Fernandes

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to share variables with a sub-make command in a Kbuild Makefile?
  2013-02-09 16:34 How to share variables with a sub-make command in a Kbuild Makefile? Joel A Fernandes
  2013-02-09 16:42 ` Joel A Fernandes
@ 2013-02-21 23:01 ` Michal Marek
  1 sibling, 0 replies; 3+ messages in thread
From: Michal Marek @ 2013-02-21 23:01 UTC (permalink / raw)
  To: Joel A Fernandes; +Cc: linux-kbuild

On 9.2.2013 17:34, Joel A Fernandes wrote:
> Hi,
> I am trying to create a patch that involves a call to a submake and
> sharing a variable with it.
> 
> The the top level Makefile is arch/arm/Makefile and has something like:
> dtbs: scripts
>    $(Q)$(MAKE) -e $(build)=$(boot)/dts MACHINE=$(MACHINE) dtbs
>    # Make use of share-var modified by the submake
>    echo $(share-var)
> 
> In the sub-make Makefile, I want to modify a variable and have it
> reflect in the top Makefile
> dtbs: $(addprefix $(obj)/, $(dtb-y))
>    $(Q)rm -f $(obj)/../*.dtb
>    share-var += "new stuff"

This is not possible, because we run a separate make process for every
subdirectory.

Michal


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-02-21 23:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-09 16:34 How to share variables with a sub-make command in a Kbuild Makefile? Joel A Fernandes
2013-02-09 16:42 ` Joel A Fernandes
2013-02-21 23:01 ` Michal Marek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox