第25章 为何须要Erlang.mk

原文连接  https://erlang.mk/guide/why.htmlhtml

 

Chapter 25. Why Erlang.mk

 

Why would you choose Erlang.mk, if not for its many features ? This chapter will attempt to answer that.app

若是不是 Erlang.mk 的不少功能,为何你会选择它?本章试图回答这个问题。编辑器

 

25.1. Erlang.mk is fast

25.1. Erlang.mk很快

 

Erlang.mk is as fast as it gets.ide

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相比,这会节省了许多秒,即便在小型项目上也是如此。fetch

 

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.ui

Erlang.mk不会试图变得更聪明。 它提供了一个适用于大多数人的简单解决方案,并为处于边缘状况的项目提供了额外选项,一般以扩展变量或规则的形式进行定义。this

 

25.2. Erlang.mk gives you the full power of Unix

25.2. Erlang.mk为你提供了Unix的所有功能

 

Erlang.mk is a Makefile.spa

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能顺利的集成在这样的环境中,并表现得如你所愿。

相关文章
相关标签/搜索