构建多个 Erlang Beam 文件?
我目前正在使用
c(module_name)
一一构建我的 Erlang 文件。当 Erlang 的构建过程有多个文件时如何处理?
I am currently using
c(module_name)
to build my Erlang files one by one. How can the build process for Erlang be handle when they have multiple files?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
每个人可能都应该使用 Erlang 的官方构建工具:rebar3。当我提供这个较旧的答案时,它并不存在:
我首先使用 Erlang make,因为它启动VM一次并编译所有需要重新编译的内容。
在源目录中尝试以下操作,它将编译那些缺少相应 Beam 文件的 .erl 文件,或者自编译 Beam 文件以来 .erl 文件已被修改的文件:
了解 Emakefile 以获取其他技巧,例如编译所有文件带有 debug_info 的源文件并将 .beam 文件放入 ebin 中:
Everyone should probably be using the official build tool for Erlang: rebar3. It did not exist when I provided this older answer:
I start out by using Erlang make, because it starts the VM once and compiles everything that needs to be recompiled.
Try the following in your source directory, it will compile those .erl files that are missing a corresponding Beam file or those where the .erl file has been modified since the Beam file was compiled:
Learn about Emakefile for additional tricks, such as compiling all source files with debug_info and placing the .beam files in ebin:
这会编译您当前所在目录中的所有内容:
This compiles everything in the directory you're currently in:
许多项目使用常规的旧 make 文件和 erlc
a lot of projects use a regular old make file and
erlc
Erlang Make 和 Emakefiles 可能是一个很好的起点。
例如,您可能想查看 Erlang Web 的构建系统。
具体来说,您可能需要查看他们的 Emakefile 及其compile.erl。
Erlang Make and Emakefiles are probably a good way to start.
As an example, you might want to have a look to the build system of Erlang Web.
In the specific, you might want to look at their Emakefile and their compile.erl.
您可以使用“rebar”,这是 Basho 提供的一个符合 OTP 标准的 Erlang 构建工具:它将多个 erlang 应用程序设置为一致的目录结构,并且允许您执行的操作不仅仅是将文件编译为 .beams。 [rebar 编译]
例如,您可以
* 运行测试(eUnit + 功能/回归)[钢筋测试]
要查看所有钢筋命令,“rebar -c”将为您提供完整的图片。
钢筋来自 Basho,其变体四处浮动,:- )
您可以这里获取rebar
wiki 说明了一切。
You can use 'rebar', an Erlang build tool from Basho that is OTP compliant: this sets up multiple erlang applications into a consistent directory structure and allows you to do more than just compile files into .beams. [rebar compile]
For instance, you can
* run tests (eUnit + feature/regression) [rebar test]
To see all rebar commands, 'rebar -c' will give you a complete picture.
rebar is from Basho with variants floating around, :-)
You can get rebar here
The wiki says it all.