bug-make
[Top][All Lists]
Advanced

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

Re: disabling the built-in rules


From: Bruno Haible
Subject: Re: disabling the built-in rules
Date: Mon, 17 Jul 2023 18:49:27 +0200

Paul Smith wrote:
> I do not
> usually recommend this method of clearing the default rules.  There are
> issues with modifying MAKEFLAGS, especially with some older versions of
> GNU Make.  And also, in some older versions setting MAKEFLAGS in the
> makefile doesn't actually take effect anyway: it only helps for sub-
> makes.

Thanks for the clarification.

> My recommendation has been to disable the built-in rules directly, if
> you don't need them.  For example you can use:
> 
>   .SUFFIXES:
> 
> to disable most of the built in rules (this is a POSIX standard
> facility so it's helpful even for other versions of make).

That's nice, because as a developer I don't want to have to test my
Makefiles with GNU make and with non-GNU make separately.

> Unfortunately that doesn't fix all problems because GNU Make also has a
> few built-in rules that are defined using pattern rules (because suffix
> rules are not powerful enough).  So a full list of "turn it all off"
> would be this:
> 
>   .SUFFIXES:
>   %:: %,v
>   %:: RCS/%,v
>   %:: RCS/%
>   %:: s.%
>   %:: SCCS/s.%
> 
> Hopefully these are just considered funnily-named targets and won't
> hurt anything, when used in non-GNU Make versions of make.
> 
> I admit this is annoying since it's possible that the catalog of built-
> in rules could change in the future.

It's also annyoing because it does not work portably: On FreeBSD and NetBSD,
'make' gives an error:

  make: don't know how to make %,v. Stop

Similarly on OpenBSD:

  make: don't know how to make %,v (prerequisite of: %)

Can we get a syntax to clear all built-in rules that works portably?
For example, such as:

  .SUFFIXES:
  .GNUSUFFIXES:

Bruno






reply via email to

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