mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] Problem with variable reference in Makefiles
@ 2013-10-29 14:37 Richard Günther
  2013-10-29 14:49 ` Andreas Bießmann
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Günther @ 2013-10-29 14:37 UTC (permalink / raw)
  To: ptxdist

[-- Attachment #1: Type: text/plain, Size: 1000 bytes --]

Hi,

I am having problems with Makefiles in which I am referring to variables that are defined in other Makefiles. Sometimes it is working and I get the correct value, but for some packages I am getting an empty string. 

So for testing I set up two identical packages "automoddel" and "automaddel" (see attachment).  The only difference is the "a" and the "o", everything else is 100% the same. Then in another Makefile I refer to variables of these packages like this:

TEST1 := $(AUTOMADDEL_VERSION)
TEST2 := $(AUTOMODDEL_VERSION)

Now the curious thing is that "TEST1" contains the correct version "trunk", but "TEST2" is contains an empty string:

"ptxdist print TEST1" returns: trunk
"ptxdist print TEST2" returns:               (nothing)

If I change := to = the problem is gone, but that still not explains why the := assignment is working for one package but not for another.
Maybe someone has a clue about that? I am using ptxdist-2011.09.0.

Thanks in advance, 
Richard

[-- Attachment #2: automaddel.make --]
[-- Type: application/octet-stream, Size: 2262 bytes --]

# -*-makefile-*-
#
# Copyright (C) 2012 by Tim Jaacks <tim.jaacks@garz-fricke.com>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
PACKAGES-$(PTXCONF_AUTOMADDEL) += automaddel

#
# Paths and names
#
AUTOMADDEL_VERSION	:= trunk
AUTOMADDEL 			:= automaddel
AUTOMADDEL_SUFFIX	:=
AUTOMADDEL_URL		:= file://$(PTXDIST_WORKSPACE)/local_src/automaddel
AUTOMADDEL_SRCDIR 	:= $(PTXDIST_WORKSPACE)/local_src/$(AUTOMADDEL)
AUTOMADDEL_DIR		:= $(BUILDDIR)/$(AUTOMADDEL)
AUTOMADDEL_LICENSE	:= unknown

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

$(STATEDIR)/automaddel.extract:
	@$(call targetinfo)
	@$(call touch)

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

$(STATEDIR)/automaddel.prepare:
	@$(call targetinfo)
	@$(call touch)

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

$(STATEDIR)/automaddel.compile:
	@$(call targetinfo)
	@$(call touch)

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

$(STATEDIR)/automaddel.install:
	@$(call targetinfo)
	@$(call touch)

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

$(STATEDIR)/automaddel.targetinstall:
	@$(call targetinfo)

	@$(call install_init,  automaddel)
	@$(call install_fixup, automaddel, PRIORITY, optional)
	@$(call install_fixup, automaddel, VERSION, AUTOMADDEL_VERSION)
	@$(call install_fixup, automaddel, SECTION, base)
	@$(call install_fixup, automaddel, AUTHOR, "Tim Jaacks <tim.jaacks@garz-fricke.com>")
	@$(call install_fixup, automaddel, DESCRIPTION, missing)

	@$(call install_finish, automaddel)
	@$(call touch)

# vim: syntax=make

[-- Attachment #3: automoddel.make --]
[-- Type: application/octet-stream, Size: 2262 bytes --]

# -*-makefile-*-
#
# Copyright (C) 2012 by Tim Jaacks <tim.jaacks@garz-fricke.com>
#
# See CREDITS for details about who has contributed to this project.
#
# For further information about the PTXdist project and license conditions
# see the README file.
#

#
# We provide this package
#
PACKAGES-$(PTXCONF_AUTOMODDEL) += automoddel

#
# Paths and names
#
AUTOMODDEL_VERSION	:= trunk
AUTOMODDEL 			:= automoddel
AUTOMODDEL_SUFFIX	:=
AUTOMODDEL_URL		:= file://$(PTXDIST_WORKSPACE)/local_src/automoddel
AUTOMODDEL_SRCDIR 	:= $(PTXDIST_WORKSPACE)/local_src/$(AUTOMODDEL)
AUTOMODDEL_DIR		:= $(BUILDDIR)/$(AUTOMODDEL)
AUTOMODDEL_LICENSE	:= unknown

# ----------------------------------------------------------------------------
# Extract
# ----------------------------------------------------------------------------

$(STATEDIR)/automoddel.extract:
	@$(call targetinfo)
	@$(call touch)

# ----------------------------------------------------------------------------
# Prepare
# ----------------------------------------------------------------------------

$(STATEDIR)/automoddel.prepare:
	@$(call targetinfo)
	@$(call touch)

# ----------------------------------------------------------------------------
# Compile
# ----------------------------------------------------------------------------

$(STATEDIR)/automoddel.compile:
	@$(call targetinfo)
	@$(call touch)

# ----------------------------------------------------------------------------
# Install
# ----------------------------------------------------------------------------

$(STATEDIR)/automoddel.install:
	@$(call targetinfo)
	@$(call touch)

# ----------------------------------------------------------------------------
# Target-Install
# ----------------------------------------------------------------------------

$(STATEDIR)/automoddel.targetinstall:
	@$(call targetinfo)

	@$(call install_init,  automoddel)
	@$(call install_fixup, automoddel, PRIORITY, optional)
	@$(call install_fixup, automoddel, VERSION, AUTOMODDEL_VERSION)
	@$(call install_fixup, automoddel, SECTION, base)
	@$(call install_fixup, automoddel, AUTHOR, "Tim Jaacks <tim.jaacks@garz-fricke.com>")
	@$(call install_fixup, automoddel, DESCRIPTION, missing)

	@$(call install_finish, automoddel)
	@$(call touch)

# vim: syntax=make

[-- Attachment #4: Type: text/plain, Size: 48 bytes --]

-- 
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] Problem with variable reference in Makefiles
  2013-10-29 14:37 [ptxdist] Problem with variable reference in Makefiles Richard Günther
@ 2013-10-29 14:49 ` Andreas Bießmann
  0 siblings, 0 replies; 5+ messages in thread
From: Andreas Bießmann @ 2013-10-29 14:49 UTC (permalink / raw)
  To: ptxdist

Dear Richard Günther,

Am 2013-10-29 15:37, schrieb Richard Günther:
> Hi,
> 
> I am having problems with Makefiles in which I am referring to
> variables that are defined in other Makefiles. Sometimes it is working
> and I get the correct value, but for some packages I am getting an
> empty string.
> 
> So for testing I set up two identical packages "automoddel" and
> "automaddel" (see attachment).  The only difference is the "a" and the
> "o", everything else is 100% the same. Then in another Makefile I
> refer to variables of these packages like this:
> 
> TEST1 := $(AUTOMADDEL_VERSION)
> TEST2 := $(AUTOMODDEL_VERSION)
> 
> Now the curious thing is that "TEST1" contains the correct version
> "trunk", but "TEST2" is contains an empty string:
> 
> "ptxdist print TEST1" returns: trunk
> "ptxdist print TEST2" returns:               (nothing)
> 
> If I change := to = the problem is gone, but that still not explains
> why the := assignment is working for one package but not for another.
> Maybe someone has a clue about that? I am using ptxdist-2011.09.0.

It has nothing to do with ptxdist, it is make related. Please read [1] 
to understand the difference between '=' and ':=' assignment.

The difference of TEST1 and TEST2 is the 'A' vs. 'O'. Have you tried to 
add for example AUTOMBDDEL or AAUTOMADDEL?

Best regards

Andreas Bießmann

[1] http://www.gnu.org/software/make/manual/make.html#Reading-Makefiles


-- 
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] Problem with variable reference in Makefiles
@ 2013-10-31  9:21 Richard Günther
  0 siblings, 0 replies; 5+ messages in thread
From: Richard Günther @ 2013-10-31  9:21 UTC (permalink / raw)
  To: Jürgen Beisert

Dear Juergen,

> The tool 'make' includes all rule files in a specific order. And I guess also the locale has some effect on this order. But PTXdist ensures the local > is set to 'C'.
> 
> Did you only try with different _variable_ names or with different _rule_file_ names as well?

I tried with different rule-file names in the project-specific rules directory as well. I used the following lines for testing:

TEST1 := $(AUTOMADDEL_VERSION)	(automaddel.make  is in the project-specific rules directory)
TEST2 := $(AUTOMODDEL_VERSION)	(automoddel.make   is in the project-specific rules directory)
TEST3 := $(XORG_SERVER_VERSION)	(xorg-server.make  is in the ptxdist default rules directory)

I put the three lines into Makefiles in my project-specific rules directory and got the following results:
- busybox.make: all variables TEST1, TEST2 and TEST3 are empty.
-  shiboken.make: TEST1 contains the correct value, TEST2 is empty, and TEST3 contains the correct value.
- xconfig.make: all variables TEST1, TEST2 and TEST3 are empty 

Regards,
Richard  
-- 
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] Problem with variable reference in Makefiles
  2013-10-31  7:35 Richard Günther
@ 2013-10-31  8:07 ` Jürgen Beisert
  0 siblings, 0 replies; 5+ messages in thread
From: Jürgen Beisert @ 2013-10-31  8:07 UTC (permalink / raw)
  To: ptxdist; +Cc: Richard Günther

Hi Richard,

On Thursday 31 October 2013 08:35:21 Richard Günther wrote:
> > It has nothing to do with ptxdist, it is make related. Please read [1] to
> > understand the difference between '=' and ':=' assignment.
> >
> > The difference of TEST1 and TEST2 is the 'A' vs. 'O'. Have you tried to
> > add for example AUTOMBDDEL or AAUTOMADDEL?
>
> Thank you, now the difference between := and = is clear to me.
>
> I tried with "AUTOMBDDEL" and "AAUTOMADDEL" but they both did not work. I
> also tried using a variable from "XORG_SERVER" which worked very well. It
> is kind of strange, but not a major problem though. I just thought someone
> would know about the problem or has a clue what is causing this.

The tool 'make' includes all rule files in a specific order. And I guess also 
the locale has some effect on this order. But PTXdist ensures the local is set 
to 'C'.

Did you only try with different _variable_ names or with different _rule_file_ 
names as well?

Regards,
Juergen

-- 
Pengutronix e.K.                              | Juergen Beisert             |
Linux Solutions for Science and Industry      | http://www.pengutronix.de/  |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

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

* Re: [ptxdist] Problem with variable reference in Makefiles
@ 2013-10-31  7:35 Richard Günther
  2013-10-31  8:07 ` Jürgen Beisert
  0 siblings, 1 reply; 5+ messages in thread
From: Richard Günther @ 2013-10-31  7:35 UTC (permalink / raw)
  To: ptxdist

> It has nothing to do with ptxdist, it is make related. Please read [1] to understand the difference between '=' and ':=' assignment.
> 
> The difference of TEST1 and TEST2 is the 'A' vs. 'O'. Have you tried to add for example AUTOMBDDEL or AAUTOMADDEL?
> 
> Best regards
> 
> Andreas Bießmann
> 
> [1] http://www.gnu.org/software/make/manual/make.html#Reading-Makefiles
> 
> 
> --
> ptxdist mailing list
> ptxdist@pengutronix.de

Dear Andreas Bießmann,

Thank you, now the difference between := and = is clear to me. 

I tried with "AUTOMBDDEL" and "AAUTOMADDEL" but they both did not work. I also tried using a variable from "XORG_SERVER" which worked very well. It is kind of strange, but not a major problem though. I just thought someone would know about the problem or has a clue what is causing this.

Regards, 
Richard Günther
-- 
ptxdist mailing list
ptxdist@pengutronix.de

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

end of thread, other threads:[~2013-10-31 10:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-29 14:37 [ptxdist] Problem with variable reference in Makefiles Richard Günther
2013-10-29 14:49 ` Andreas Bießmann
2013-10-31  7:35 Richard Günther
2013-10-31  8:07 ` Jürgen Beisert
2013-10-31  9:21 Richard Günther

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