bug-make
[Top][All Lists]
Advanced

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

duplicate dependencies (with .WAIT)


From: Frank Heckenbach
Subject: duplicate dependencies (with .WAIT)
Date: Tue, 01 Nov 2022 14:15:47 +0100

When introducing the new .WAIT special target in some of my
makefiles, I noticed a surprising (to me) behaviour, as shown in
this example using a simple ad-hoc single-stepping mechanism
(not quite my actual use case, but sufficient for this example):

% cat Makefile
all: step1 .WAIT pause .WAIT step2 .WAIT pause .WAIT step3
step%: ; echo "Step $*"
pause: ; @read -p "Press enter to continue." dummy
% make
echo "Step 1"
Step 1
Press enter to continue.
echo "Step 2"
Step 2
echo "Step 3"
Step 3

So "pause" is run only once. Now, I suppose that's as it's supposed
to be (by comparison with the same rule without ".WAIT"), and I
don't expect you to change anything about it, so that's basically
just for information to anyone who may encouter this situation.

Though maybe a warning would be useful if a rule lists the same
prerequisite twice. I don't know if this would lead to many new
warnings in existing makefiles; if so, the warning may only be given
if they appear on different sides of a ".WAIT" (which is new so
shouldn't cause issues with existing makefiles).

To remedy it (after I noticed the issue), I had to allow a rule
("pause") to be run several times. I did this by turning it into a
pseudo-pattern target. Is there a better way?

all: step1 .WAIT pause1 .WAIT step2 .WAIT pause2 .WAIT step3
step%: ; echo "Step $*"
pause%: ; @read -p "Press enter to continue." dummy



reply via email to

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