Paul Smith via austin-group-l at The Open Group <austin-group-l@opengroup.org> 
wrote:

> On Thu, 2020-11-05 at 09:25 +0000, Geoff Clare via austin-group-l at
> The Open Group wrote:
> > That doesn't make any difference, since .c and .o are both in the
> > specified suffixes, so that brings the default .c.o rule into play.
>
> Hm.  Right, I forgot that clearing the suffixes doesn't also delete the
> rules.  It's annoying that there's no POSIX way to delete the default
> rules from within the makefile.

There is no need to do that.

In former times, there was no way to clear .SUFFIXES, but at that time, SunOS 
defined default rules that look this way:

SUFFIXES= .o .c ...
.SUFFIXES: $(SUFFIXES)

so you could clear it by overwriting the SUFFIXES variable from your user 
makefile.

Now POSIX requires that writing:

.SUFFIXES:

into a Makefile clears the suffix list and thus effectively disables all default
implicit rules.

If you only like the .c.o rule but are not happy with the builtin default rule 
for e.g. .c.o:, you can overwrite it by e.g. writing:

.SUFFIXES:
.SUFFIXES: .o .c
.c.o:
        echo foo

In other words, a users makefile has full control over the "builtin" default 
rules even without a need to use "make -r".

> In my opinion the -r option is wrong.  Whether or not the default rules
> should be used is a function of the _makefile_, not a function of the
> _user_ of the makefile (the person who runs make).  If the makefile is
> written so that it doesn't want or need the default rules then the
> makefile should be able to delete them.  It shouldn't be up to the
> invoker of make to do that.

Well GNU make makes the mistake to define pattern matching implicit rules in 
its default rules and this causes the following problems:

-       pattern matching rules have precedence over suffix rules and may 
        themselves not be overwritten

-       pattern matching rules match in the order of their apperance to the
        parser. The first pattern rule that matches a specific pattern is 
        used. Later specifying a replacement rule for a specific pattern is
        impossible.

-       The built in default rules must to be "read" by make before the users
        makefiles are parsed in order to allow them (the suffix rules) to be
        overwritten. Any pattern matching rule that appears in the builtin 
        default rules thus would have precedence over anything else and cannot
        be overwritten.

For this reason, SunPro Make intentionally does not make use of pattern 
matching rules in the builtin default rules in order to permit the user to 
have full control over the behavior of make without a need to call "make -r".

Jörg

-- 
 EMail:jo...@schily.net                    (home) Jörg Schilling D-13353 Berlin
                                              Blog: http://schily.blogspot.com/
 URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'

            • ... Geoff Clare via austin-group-l at The Open Group
              • ... Paul Smith via austin-group-l at The Open Group
  • [Issue 8 dra... Austin Group Bug Tracker via austin-group-l at The Open Group
  • [Issue 8 dra... Austin Group Bug Tracker via austin-group-l at The Open Group
    • Re: [Is... Geoff Clare via austin-group-l at The Open Group
      • Re:... Joerg Schilling via austin-group-l at The Open Group
        • ... Paul Smith via austin-group-l at The Open Group
      • Re:... Paul Smith via austin-group-l at The Open Group
        • ... Geoff Clare via austin-group-l at The Open Group
          • ... Paul Smith via austin-group-l at The Open Group
            • ... Joerg Schilling via austin-group-l at The Open Group
              • ... Paul Smith via austin-group-l at The Open Group
              • ... Joerg Schilling via austin-group-l at The Open Group
              • ... Paul Smith via austin-group-l at The Open Group
              • ... Geoff Clare via austin-group-l at The Open Group
              • ... Joerg Schilling via austin-group-l at The Open Group
              • ... Geoff Clare via austin-group-l at The Open Group
              • ... Joerg Schilling via austin-group-l at The Open Group
              • ... Paul Smith via austin-group-l at The Open Group
          • ... Paul Smith via austin-group-l at The Open Group
            • ... Geoff Clare via austin-group-l at The Open Group

Reply via email to