[Top][All Lists]

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


From: Bruno Haible
Subject: Re: MAKEFLAGS=-r
Date: Mon, 17 Jul 2023 11:45:04 +0200

Dmitry Goncharov wrote:
> Once the makefile author knows the makefile does not need built-in
> rules, they should add MAKEFLAGS=-r in the makefile and
> this will do a good service to all their users.

The premise "does not need built-in rules" is likely true for most Makefiles
generated by GNU Automake, because
  - GNU Automake generates its own rules already,
  - Whenever rules are executed that don't obey the variables listed in [1],
    such as CPPFLAGS, it is a bug that the package's user should rightfully

So I wondered whether I should add this variable definition in the Makefile.am
files of my GNU packages. But then I read this in the documentation [2]:

  "you should be sure not to include any options that will drastically
   affect the actions of make"


  "It’s best to use GNUMAKEFLAGS only with flags which won’t materially
   change the behavior of your makefiles."

and this on stackoverflow [3]:

  "You shouldn't set MAKEFLAGS at all. ...
   MAKEFLAGS is intended, really, to be an internal implementation passing
   arguments from a parent make to a child make. It's not intended,
   generally, to be modified by a makefile."

and this in Oracle's documentation [4]:

  "Do not define MAKEFLAGS in your makefiles."

And finally, MAKEFLAGS is not even mentioned in the main index of the GNU Make
documentation [5], and only regarding "recursion" in the Variables index [6].

> The manual should lead by example.

Yes, I agree. But if the example contradicts all the advice given in the rest
of the manual and elsewhere, I will certainly not use it in my Makefiles.

Also, what the example did not tell me: If a Makefile uses MAKEFLAGS=-r and
the Makefile in a subdirectory needs built-in rules, will the MAKEFLAGS=-r
setting propagate to the subdirectory? In other words, is it a good idea
to use MAKEFLAGS=-r in Makefiles that recurse to other Makefiles (and that
are maintained independently)?


[3] https://stackoverflow.com/questions/19611004/
[4] https://docs.oracle.com/cd/E19504-01/802-5880/make-65/index.html

reply via email to

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