help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: how to create a single rule to build a directory as necessary


From: Sam Steingold
Subject: Re: how to create a single rule to build a directory as necessary
Date: Tue, 22 Sep 2009 16:15:49 -0400
User-agent: Thunderbird 2.0.0.22 (X11/20090625)

Paul Smith wrote:
On Tue, 2009-09-22 at 11:11 -0700, Philip Guenther wrote:
which by the way, is not well-formed; it should be:

       mkdir -p $@ && cd $@ && $(MAKE)
I am afraid I cannot use the "gnuisms" (as they were called by a
NetBSD user
who was bitten by these variables when I used them)
Whoever told you that is sadly mistaken.  The '@' and 'MAKE' variables
are both specified by the POSIX/SUS standard for make and were present
in 4.2 BSD!  It's handy to keep around a link to the standards
specification for quoting at people that are, uh, confused about
history and requirements.  Here's the link for 'make' from the Single
UNIX Standard, Issue 6.

http://www.opengroup.org/onlinepubs/009695399/utilities/make.html

The NetBSD user is definitely incorrect in calling these "GNUisms"; they
are part of the POSIX spec as you point out.

However, it is true that using $@ in they way I suggested is not 100%
portable.

In one of those bizarre brain-lapses that make you go "huh?", original
versions of make only defined automatic variables like $@ for implicit
(suffix) rules.  They were not defined for explicit rules.  Some
instances of make still do not support them in explicit rules, so
maximally portable makefiles can only use $@ in suffix rules.

this is precisely what the NetBSD user said.
sorry about the confusion.

actually, POSIX requires that $@ is defined for _all_ rules.
however, "The meaning of the $< macro shall be otherwise unspecified" - for non-inference rules, that is...





reply via email to

[Prev in Thread] Current Thread [Next in Thread]