What does PWD = $${PWDCMD-pwd} do in make?

Zack Weinberg zack@codesourcery.com
Thu Jul 3 16:57:00 GMT 2003


"H. J. Lu" <hjl@lucon.org> writes:

> On Wed, Jul 02, 2003 at 06:13:03PM -0700, Roland McGrath wrote:
>> > Hi Roland,
>> > 
>> > I have a strange make related problem. In gcc, there is
>> > 
>> > PWD = $${PWDCMD-pwd}
>> 
>> This is surely ill-advised, but what it means is clear enough.
>> $$ means a literal $, and make has nothing more to do with this.
>> If this string is used in a sh command, then ${PWDCMD-pwd} is
>> sh syntax meaning $PWDCMD if that's defined and pwd otherwise.
...

I don't think there's any reason why we couldn't change this to read

PWDCMD = $${PWDCMD-pwd}

and change all uses of ${PWD} to ${PWDCMD}.  Anyone know different?
Would this solve the problem you are seeing?

zw



More information about the Gcc mailing list