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

 
 

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

Submitter:  Brian Vandenberg <phantal>
Submitted:  Tue 01 Dec 2015 07:54:57 PM UTC
   
 
Severity:  3 - Normal Item Group:  Bug
Status:  Duplicate Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Component Version:  4.1 Operating System:  Any
Fixed Release:  None Triage Status:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

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>
Group 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 Files:
   
   
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
  • -email is unavailable- added by psmith (Posted a comment)
  • -email is unavailable- added by phantal (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.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-04-10 psmith StatusNone Duplicate
        Open/ClosedOpen Closed
    2015-12-01 phantal Attached File- Added example.sh, #35609

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code