bugmake - Bugs: bug #31278, multiple shell commands within one...


bug #31278: multiple shell commands within one rule invoke separate shell environments

Submitter:  None
Submitted:  Fri 08 Oct 2010 05:49:10 PM UTC
Severity:  3 - Normal Item Group:  Enhancement
Status:  Fixed Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  3.81 Operating System:  None
Fixed Release:  3.82 Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup

Fri 08 Oct 2010 06:16:49 PM UTC, comment #1: 

The current behavior of make is the way every make has always worked since make was invented in the 1970's, and it's mandated by the POSIX standard for "make".  Hundreds of thousands of makefiles would break if we changed it.

However, if you upgrade to GNU make 3.82 you can use the new .ONESHELL feature (see the NEWS file and docs) to get the behavior you want.

Paul D. Smith <psmith>
Group administrator
Fri 08 Oct 2010 05:49:10 PM UTC, original submission:  


It would be really nice if make somehow used the same instance of a shell in the commands for a given rule, for example:

SHELL = /bin/bash

f :
@echo $${a}

does not do what one wants.  instead you must say:

f :
        @a=5; echo $${a}

It isn't a bug, since there is no claim that make retains a shell environment.

I don't think it would be desirable to retain the shell environment across rules, but within a rule, i think it makes sense.



(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 (Posted a comment)

    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.


    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-10-08 psmith Open/ClosedOpen Closed
    2010-10-08 psmith StatusNone Fixed
        Fixed ReleaseNone 3.82

    Back to the top

    Powered by Savane 3.13-0159.
    Corresponding source code