meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
programming:makefile:default_variables [2024/03/19 13:00] – created niziakprogramming:makefile:default_variables [2024/03/22 10:36] (current) niziak
Line 57: Line 57:
  
 Note that we use a special stylistic convention when we talk about these automatic variables; we write “the value of ‘$<’”, rather than “the variable <” as we would write for ordinary variables such as objects and CFLAGS. We think this convention looks more natural in this special case. Please do not assume it has a deep significance; ‘$<’ refers to the variable named < just as ‘$(CFLAGS)’ refers to the variable named CFLAGS. You could just as well use ‘$(<)’ in place of ‘$<’. Note that we use a special stylistic convention when we talk about these automatic variables; we write “the value of ‘$<’”, rather than “the variable <” as we would write for ordinary variables such as objects and CFLAGS. We think this convention looks more natural in this special case. Please do not assume it has a deep significance; ‘$<’ refers to the variable named < just as ‘$(CFLAGS)’ refers to the variable named CFLAGS. You could just as well use ‘$(<)’ in place of ‘$<’.
 +
 +
 +===== special variables =====
 +
 +https://www.gnu.org/software/make/manual/html_node/Special-Variables.html|6.14 Other Special Variables]]
 +
 +  * .DEFAULT_GOAL
 +  * .MAKE_RESTARTS
 +  * .VARIABLES - Expands to a list of the names of all global variables defined so far.
 +  * .FEATURES
 +  * .INCLUDE_DIRS
 +
 +From [[https://stackoverflow.com/questions/7117978/gnu-make-list-the-values-of-all-variables-or-macros-in-a-particular-run|gnu make: list the values of all variables (or "macros") in a particular run]]
 +<code make>
 +dump:
 +    $(foreach v, \
 +        $(shell echo "$(filter-out .VARIABLES,$(.VARIABLES))" | tr ' ' '\n' | sort), \
 +        $(info $(shell printf "%-20s" "$(v)")= $(value $(v))) \
 +    )
 +</code>