Which manual says it is deprecated?
The gmake manual:

*> Suffix rules* are the old-fashioned way of defining implicit rules for |make|. Suffix rules are > obsolete because pattern rules are more general and clearer. They are supported in GNU |make
>| for compatibility with old makefiles.
(http://www.gnu.org/manual/make-3.79.1/html_mono/make.html#SEC106)

The .SUFFIXES directive tells gmake to discard the default rules listed.
From what I read, it says, the .SUFFIXES directive discards the default ruleset, only if
it is blanked.  Of course, you can use the directive more than once:

> You can add your own suffixes by writing a rule for |.SUFFIXES| that adds more prerequisites
[...]
> If you wish to eliminate the default known suffixes instead of just adding to them, write > a rule for |.SUFFIXES| with no prerequisites. By special dispensation, this eliminates all > existing prerequisites of |.SUFFIXES|. You can then write another rule to add the suffixes
> you want.

Otherwise, your new rules will be added to the default.  Which is usually not 
what you want.

I don't think so. I believe if you don't use .SUFFIXES to specifiy prequisites, then it will
interpret the suffix as if it were a filename.  (Again, I could be wrong.)

Note the .PHONY directive.  Without it, if you ever created a file
called, "jar" or "clean" inside the srcdir, then the "jar" or "clean"
targets wouldn't work (respectively).

This would seem to get out of hand if you had 10's of rules.

I guess the list could get rather long, but I can't think of a
better way.

For the clean directive, it's better to put a - before the $(RM), just
        ^^^^^^^^^^^^^^^
People call these 'rules'...Directives are like .ifeq, or .PHONY.
Basically, anything that starts with a period.

Oops.  You're right, of course.

In case you don't have any class files (- means make shouldn't care if
the command returns non-zero exit status.)  It actually doesn't matter
in the default case, I don't think, because $(RM) is normally expanded
to "rm -f".
It is safer to set RM yourself.

I agree. It's always a good idea to set all the variables you use, rather
than relying on defaults (which may change with new releases of gmake), but
I still think it's a good idea to add the preceding hyphen, just in case
the user running make overrides the value specified.

--Ray

Reply via email to