bugmake - Bugs: bug #49183, Macros set in MAKEFLAGS should not...


bug #49183: Macros set in MAKEFLAGS should not be added to the environment

Submitter:  Paul D. Smith <psmith>
Submitted:  Sun 25 Sep 2016 08:07:02 PM UTC
Severity:  3 - Normal Item Group:  Enhancement
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  4.2.1 Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup

Mon 26 Sep 2016 02:41:45 PM UTC, comment #3: 

The current POSIX standard is available online for free and has been for many years now: http://www.opengroup.org/onlinepubs/9699919799/

The change seems pretty innocuous to me.  The number of people who set the MAKEFLAGS variable in their local environment is likely to be tiny, and the number of people who assign macros in their MAKEFLAGS variable even smaller, and the number of those who rely on those macros being exported into the environment of commands must be truly minuscule.

Paul D. Smith <psmith>
Group administrator
Mon 26 Sep 2016 07:12:25 AM UTC, comment #2: 

But, if a comment is added to the documentation, it would be nice to advise the "unexport" hack from the mailing list.

Mon 26 Sep 2016 07:08:08 AM UTC, comment #1: 

POSIX or not...that should not add further confusion, by altering a long-establish behaviour of GNU make.

BUG? Not really.

But if POSIX will to implement their own MAKE, maybe they can follow their own rules, but meanwhile, they still charge an enormous amount of money just for the privilege of looking into their precious standard...and this is why they are f**ing irrelevant.

Sun 25 Sep 2016 08:07:02 PM UTC, original submission:  

The upcoming POSIX spec specifies that macro assignments added to the MAKEFLAGS variable should not be added into make's environment (or exported into the environment of commands that make invokes).

Text from the draft of the standard:

    Before the makefile(s) are read, all of the make utility command line macro definitions (except the
    MAKEFLAGS macro or the SHELL macro) shall be added to the
environment of make. Other
+   implementation-defined variables may also be added to the
environment of make. Macros
+  defined by the MAKEFLAGS environment variable and macros defined in the makefile(s) shall
+   not be added to the environment of make if they are not already in its environment. With the
+   exception of SHELL (see below), it is unspecified whether macros defined in these ways update
    the value of an environment variable that already exists in the environment of make.

(changes to the standard are marked with "+").  Currently, make will add those macros to the environment:

$ echo 'all:;@echo FOO=$$FOO' | MAKEFLAGS=FOO=bar make -f-

See also this thread in bug-make: http://lists.gnu.org/archive/html/bug-make/2016-09/msg00030.html

Paul D. Smith <psmith>
Group administrator


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

Attach Files:

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 psmith (Submitted the item)

    There are 0 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.


    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code