Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
joeflack4 opened this issue May 12, 2024 · 2 comments
Open

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

joeflack4 opened this issue May 12, 2024 · 2 comments

Comments

@joeflack4
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants