################################################################# # Demonstrating recursive variables - Bahman Movaqar ################################################################# SHELL := /usr/bin/env -S bash -o pipefail .DEFAULT_GOAL := all ################################################################# define a-recursive-var = $(info 💡 a-recursive-var is computed.)$(strip a-recursive-var) endef define a-simple-var := $(info 💡 a-simple-var is computed.)$(strip a-simple-var) endef .PHONY : demonstrating-text-functions demonstrating-text-functions : @echo \ ; echo $(@) \ ; echo ' $(a-recursive-var)' \ ; echo ' $(a-recursive-var)' \ ; echo ' $(a-recursive-var)' \ ; echo ' $(a-simple-var)' \ ; echo ' $(a-simple-var)' \ ; echo ' $(a-simple-var)' \ ; echo ################################################################# timestamp = $(shell perl -MTime::HiRes=time -E'say time()') .PHONY : demonstrating-shell-function demonstrating-shell-function : @echo \ ; echo $(@) \ ; export ts1='$(timestamp)' \ ; export ts2='$(timestamp)' \ ; [[ "$$ts1" == "$$ts2" ]] \ && echo " ✅ ts1 = ts2" \ || echo " ❌ ts1 ≠ ts2" \ ; echo ################################################################# .PHONY : all all : demonstrating-text-functions all : demonstrating-shell-function