Search code examples
makefile

Is it possible to get the name of the current function/variable in a makefile


Is there a builtin variable like .VARIABLES that is the equivalent of __FUNCTION__ in C?

I.e. the following..

my_variable=$(1) and $(.VARIABLE)

$(info $$(call my_variable,1) is "$(call my_variable,1)")

.. would output $(call my_variable,1) is "1 and my_variable"


Solution

  • Current function is $0 (aka $(0)). Current variable isn't a thing.