Wednesday, March 4, 2015

Print all the environment in makefile



printenv:

$(foreach V,$(sort $(.VARIABLES)),\
$(if $(filter-out default automatic,\
    $(origin $V)),$(warning $V=$($V) ($(value $V)))))


or - new variables only:

VARS_OLD := $(.VARIABLES)
CUR-DIR := $(shell pwd)
LOG-DIR := $(CUR-DIR)/make-logs
$(foreach v,                                        \
  $(filter-out $(VARS_OLD) VARS_OLD,$(.VARIABLES)), \
  $(info $(v) = $($(v))))