INCATools / ontology-development-kit

Bootstrap an OBO Library ontology
http://incatools.github.io/ontology-development-kit/
BSD 3-Clause "New" or "Revised" License
212 stars 53 forks source link

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

Open joeflack4 opened 1 month ago

joeflack4 commented 1 month ago

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

matentzn commented 1 month ago

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.

gouttegd commented 1 month ago

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).