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

 
 

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

Submitted by:  None
Submitted on:  Fri 29 May 2015 10:51:16 AM UTC  
 
Severity: 3 - NormalItem Group: Enhancement
Status: NonePrivacy: Public
Assigned to: NoneOpen/Closed: Open
Component Version: NoneOperating System: None
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.

 

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

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 psmith (Posted a comment)
  • -unavailable- added by mdorey (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 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 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sat 30 May 2015 05:12:42 PM UTCpsmithItem 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.1-cleanup1