Chapter 4. Updating Erlang.mk
This chapter describes how to update the erlang.mk file in your repository.
本章介绍如何更新存储库中的erlang.mk文件。
4.1. Initial bootstrap
4.1. 初始引导
The first time you use Erlang.mk, it will bootstrap itself. It always uses the most recent version for this, so you don’t have to update after creating your project.
当你最初创建项目并引入Erlang.mk后执行 make,Erlang.mk会自动引导,这时总是使用最新的Erlang.mk版本,所以你不必更新Erlang.mk。
4.2. Updating
4.2. 更新
Later on though, updating becomes a necessity. Erlang.mk developers and contributors relentlessly improve the project and add new features; it would be a waste not to benefit from this.
但是以后的更新却不可避免。Erlang.mk开发人员和贡献者不懈地改进该项目并给它添加新功能,如果不从中受益,这些工作就成了一种浪费。
That’s why updating Erlang.mk is so simple. All you need to do is to call make erlang-mk
:
所以,更新Erlang.mk被设计的非常简单。你所需要做的仅仅只是调用make erlang-mk:
$ make erlang-mkgit clone https://github.com/ninenines/erlang.mk .erlang.mk.buildCloning into '.erlang.mk.build'...remote: Counting objects: 4035, done.remote: Compressing objects: 100% (12/12), done.remote: Total 4035 (delta 8), reused 4 (delta 4), pack-reused 4019Receiving objects: 100% (4035/4035), 1.10 MiB | 1000.00 KiB/s, done.Resolving deltas: 100% (2442/2442), done.Checking connectivity... done.if [ -f build.config ]; then cp build.config .erlang.mk.build; ficd .erlang.mk.build && makemake[1]: Entering directory '/home/essen/tmp/emkg/hello_joe/.erlang.mk.build'awk 'FNR==1 && NR!=1{print ""}1' core/core.mk index/*.mk core/index.mk core/deps.mk plugins/protobuffs.mk core/erlc.mk core/docs.mk core/test.mk plugins/asciidoc.mk plugins/bootstrap.mk plugins/c_src.mk plugins/ci.mk plugins/ct.mk plugins/dialyzer.mk plugins/edoc.mk plugins/elvis.mk plugins/erlydtl.mk plugins/escript.mk plugins/eunit.mk plugins/relx.mk plugins/shell.mk plugins/triq.mk plugins/xref.mk plugins/cover.mk \ | sed 's/^ERLANG_MK_VERSION = .*/ERLANG_MK_VERSION = 1.2.0-642-gccd2b9f/' > erlang.mkmake[1]: Leaving directory '/home/essen/tmp/emkg/hello_joe/.erlang.mk.build'cp .erlang.mk.build/erlang.mk ./erlang.mkrm -rf .erlang.mk.build
All that’s left to do is to commit the file!
剩下要做的只是提交这些更新的文件!
Yep, it’s that easy.
是的,这很简单。
4.3. Customizing the build
4.3. 定制构建
Erlang.mk allows you to customize which components are to be included in the erlang.mk file. The WITHOUT
variable allows you to remove components from the default Erlang.mk build. The build.config file lets you define exactly what goes in (including your own code!), and in what order.
Erlang.mk允许你对erlang.mk文件中包含的组件进行定制。 编译的时候,WITHOUT变量允许您从默认的Erlang.mk版本中删除组件。 build.config文件可以让你准确的定义编译所需引入的内容(包括你的代码!),以及它们引入的顺序。
The WITHOUT
file contains the list of components to exclude from the build. For example, to exclude the package index and the EDoc plugin when bootstrapping your application:
WITHOUT项指定要从构建中排除的组件列表。例如,在引导应用程序构建时排除软件包索引和EDoc插件:
$ make -f erlang.mk bootstrap WITHOUT="index plugins/edoc"
The generated Erlang.mk will never include those components when you update it, until you change your mind and use the WITHOUT
variable again when you upgrade:
当你在更新生成的Erlang.mk时,所有组件都会被更新,直到你改变主意再次使用WITHOUT变量来升级Erlang.mk:
$ make erlang-mk WITHOUT=index
The build.config file is automatically used when you bootstrap Erlang.mk or when you update it with make erlang-mk
.
build.config文件会在你引导Erlang.mk或者当你使用 “make erlang-mk” 更新Erlang.mk时被自动使用。
The build.config file contains the list of all files that will be built into the resulting erlang.mk file. You can start from the and customize to your needs.
build.config文件包含
You can also name the file differently or put it in a separate folder by modifying the value for ERLANG_MK_BUILD_CONFIG
. You can also tell Erlang.mk to use a different temporary directory by changing the ERLANG_MK_BUILD_DIR
variable.