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

ocamltest: avoid unnecessary rebuilding #2224

Merged
merged 1 commit into from Jan 21, 2019

Conversation

nojb
Copy link
Contributor

@nojb nojb commented Jan 18, 2019

You may have noticed that ocamltest is repeatedly rebuilt even when there are no pending changes. It is due to some "intermediate" files being removed at the end of the build (read https://www.gnu.org/software/make/manual/html_node/Chained-Rules.html to understand why). The following PR just marks the relevant files so that they are not removed, so that they don't have to be recreated each time (which triggers the rebuild).

Happy building!

@dra27
Copy link
Member

dra27 commented Jan 18, 2019

Thanks for doing this, @nojb! I’d noticed it when working on ocamltest, but not for around to fixing it!

Do we have .SECONDARY rules elsewhere for lexers, or is there something specific about the rules in the ocamltest Makefile?

@nojb
Copy link
Contributor Author

nojb commented Jan 18, 2019

No, I don't think there are other instances. I believe here the issue is a side-effect of the "pattern rules"

%.ml %.mli: %.mly
	$(ocamlyacc) $<

%.ml: %.mll
	$(ocamllex) -q $<

in the ocamltest Makefile.

@nojb nojb closed this Jan 21, 2019
@nojb nojb reopened this Jan 21, 2019
@shindere
Copy link
Contributor

@nojb many thanks for having spotted this!

Regarding the implementation, rather than hardcoding the names of
the files, could you please the predefined variables?

For instance:

.SECONDARY: $(lexers:.mll=.ml) $(parsers:.mly=.mli) $(parsers:.mly=.ml)

Thanks!

@nojb
Copy link
Contributor Author

nojb commented Jan 21, 2019

Done.

@shindere shindere merged commit ba8eeb3 into ocaml:trunk Jan 21, 2019
@shindere
Copy link
Contributor

shindere commented Jan 21, 2019 via email

@nojb nojb deleted the avoid_ocamltest_rebuild branch January 21, 2019 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants