ontology-development-kit icon indicating copy to clipboard operation
ontology-development-kit copied to clipboard

Should `$(IMPORTDIR)/%_terms_combined.txt` be `.PRECIOUS`?

Open joeflack4 opened this issue 9 months ago • 2 comments

Overview

I did a recent build (1, 2), and noticed that several files were being removed; IDK why. I made some of the goals .PRECIOUS, which solved the problem for those. But the goal for one of these files, imports/ro_terms_combined.txt, is defined in the ODK Makefile: $(IMPORTDIR)/%_terms_combined.txt.

Should we make this goal .PRECIOUS to stop this from happening?

Additional information

joeflack4 avatar May 12 '24 22:05 joeflack4

The reason they are removed is that they are intermediate files according to make, and not targets. This is very much expected. The solution of using .PRECIOUS is generally correct, but I am not so sure if this should be solved.

b.txt:
  touch $@

a.txt: b.txt

Now if you run

make a.txt

I think b.txt will be removed in the end of the process.

Now the question is:

Why is that and should this indeed be considered "misbehaviour"? Because if I am not totally wrong, a.txt will besically be re-created every time?

I guess I might be wrong and this only happens when wild%cards are in play... Not sure.

matentzn avatar May 13 '24 09:05 matentzn

I think b.txt will be removed in the end of the process.

No, b.txt is not an intermediate file, it’s an explicit target. “Intermediate files”, in GNU Make’s parlance, are only a thing when implicit rules are concerned (whether they are built-in implicit rules or custom pattern rules).

gouttegd avatar May 13 '24 10:05 gouttegd