有没有命令可以一起生成.cmo .cmx .cmi .mli ?

发布于 2024-12-27 12:03:18 字数 130 浏览 2 评论 0原文

我有一个 .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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

洋洋洒洒 2025-01-03 12:03:18

我认为没有任何方法可以一次生成所有这些文件。

.mli :   ocamlc -i     x.ml > x.mli
.cmi :   ocamlc        x.mli
.cmo :   ocamlc -c     x.ml
.cmx :   ocamlopt -c   x.ml

如果不需要 .mli 文件,则可以与 ocamlc -c< 一起生成 .cmi.cmo 文件/代码>。否则我认为你必须一次生成一个文件。

请注意,每个 .cmx 文件都有一个 .o 文件;他们成对工作。

I don't think there's any way to generate all these files at once.

.mli :   ocamlc -i     x.ml > x.mli
.cmi :   ocamlc        x.mli
.cmo :   ocamlc -c     x.ml
.cmx :   ocamlopt -c   x.ml

If you can do without the .mli file, you can generate the .cmi and .cmo files together with ocamlc -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.

生寂 2025-01-03 12:03:18

您可以使用 Makefile 为您完成这一切。我这里有一个示例项目模板可能会有所帮助: https://github.com/snim2/ocaml-template< /a>

make bytemake nativemake 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-template

Say make byte, make native or make docs to generate the sort of output you're looking for.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文