bugmake - Bugs: bug #9060, --warn-undefined-variables

 
 

bug #9060: --warn-undefined-variables

Submitter:  Dave Yost <yost>
Submitted:  Sat 22 May 2004 05:11:02 PM UTC
Votes: 44
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.80 Operating System:  Any
Fixed Release:  4.4 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 04 Sep 2022 04:04:53 PM UTC, comment #7: 

Thank you! I shall look forward to this great improvement in the next release!

Stephen Niedzielski <niedzielski>
Sat 03 Sep 2022 10:42:22 PM UTC, comment #6: 

This was fixed as a partial change for bug #45211 (adding --warn-undefined-variables to MAKEFLAGS takes effect immediately).

Paul D. Smith <psmith>
Group administrator
Sat 03 Sep 2022 08:08:51 PM UTC, comment #5: 

Echoing past comments, this is both a very useful feature to have and currently a confusing behavior.

Stephen Niedzielski <niedzielski>
Sun 14 Sep 2014 01:39:52 PM UTC, comment #4: 

The way make currently works is that MAKEFLAGS is re-parsed only after all the makefiles have been read in and before make is about to start running recipes.  MAKEFLAGS is not reparsed immediately every time it's changes.  This leads to the behavior you're seeing, since undefined variables used during parsing won't be flagged.

I don't know if it's so simple to simply have some special code that looks for setting the MAKEFLAGS variable and does a re-parse every time; I'm not sure all the flags in MAKEFLAGS are idempotent so parsing them multiple times might lead to problems.  This would need to be checked carefully.

Paul D. Smith <psmith>
Group administrator
Sun 14 Sep 2014 08:39:52 AM UTC, comment #3: 

Specifying MAKEFLAGS += --warn-undefined-variables within a Makefile is not equivalent to specifying the same option on the command-line.

Test case:

MAKEFLAGS += --warn-undefined-variables
$(foo):
@echo foo
bar:
@echo $(bar)

This bug has a long history of confusing users:
http://lists.gnu.org/archive/html/bug-make/2002-08/msg00063.html
http://lists.gnu.org/archive/html/bug-make/2003-04/msg00015.html
http://lists.gnu.org/archive/html/help-make/2011-06/msg00027.html
http://lists.gnu.org/archive/html/help-make/2013-01/msg00015.html

Mietek Bak <mietek>
Sat 20 Aug 2011 03:00:18 PM UTC, comment #2: 

Apparently you can turn this on in a Makefile with

MAKEFLAGS += --warn-undefined-variables

I'm using 3.81 and this works from an included makefile before any variable references.

marvin greenberg <marvingreenberg>
Mon 10 Nov 2008 12:09:47 AM UTC, comment #1: 

Yes, please.

Personally, I believe it was a great misfeature of the original make that it quietly uses undefined variables without warning.

For those of us supporting other users who are bad typists or bad proofreaders, please provide us a mechanism for turning on the effect of --warn-undefined-variables within a makefile.

Richard Addison-Wood <richard_at_weta>
Sat 22 May 2004 05:11:02 PM UTC, original submission:  

I would love to be able to turn on this feature from within a Makefile.

Dave Yost <yost>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by niedzielski (Posted a comment)
  • -email is unavailable- added by mietek (Voted in favor of this item)
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by mietek (Posted a comment)
  • -email is unavailable- added by marvingreenberg (Posted a comment)
  • -email is unavailable- added by richard_at_weta (Posted a comment)
  • -email is unavailable- added by richard_at_weta (Voted in favor of this item)
  •  

    There are 44 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2022-09-03 psmith StatusNone Fixed
        Open/ClosedOpen Closed
        Fixed ReleaseNone 4.4
    2014-09-14 mietek Carbon-Copy- Added mietek
    2008-11-10 richard_at_weta Carbon-Copy- Added richard_at_weta
    2006-09-27 yost Carbon-Copy- Added yost

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code