有没有命令可以一起生成.cmo .cmx .cmi .mli ?
我有一个 .ml
文件,我想生成它的 .cmo
、.cmx
、.cmi
和.mli
通过尽可能少的命令,有人可以帮忙吗?
I have a .ml
file, I would like to generate its .cmo
, .cmx
, .cmi
and .mli
by as least commands as possible, could anyone help?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我认为没有任何方法可以一次生成所有这些文件。
如果不需要
.mli
文件,则可以与ocamlc -c< 一起生成
.cmi
和.cmo
文件/代码>。否则我认为你必须一次生成一个文件。请注意,每个
.cmx
文件都有一个.o
文件;他们成对工作。I don't think there's any way to generate all these files at once.
If you can do without the
.mli
file, you can generate the.cmi
and.cmo
files together withocamlc -c
. Otherwise I think you'll have to generate files one at a time.Note that there is a
.o
file for every.cmx
file; they work as a pair.您可以使用
Makefile
为您完成这一切。我这里有一个示例项目模板可能会有所帮助: https://github.com/snim2/ocaml-template< /a>说
make byte
、make native
或make docs
来生成您正在寻找的输出类型。You can use a
Makefile
to do all this for you. I have an example project template here that might help: https://github.com/snim2/ocaml-templateSay
make byte
,make native
ormake docs
to generate the sort of output you're looking for.