[Top][All Lists]

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

Re: [BUG] --warn-undefined-variable is not triggered in prerequisites

From: Alejandro Colomar (man-pages)
Subject: Re: [BUG] --warn-undefined-variable is not triggered in prerequisites
Date: Fri, 28 Jan 2022 23:55:28 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.1

Hi Paul,

On 1/28/22 23:49, Paul Smith wrote:
> On Fri, 2022-01-28 at 01:09 +0100, Alejandro Colomar (man-pages) wrote:
>> I'd like make to warn about this.  It took me a while to debug 
>> a Makefile bug, which I thought was not happening, since make should
>> have warned me.  Isn't this supposed to trigger the warning?
> In previous versions of GNU make, the value of MAKEFLAGS set inside a
> makefile is only re-parsed once before all makefiles are read (from the
> environment) and again after all makefiles are read.
> So, changes to this variable within the makefile don't take effect
> until after all makefiles are parsed.  In your situation the variable
> in question is part of a prerequisite list and that's expanded while
> parsing the makefile, so the option is not set yet and you don't get
> warnings.  Undefined variables used in a recipe WOULD be warned about
> since recipes are expanded after all makefiles are parsed.
> To make this option do what you want you must pass it in either via the
> command line:
>    $ make --warn-undefined-variables
> or the environment:
>    $ MAKEFLAGS=--warn-undefined-variables make
> or:
>    $ GNUMAKEFLAG=--warn-undefined-variables make
> In the next release of GNU make, this has been changed; from the NEWS
> file:
> * If the MAKEFLAGS variable is modified in a makefile, it will be re-parsed
>   immediately rather than after all makefiles have been read.  Note that
>   although all options are parsed immediately, some special effects won't
>   appear until after all makefiles are read.

Sounds like good news :)

I'll be waiting for that release!



Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/

reply via email to

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