还要注意,拉取和构建不是并行的,先拉取所有依赖项之后才开始构建
##### 只拉取和只列出依赖项(Fetching and listing dependencies only)
只拉取依赖项
```
make fetch-deps
```
只列出依赖项
```
make list-deps
```
但是这只是针对```DEPS```和```BUILD_DEPS```参数的依赖项,上面我们还提到了```TEST_DEPS```、```DOC_DEPS```、```REL_DEPS```和```SHELL_DEPS```,这些怎么办呢?有两个办法:
1. 用下面命令
```
make fetch-test-deps
make fetch-doc-deps
make fetch-rel-deps
make fetch-shell-deps
make list-test-deps
make list-doc-deps
make list-rel-deps
make list-shell-deps
```
2. 或者在```make fetch-deps```或```make list-deps```后面接```DEP_TYPES```参数,参数值可以是test, doc, rel和shell,例如```list-deps DEP_TYPES='test doc'```
```make new-app```或者```make new-lib```创建本地依赖库到指定目录,例如:
```
make new-app in=webchat
make new-lib in=webchat
```
创建模板也可以用本地依赖库
```
make new t=gen_server n=my_server in=webchat
```
##### 自动修补(autopatch)
erlang.mk会自动修补拉取的所有依赖项,这是为了兼容各个正在使用的erlang.mk版本
拉取依赖项的时候,会执行以下操作:
- 按照拉取方法拉取依赖项
- 如果包含有config.ac或者config.in文件,运行autoreconf -Wall -vif -I m4
- 如果包含config脚本,运行脚本
- 在项目中运行autopatch
autopatch首先检查是否启用了项目指定的修补程序,例如```amqp_client```依赖项的```RABBITMQ_CLIENT_PATCH```,或者```rabbit```依赖项的```RABBITMQ_SERVER_PATCH```,这些只有RabbitMQkpg3.6.0才需要的参数
好吧,说实话这部分看不懂,感觉有点费解,直接上原文吧
- Rebar projects are automatically converted to use Erlang.mk as their build tool. This essentially patches Rebar out, and fixes and converts the project to be compatible with Erlang.mk.
- Erlang.mk projects have their Makefile patched, if necessary, to include the top-level project’s Erlang.mk. This is to ensure that functionality works across all dependencies, even if the dependency’s Erlang.mk is outdated. The patched Makefile can be safely committed if necessary.
- Other Erlang projects get a small Erlang.mk Makefile generated automatically.
- Projects with no source directory and no Makefile get an empty Makefile generated, for compatibility purposes.
- Other projects with no Makefile are left untouched.
你可以停止erlang.mk的替换通过```NO_AUTOPATH_ERLANG_MK```参数
```
NO_AUTOPATCH_ERLNAG_MK = 1
```
你也可以让一些项目完全停止autopatch
```
NO_AUTOPATCH = cowboy ranch cowlib
```
##### 跳过依赖项(Skipping deps)
比如不想编译依赖项
```
make SKIP_DEPS=1
```
如果启用这个参数:
- ```make distclean```命令将不移除```$(DEPS_DIR)```文件
- 依赖项将不被下载和编译