gnu make: list the values of all variables (or “macros”) in a particular run

GNU make provides .VARIABLES
which holds all global variables’ names.
However, this includes built-in variables(like MAKEFLAGS).
If you have to exclude built-in variables, some filtering like the following
might be needed.
The following makefile prints user-defined variables(CUR-DIR, LOG-DIR)
using info:

# Place this line at the top of your Makefile
VARS_OLD := $(.VARIABLES)

# Define your variables
CUR-DIR := $(shell pwd)
LOG-DIR := $(CUR-DIR)/make-logs

# Put this at the point where you want to see the variable values
$(foreach v,                                        \
      $(filter-out $(VARS_OLD) VARS_OLD,$(.VARIABLES)), \
      $(info $(v) = $($(v))))

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)