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

 
 

bug #9060: --warn-undefined-variables

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

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

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>
Project 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 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)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 44 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    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.3