bugmake - Bugs: bug #46580, plugin: macro functions cannot be...

 
 

bug #46580: plugin: macro functions cannot be called with zero parameters

Submitted by:  Brian Vandenberg <phantal>
Submitted on:  Tue 01 Dec 2015 07:54:57 PM UTC  
 
Severity: 3 - NormalItem Group: Bug
Status: DuplicatePrivacy: Public
Assigned to: NoneOpen/Closed: Closed
Component Version: 4.1Operating 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.

 

Mon 11 Apr 2016 02:43:52 PM UTC, comment #5:

Oops, you're right; I forgot I'd posted this bug when I posted that one.

Brian Vandenberg <phantal>
Sun 10 Apr 2016 07:07:55 PM UTC, comment #4:

This seems like a duplicate of bug #47419

Paul D. Smith <psmith>
Project Administrator
Thu 03 Dec 2015 11:05:00 PM UTC, comment #3:

Right, and again it's documented that if you use := and do it at the top of the makefile it's guaranteed to work. But we don't need to argue; if you want to add a new macro go ahead, I just wanted to make sure you did so knowing that there's a stable, documented, supported solution which works for most if not all use cases.

Anonymous
Wed 02 Dec 2015 11:41:24 PM UTC, comment #2:

$(lastword ${MAKEFILE_LIST)) doesn't give the current makefile, it gives the last file that was sourced. For example:

~ cat /tmp/makefile1
$(info $(lastword ${MAKEFILE_LIST}))
include /tmp/makefile2
$(info $(lastword ${MAKEFILE_LIST}))
~ cat /tmp/makefile2
$(info $(lastword ${MAKEFILE_LIST}))
~ gmake -f /tmp/makefile1
/tmp/makefile1
/tmp/makefile2
/tmp/makefile2

Brian Vandenberg <phantal>
Wed 02 Dec 2015 03:06:37 AM UTC, comment #1:

I realizeit's orthogonal to what you're reporting but are you aware that there's already a documented method of getting the current makefile?

this_makefile := $(lastword $(MAKEFILE_LIST))

Anonymous
Tue 01 Dec 2015 07:54:57 PM UTC, original submission:

I added a macro for getting the current makefile; it's attached in example.sh.

The short version: if a macro doesn't need any arguments you cannot execute the macro unless you trail the name with a space or execute it with $(call):

$(current_makefile) <--- attempts to expand a variable of that name
$(current_makefile ) <-- works
$(call current_makefile) <-- also works

The long version; to begin with:

  • I had to re-type the script because my development machine doesn't have internet access; my apologies if it has errors.
  • I understand that "reading_file" is not part of the interface currently exposed. I couldn't find any way to use "gmk_floc" through the already exposed API, so I'm tinkering with this. I'll be putting that in as another enhancement request.
  • The documentation doesn't make it entirely clear what should happen if the minimum # of arguments is zero for the 3rd parameter to gmk_add_function.

When the script is executed this is what I see:

/tmp/GmDbftx0:1: warning: undefined variable '.LOADED'
/tmp/GmDbftx0:2: warning: undefined variable 'current_makefile'
/tmp/GmDbftx0
/tmp/GmDbftx0
gmake: *** No targets. Stop.

Brian Vandenberg <phantal>

 

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

Attach File(s):
   
   
Comment:
   

Attached Files
file #35609:  example.sh added by phantal (826B - text/plain)

 

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

    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 3 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Sun 10 Apr 2016 07:07:55 PM UTCpsmithStatusNone=>Duplicate
      Open/ClosedOpen=>Closed
    Tue 01 Dec 2015 07:54:57 PM UTCphantalAttached File-=>Added example.sh, #35609

    Back to the top


    Powered by Savane 3.1-cleanup1