bug-make
[Top][All Lists]
Advanced

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

.SECONDARY unexpectedly affects rule invocation


From: Mikhail Pomaznoy
Subject: .SECONDARY unexpectedly affects rule invocation
Date: Tue, 4 Oct 2022 14:57:47 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.13.1

Greetings,

I have encountered weird behavior in make and tried to isolate it.  The software was built from source.

I have the following Makefile:

RECIPE = echo "Making $@ from $^" > $@
T.1 : A.4 A.4.ind; $(RECIPE)
A.4 : A.3 A.3.ind
    $(RECIPE)
A.2 :
    $(RECIPE)
A.3 : A.2
    $(RECIPE)
A.3.ind A.4.ind : %.ind : %
    $(RECIPE)
.SECONDARY:

And the current directory contains A.3.ind and A.4.ind .

I want to make target T.1. If I run

make T.1

Then the following commands are executed:

echo "Making A.2 from " > A.2
echo "Making A.3 from A.2" > A.3
echo "Making A.4 from A.3 A.3.ind" > A.4
echo "Making T.1 from A.4 A.4.ind" > T.1

I.e. A.4.ind and A.3.ind are never updated, while A.4 was updated. It means the very last command will use invalid A.4.ind file. This is a bit unexpected to me already. Moreover, if I remove .SECONDARY, A.4.ind or A.3.ind ARE updated while preparing T.1.

Could you please clarify or investigate ?

-Mikhail



reply via email to

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