I'm attempting to create a single log file that tracks and reports the results of each recipe as the make process moves through the makefile.
To do this, I'm creating an environment variable to hold my logfile reference like so:
LOGDIR = logs
LOGFILE = $(LOGDIR)/$(shell date --iso=seconds).log
The intention is then to add relevant messaging to the log file by using
echo "message" >> $(LOGFILE)
Trouble is, when processing moves from one recipe to the next, the environment variable is re-evaluated, resulting in a new log file from every recipe in my makefile.
Why does the environment variable get re-evaluated, and how can I prevent this to use a single global reference to a logfile?
I thought that using the $(shell operator)
syntax prevents re-evaluation of the variable, based on Aaron's answer here.