[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #64964] GNU Make deletes intermediate targets that are pattern-rule
From: |
Paul D. Smith |
Subject: |
[bug #64964] GNU Make deletes intermediate targets that are pattern-rule dependancies |
Date: |
Sun, 3 Dec 2023 19:43:15 -0500 (EST) |
Update of bug #64964 (project make):
Status: None => Not A Bug
Open/Closed: Open => Closed
_______________________________________________________
Follow-up Comment #2:
As Dmitry says this is not a bug.
You are confusing "built-in rules" and "implicit rules".
Built-in rules are built into make and will be present regardless of whether a
makefile is parsed are not, unless you remove them with the -r option.
Implicit rules are suffix rules or pattern rules.
Explicit rules are rules that specify an explicit target (are not implicit
rules).
Built-in rules are always implicit (since it doesn't really make sense to have
explicit built-in targets).
But, implicit rules don't have to be built in: any suffix or pattern rule,
even ones that are defined in a makefile, are still implicit.
You don't have to use .SECONDARY etc. All you have to do is mention the
targets you want to be preserved as a target or prerequisite SOMEWHERE in the
makefile. So in your example, all you have to do is define some target that
lists these files you don't want to be deleted as a prerequisite.
The reason that make re-runs the sh all the time is that your pattern rule is
not creating its target. That is, if your makefile was like this:
foo%: foo%.txt
cat $<
touch $@
foo%.txt: foo%.sh
sh $< > $@
then make would know, because *foo1* exists and is newer than *foo1.sh*, that
*foo1.txt* did not need to be rebuilt.
If you don't want to do that you could create a rule like:
all-txts : foo1.txt foo2.txt foo3.txt ... fooN.txt
and that would be enough to avoid these targets being deleted as intermediate
targets.
If you want to discuss this further I recommend sending an email to the
help-make@gnu.org mailing list.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?64964>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/