Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
help about usage of $(P) variable in Makefiles
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
dca
n00b
n00b


Joined: 24 Jan 2003
Posts: 7

PostPosted: Fri Jan 24, 2003 4:37 pm    Post subject: help about usage of $(P) variable in Makefiles Reply with quote

I traced down my problem with the mpich installation failure to the following:
Some of the Makefiles in the mpich subdirectories contain the line "default:$(P)" which I assume comes from autoconf/automake.

When running make, ebuild sets a number of environment variables, including P, which it sets to "mpich-1.2.4". This results in make trying to build the target mpich-1.2.4, which doesn't exist, and thus fails.

I did not find (yet) anything relevant describing the intended meaning of these variables whith short names in autoconf/automake (ebuild sets many others, like O, T, PN,...) and looking up '$(P)' in google is not especially useful.

Any info on these variables, or on the proper way to control them from ebuild ?

Thanks.
Back to top
View user's profile Send private message
474
l33t
l33t


Joined: 19 Apr 2002
Posts: 714

PostPosted: Fri Jan 24, 2003 7:02 pm    Post subject: Reply with quote

Have a look at this first: http://www.gentoo.org/doc/en/gentoo-howto.xml. There are certainly various variable names employed which aren't mentioned in that document. The thing is that you can pretty much do what you want in an ebuild provided it gets the job done as they are, basically, shell scripts. However, I suspect that there are some conventions which the developers try to adhere to. The gentoo-dev mailing list would probably be a really good place to enquire further (and a searchable archive is available too).

You can often deduce some of this information by looking at other ebuilds. If I recall correctly, PN is Product Name and, for example, can be used if it is necessary to separate the version number from the core product filename where the download filename string will be different from the ebuild naming scheme. But I don't think these things are enforced rules, merely techniques so in reality there is probably no "proper" way.

Your example is good; you make ${PN} = "mpich" and ${PV} = "1.2.4". Then you can concatenate the two when needed (${PN}-${PV}), or use either in the singular where necessary.
Back to top
View user's profile Send private message
pjp
Administrator
Administrator


Joined: 16 Apr 2002
Posts: 20067

PostPosted: Fri Jan 24, 2003 7:25 pm    Post subject: Reply with quote

Also handy is 'man 5 ebuild'
_________________
Quis separabit? Quo animo?
Back to top
View user's profile Send private message
474
l33t
l33t


Joined: 19 Apr 2002
Posts: 714

PostPosted: Fri Jan 24, 2003 7:27 pm    Post subject: Reply with quote

:D Bingo! Thanks a lot.
Back to top
View user's profile Send private message
dca
n00b
n00b


Joined: 24 Jan 2003
Posts: 7

PostPosted: Sat Jan 25, 2003 9:47 am    Post subject: Reply with quote

Yes, the P variable is mentioned in the HOWTO, but what I failed to see is that P is also used by automake generated makefiles.

I.e., not using ebuild, if I run 'make' in the top level dir of the mpich package, it compiles. If I type 'export P=mpich; make' if fails and complains that it doesn't know how to build the mpich target. Both ebuild and the makefile use P, but not necessarily in a consistent manner.

So my question was more about these special variables in automake makefiles than in ebuild. I've browsed the docs at http://www.gnu.org/manual/automake and didn't see anything. Probably missed it though.

Thanks.
Back to top
View user's profile Send private message
kutsuya
Retired Dev
Retired Dev


Joined: 21 Oct 2002
Posts: 189

PostPosted: Sat Jan 25, 2003 11:57 am    Post subject: The joy of configuration Reply with quote

dca wrote:

...
I.e., not using ebuild, if I run 'make' in the top level dir of the mpich package, it compiles. If I type 'export P=mpich; make' if fails and complains that it doesn't know how to build the mpich target. Both ebuild and the makefile use P, but not necessarily in a consistent manner.

So my question was more about these special variables in automake makefiles than in ebuild. I've browsed the docs at http://www.gnu.org/manual/automake and didn't see anything. Probably missed it though.

Thanks.


Hi,

I noticed a bug report on mpich. You might add your findings.

It's possible that $(P) is a BASH command.

Code:

#!/bin/bash

P()
{
    echo Hello
}

echo "This is a test: $(P)"


I wonder if it is possible that emerge exports P, and mpich uses P but doesn't reset it? If so, might need a diff that changes P to mpich_P? Just guessing.
_________________
--Kutsuya
Back to top
View user's profile Send private message
dca
n00b
n00b


Joined: 24 Jan 2003
Posts: 7

PostPosted: Sat Jan 25, 2003 4:38 pm    Post subject: Re: The joy of configuration Reply with quote

kutsuya wrote:


Hi,

It's possible that $(P) is a BASH command.

Code:

#!/bin/bash

P()
{
    echo Hello
}

echo "This is a test: $(P)"


I wonder if it is possible that emerge exports P, and mpich uses P but doesn't reset it? If so, might need a diff that changes P to mpich_P? Just guessing.


It's just that the mpich makefile (generated by autoconf/automake) contains a target like default: $(P) which introduces a dependency to whatever P is defined as.
I temporary fixed it by adding 'unset P' before the call to make in the ebuild file, but is the usage of P as a variable name by both ebuild and automake a simple coincidence ...
Back to top
View user's profile Send private message
kutsuya
Retired Dev
Retired Dev


Joined: 21 Oct 2002
Posts: 189

PostPosted: Sun Jan 26, 2003 1:20 am    Post subject: Re: The joy of configuration Reply with quote

dca wrote:

I temporary fixed it by adding 'unset P' before the call to make in the ebuild file, but is the usage of P as a variable name by both ebuild and automake a simple coincidence ...


I'm not aware of it happening before, which may not mean much. ;) You might try searching for that problem on the forum, bugs.gentoo.org, the gentoo mailing list, and maybe the ebuilds in portage.

Also you might think about filing a bug.
_________________
--Kutsuya
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum