原文链接 https://erlang.mk/guide/why.html
Chapter 25. Why Erlang.mk
Why would you choose Erlang.mk, if not for its many features ? This chapter will attempt to answer that.
如果不是 Erlang.mk 的很多功能,为什么你会选择它?本章试图回答这个问题。
25.1. Erlang.mk is fast
25.1. Erlang.mk很快
Erlang.mk is as fast as it gets.
Erlang.mk编译和它的获取一样快。
Erlang.mk will group the compilation of files so as to avoid running the BEAM more than necessary. This saves many seconds compared to traditional Makefiles, even on small projects.
Erlang.mk将对文件进行分组,以避免运行不必要的BEAM。与传统的Makefiles相比,这会节省了许多秒,即使在小型项目上也是如此。
Erlang.mk will not try to be too smart. It provides a simple solution that works for most people, and gives additional options for projects that run into edge cases, often in the form of extra variables or rules to be defined.
Erlang.mk不会试图变得更聪明。 它提供了一个适用于大多数人的简单解决方案,并为处于边缘情况的项目提供了额外选项,通常以扩展变量或规则的形式进行定义。
25.2. Erlang.mk gives you the full power of Unix
25.2. Erlang.mk为你提供了Unix的全部功能
Erlang.mk is a Makefile.
Erlang.mk就是一个Makefile。
You could use Erlang.mk directly without configuring anything and it would just work. But you can also extend it greatly either through configuration or hooks, and you can of course add your own rules to the Makefile.
你无需配置任何东西,就可以直接使用Erlang.mk工作。 但是你也可以通过配置或钩子来扩展它,当然你也可以将自定义规则添加到Makefile中。
In all cases: for configuration, hooks or custom rules, you have all the power of Unix at your disposal, and can call any utility or even any language interpreter you want, every time you need to. Erlang.mk also allows you to write scripts in this small language called Erlang directly inside your Makefile if you ever need to…
对于所有这些扩展Erlang.mk的方式(配置、钩子或自定义规则),你都可以使用Unix的所有功能,也可以在需要的时候调用任何实用工具,甚至是调用任何你想要的语言解释器。 如果需要,Erlang.mk也允许你直接在Makefile中使用Erlang编写的脚本。
25.3. Erlang.mk is a text file
25.3. Erlang.mk是一个文本文件
Erlang.mk is a Makefile.
Erlang.mk就是一个Makefile文件。
Which means Erlang.mk is a simple text file. You can edit a text file. Nothing stops you. If you run into any bug, or behavior that does not suit you, you can just open theerlang.mk file in your favorite editor, fix and/or comment a few lines, save, and try again. It’s as simple as it gets.
这意味着Erlang.mk是一个简单的文本文件。它是如此简单,以至于当遇到任何bug或者不是你期待的表现,你都可以用自己喜欢的编辑器打开erlang.mk文件,修复或者注释几行,没有什么能阻止你。
Currently using a binary build tool? Good luck with that.
目前你还在使用二进制构建工具?那祝你好运咯!:)
25.4. Erlang.mk can manage Erlang itself
25.4. Erlang.mk可以管理Erlang
Erlang.mk isn’t written in Erlang.
Erlang.mk不是用Erlang写的。
That’s not a good thing, you say? Well, here’s one thing that Erlang.mk and Makefiles can do for you that Erlang build tool can’t easily: choose what version of Erlang is to be used for compiling the project.
你认为这不是一件好事? 好吧。但是,Erlang.mk和Makefiles可以为你做一件Erlang构建工具不能轻易做到的事:选择编译项目的Erlang版本。
This really is a one-liner in Erlang.mk (a few more lines if you also let it download and build Erlang directly) and allows for even greater things, like testing your project across all supported Erlang versions in one small command: make -k ci
.
这实际上是Erlang.mk中的一行代码(如果你要用Erlang.mk下载并构建Erlang,你也可以写更多代码)。甚至更复杂的事也可以使用Erlang.mk来完成,像是在所有支持的Erlang版本中测试你的项目就只需要一条简单的命令: make -k ci
。
25.5. Erlang.mk can do more than Erlang
25.5. Erlang.mk不仅仅只能编译Erlang工程
Erlang.mk doesn’t care what your dependencies are written in.
Erlang.mk不关心你写入了什么样的依赖关系。
Erlang.mk will happily compile any dependency, as long as they come with a Makefile. The dependency can be written in C, C++ or even Javascript… Who cares, really? If you need Erlang.mk to fetch it, then Erlang.mk will fetch it and compile it as needed.
Erlang.mk会很高兴地编译任何依赖,只要这些依赖自身带有Makefile文件。 依赖关系可以是C,C ++甚至Javascript工程...谁在乎,真的吗? 如果你需要Erlang.mk来获取它,那么Erlang.mk将获取它并在需要时编译它。
25.6. Erlang.mk integrates nicely in Make and Automake projects
25.6. Erlang.mk能很好地集成在Make和Automake项目中
If you are planning to put your project in the middle of a Make or Automake-based build environment, then the most logical thing to do is to use a Makefile.
如果你打算使用 make 或者 automake 来构建项目,那么理所当然也会使用Makefile。
Erlang.mk will happily sit in such an environment and behave as you expect it to.
Erlang.mk能顺利的集成在这样的环境中,并表现得如你所愿。