help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can make restart b/c of generated include while a target is running?


From: Victor Sergienko
Subject: Can make restart b/c of generated include while a target is running?
Date: Wed, 20 May 2020 17:45:41 -0700

Hello,

I have a part of a Makefile that does approximately this:
=====
DIRNAME = dir-$(shell date +%Y-%m-%dT%H-%M-%S)
first_target:
    mkdir -p $(DIRNAME)
    ( do something; echo "done" > $(DIRNAME)/.done ) | tee $(DIRNAME)/build.log

# first_target is always executed first.
$(ALL_OTHER_TARGETS): first_target
=====

The Makefile uses some generated includes, so make restarts several
times before commencing.
Now I have a log where $(DIRNAME) in the "mkdir -p" line is different
from $(DIRNAME) used in the following line.

Is it possible that make was restarted while a first_target was
already running? Or could first_target read an outdated value of
$(DIRNAME) for the first time?
Or was this something else?

I'm going to work around this with MAKE_RESTARTS or with deferred
evaluation, or just ditch the $(shell date) part.
But I'd like to understand what is going on.

Thank you!



reply via email to

[Prev in Thread] Current Thread [Next in Thread]