bugmake - Bugs: bug #45211, MAKEFLAGS is not parsed until...

 
 

bug #45211: MAKEFLAGS is not parsed until after makefiles are read on

Submitter:  None
Submitted:  Fri 29 May 2015 10:51:16 AM UTC
   
 
Severity:  3 - Normal Item Group:  Enhancement
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open
Component Version:  None Operating System:  None
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 30 May 2015 05:12:42 PM UTC, comment #2: 

The ?= assignment only sets variables if they are not already set.

The RM variable is set by default.

Resetting the state of make doesn't happen every time MAKEFLAGS is modified.  It only happens once, after all makefiles are read in.

So, when the RM ?= rm assignment is seen the RM variable still has its default value, and it is not assigned.  Then after all makefiles are read in, MAKEFLAGS is processed and the default assignment for RM is removed, leaving it empty.

I'll mark this as an enhancement request, to consider having changes to MAKEFLAGS take effect immediately instead of after all makefiles are parsed, but this seems like a low priority issue to me.

Why don't you use just "RM = rm" instead of "RM ?= rm", and then things would work the way you want?

Paul D. Smith <psmith>
Group administrator
Fri 29 May 2015 11:32:42 PM UTC, comment #1: 

The claim being, I presume, that the second RM='' should either be RM='rm -f' or RM='rm', the latter only being the case if changing MAKEFLAGS takes effect implausibly quickly.  It's the former with a Debian Wheezy make 3.81 (origin says "default"), but empty (origin says "undefined"), per the OP, with git's 4.1.90.  As you'd hope, a more normal operation is fine: it's the latter when running make -R aka --no-builtin-variables, with either version.

Martin Dorey <mdorey>
Fri 29 May 2015 10:51:16 AM UTC, original submission:  

Makefile:

# Start of Makefile
MAKEFLAGS += -R

$(info RM='$(RM)')

RM ?= rm

define make_obj
 $(info RM='$(RM)')
endef

ttt:
$(call make_obj)
# End of Makefile


make output:
RM='rm -f'
RM=''
make: 'ttt' is up to date.

Anonymous

 

(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 psmith (Posted a comment)
  • -email is unavailable- added by mdorey (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-05-30 psmith Item GroupNone Enhancement
        SummaryAdd option to MAKEFLAGS (How to set RM variable?) MAKEFLAGS is not parsed until after makefiles are read on

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code