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

RFE: ocamldep flag to generate dependency on .cmi even when only .ml is present. #3190

Closed
vicuna opened this issue Sep 29, 2004 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Sep 29, 2004

Original bug ID: 3190
Reporter: administrator
Status: acknowledged
Resolution: open
Priority: normal
Severity: feature
Category: tools (ocaml{lex,yacc,dep,debug,...})
Related to: #5000
Monitored by: nogin

Bug description

Full_Name: Aleksey Nogin
Version: 3.08.1 and CVS
OS: Fedora Core Linux
Submission from: charter-242-009.caltech.edu (131.215.242.9)

Currently, if ocamldep finds an .ml file, but no .mli file while resolving
dependencies, then ocamldep tries to do a make-compatible workaround.

E.g., if files x.ml and x.mli contain "open Y", and only y.ml is present, then
ocamldep will generate:

x.cmi: y.cmo
x.cmo: y.cmo
x.cmx: y.cmx

and "ocamldep -native" will generate

x.cmi: y.cmx
x.cmo: y.cmx
x.cmx: y.cmx

This is all fine in case of a build tool that is only paying attention to
timestamps (as make does). However, in case of a build tool (such as omake)
that:
a) uses checksums to figure out when dependencies change and files need to be
rebuilt,
b) knows that compiling an .ml may produce a .cmi (if no .mli exists),
the current ocamldep behaviour turns out to be suboptimal and even dangerous.

If the y.ml file changes in a way that y.cmo/.cmx change, but the types and
y.cmi remain the same, then the way ocamldep currently generates dependencies,
the x.cmi and x.cmo would end up being rebuilt for no good reason. What's worse,
if somehow a change in types affects the y.cmi, but y.cmo and/or y.cmx remain
unchanged, then the x.cm* files might end up not being rebuilt when they should
be.

In short, I would like to request that an option be added to ocamldep (not sure
what a good name for it would be - may be "-natural"?) to generate the "natural"
dependencies even when only the .ml file is present.

E.g. in the example above, "ocamldep -natural" would generate

x.cmi: y.cmi
x.cmo: y.cmi
x.cmx: y.cmi y.cmx

@github-actions
Copy link

This issue has been open one year with no activity. Consequently, it is being marked with the "stale" label. What this means is that the issue will be automatically closed in 30 days unless more comments are added or the "stale" label is removed. Comments that provide new information on the issue are especially welcome: is it still reproducible? did it appear in other contexts? how critical is it? etc.

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

No branches or pull requests

2 participants