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

an ocamldep aware of files with other suffixes than .ml / .mli ? #4992

Closed
vicuna opened this issue Mar 4, 2010 · 4 comments
Closed

an ocamldep aware of files with other suffixes than .ml / .mli ? #4992

vicuna opened this issue Mar 4, 2010 · 4 comments

Comments

@vicuna
Copy link

vicuna commented Mar 4, 2010

Original bug ID: 4992
Reporter: letouzey
Assigned to: @xclerc
Status: closed (set by @xavierleroy on 2012-09-25T18:06:17Z)
Resolution: fixed
Priority: normal
Severity: feature
Version: 3.11.2
Fixed in version: 3.12.1+dev
Category: ~DO NOT USE (was: OCaml general)
Has duplicate: #8076
Monitored by: @glondu

Bug description

Hi

In the same spirit as the -intf-suffix of ocamlc/ocamlopt, it would be
nice to have a way to tell ocamldep that the files with some particular
suffix (say, .ml4 or .mlp) are also implementations, in addition to the
usual .ml files.

In the Makefile of Coq, since some macro-generated .ml are not easy to
produce initially out of our .ml4, we use now ocamldep -modules
to get just the unit names of the dependencies, and then use an ad-hoc
wrapper around ocamldep to locate the files (.ml or .ml4) corresponding
to these units. It would be nice to be able to do that directly with
ocamldep

Best regards,

Pierre Letouzey

@vicuna
Copy link
Author

vicuna commented Dec 8, 2010

Comment author: @xclerc

Could you be more specific about the intended behavior of an "-impl-suffix" flag?

Notice that the "-intf-suffix" flag you are referring to replace the default ".mli"
suffix of interface file with a new suffix, it does not add new suffixes to be treated
in the same way ".mli" is.
From you report, I incline to think you would like to have the latter behavior rather
than former one, but in that case the behavior would not be coherent with the one
of the compilers.

I the meantime, as you may already know, it is possible to overcome the problem
by using the "-impl" and "-intf" flags of "ocamldep".

@vicuna
Copy link
Author

vicuna commented Dec 20, 2010

Comment author: letouzey

Hi xavier,

Indeed, being able to allow new possible suffixes (such as ".ml4")
in addition to the default ".ml" would be more interesting than
just replacing ".ml" by something else. I didn't noticed that
the "-intf-suffix" of ocamlc was meaning "forget about .mli and
consider only ...".

The idea is just to enhance a bit the lookup of local modules needed
by foo.ml: if foo.ml mentions Bar, ocamldep foo.ml will mention
bar.cm{o,x} only if bar.ml is found around (same place or via -I).
If bar.ml isn't found, ocamldep doesn't complain and writes no deps,
probably assuming that Bar is somewhere in the stdlib. This feature
wish is about allowing to search for more than just bar.ml, say bar.ml4.
And this bar.ml4 might not be pristine ocaml syntax, normally only
its existence is meaningful here. A more explicit name for this option
would then be something like --add-impl-suffix-to-lookup

Concerning -impl and -intf, to my understanding they are only of limited
help here: ok, they can be used when the whole bunch of files is given
at once to ocamldep, typically to create a unique .depend. But here
we try to rather create one .d dependency file per source file, a bit
like ocamlbuild, hence running multiple instances of ocamldep and giving
them only one file name at a time.

Best regards,

Pierre

PS: something surprised me when doing quick tests about this "-impl".

echo "let x = 1" > a.ml4
echo "let y = A.x" > b.ml
ocamldep -impl a.ml4 b.ml

With my ocaml 3.11.2 here, the output is

a.cmo:
a.cmx:
b.cmo:
b.cmx:

Doesn't that sound like a bug, or am I missing something ?

@vicuna
Copy link
Author

vicuna commented Dec 21, 2010

Comment author: @xclerc

About your post-scriptum: this is neither a bug, nor you are missing something.
It happens that my workaround suggestion is actually broken: '-impl' says 'process
me as an implementation file', not 'treat me as an implementation while trying to discover
dependencies'.

This reinforces the usefulness of the switch you are requesting.

@vicuna
Copy link
Author

vicuna commented Jan 4, 2011

Comment author: @xclerc

Two command-line options have been added ('-ml-synonym' and '-mli-synonym')
to allow one to define alternative suffixes for implementation and signature files.
Both options should be followed by an extension with a leading dot (e. g.
"-ml-synonym '.ml4'").

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

1 participant