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 - NormalItem Group: Enhancement
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
Component Version: 3.80Operating System: Any
Fixed Release: NoneTriage 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
@echo foo
@echo $(bar)

This bug has a long history of confusing users:

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 File(s):

No files currently attached


Depends on the following items: None found

Items that depend on this one: None found


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

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

    Only logged-in users can vote.


    Please enter the title of George Orwell's famous dystopian book (it's a date):



    Follow 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 14 Sep 2014 01:48:58 PM UTCmietekCarbon-Copy-=>Added mietek
    Mon 10 Nov 2008 12:09:47 AM UTCrichard_at_wetaCarbon-Copy-=>Added richard_at_weta
    Wed 27 Sep 2006 10:54:06 PM UTCyostCarbon-Copy-=>Added yost

    Back to the top

    Powered by Savane 3.1-cleanup1