anything special about "." prefixed targets other than default?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

anything special about "." prefixed targets other than default?

Robert P. J. Day-2

  i'm looking at someone else's Makefile, and it is replete with
targets whose names begin with a period. i'm aware of the property
that such targets will not be considered as the default, but once you
define a few early targets, is there any value in continuing to have
period-prefixed targets?

  in this Makefile, there are a number of "paired" targets such as:

  clean_mystuff:
  .clean_mystuff_fail:

which seems to suggest some kind of pattern, but i have no idea what
it might be.

rday

--

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                         http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: anything special about "." prefixed targets other than default?

Paul Smith-20
On Fri, 2019-10-11 at 10:18 -0400, Robert P. J. Day wrote:

>   i'm looking at someone else's Makefile, and it is replete with
> targets whose names begin with a period. i'm aware of the property
> that such targets will not be considered as the default, but once you
> define a few early targets, is there any value in continuing to have
> period-prefixed targets?
>
>   in this Makefile, there are a number of "paired" targets such as:
>
>   clean_mystuff:
>   .clean_mystuff_fail:
>
> which seems to suggest some kind of pattern, but i have no idea what
> it might be.

make itself doesn't treat targets starting with '.' any differently;
this must be a coding convention for these makefiles specifically.

I will point out that POSIX reserves all target names beginning with
'.' followed by uppercase letters as reserved for implementations so
it's probably a good idea to not use target names like that in your
makefiles.


_______________________________________________
Help-make mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-make
Reply | Threaded
Open this post in threaded view
|

Re: anything special about "." prefixed targets other than default?

Robert P. J. Day-2
On Fri, 11 Oct 2019, Paul Smith wrote:

> On Fri, 2019-10-11 at 10:18 -0400, Robert P. J. Day wrote:
> >   i'm looking at someone else's Makefile, and it is replete with
> > targets whose names begin with a period. i'm aware of the property
> > that such targets will not be considered as the default, but once you
> > define a few early targets, is there any value in continuing to have
> > period-prefixed targets?
> >
> >   in this Makefile, there are a number of "paired" targets such as:
> >
> >   clean_mystuff:
> >   .clean_mystuff_fail:
> >
> > which seems to suggest some kind of pattern, but i have no idea what
> > it might be.
>
> make itself doesn't treat targets starting with '.' any differently;
> this must be a coding convention for these makefiles specifically.

  apparently, after further investigation, this is exactly what it is
... an internal convention for targets that are not meant to be called
directly by the user. is that a well-known idiom?

rday

--

========================================================================
Robert P. J. Day                                 Ottawa, Ontario, CANADA
                         http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

Reply | Threaded
Open this post in threaded view
|

Re: anything special about "." prefixed targets other than default?

Paul Smith-20
On Sat, 2019-11-02 at 06:01 -0400, Robert P. J. Day wrote:

> > >    in this Makefile, there are a number of "paired" targets such as:
> > >
> > >    clean_mystuff:
> > >    .clean_mystuff_fail:
> > >
> > > which seems to suggest some kind of pattern, but i have no idea what
> > > it might be.
> >
> > make itself doesn't treat targets starting with '.' any differently;
> > this must be a coding convention for these makefiles specifically.
>
>   apparently, after further investigation, this is exactly what it is
> ... an internal convention for targets that are not meant to be called
> directly by the user. is that a well-known idiom?

I think it is just an extension of the fact that make uses targets starting
with "." as its built-in targets.  I can't really say if it qualifies as
"well-known", but it's not unheard of.

Note, however, that POSIX reserves some part of the ".<target>" namespace
as described in the spec:

> Targets with names consisting of a leading <period> followed by the
> uppercase letters "POSIX" and then any other characters are reserved for
> future standardization. Targets with names consisting of a leading
> <period> followed by one or more uppercase letters are reserved for
> implementation extensions.

so you shouldn't infringe on that (the above is fine since it uses
lowercase letters).