[Top][All Lists]

[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: Paul Smith
Subject: Re: how to create a single rule to build a directory as necessary
Date: Tue, 22 Sep 2009 15:43:25 -0400

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.

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%

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.

While "gllib" vs. "$@" is just a preference, use of the $(MAKE) variable
instead of "make" IS 100% portable and must ALWAYS be used if you want
your recursive make environment to work correctly.  This is not really

reply via email to

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