DEPS = cowboy
From c807880f7ac73f813b2660ea81a00f7712a4e793 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Once you find the package you need, adding it as a dependency
to your project is a one-liner: And that’s it! The next time you run For example, you could add a parse transform project like
this to make it available only at build time: Or you could depend on a C project directly, if you are
building a NIF: This dependency will be built before your application, so
you could easily copy the resulting shared file into your
priv/ directory as part of the build process. More information
@@ -155,43 +142,22 @@ Do note that there is no way to choose the version, the
application used will be the one already on your system. You could depend on the Crypto application, for example: Erlang.mk comes with additional types of dependencies.
It has And All these will be documented in more details in their respective
chapters.DEPS = cowboy
make
, Erlang.mk will
fetch and compile Cowboy. Erlang.mk will also ensure Cowboy
is available whenever you use the shell, run tests and any
@@ -128,20 +124,11 @@ dependencies.BUILD_DEPS = erlando
BUILD_DEPS = leveldb
-dep_leveldb = git https://github.com/basho/leveldb 2.1.3
LOCAL_DEPS = crypto
TEST_DEPS
for dependencies used only for testing:TEST_DEPS = ct_helper
-dep_ct_helper = git https://github.com/ninenines/ct_helper master
DOC_DEPS
for dependencies used only when building documentation:DOC_DEPS = edown
REL_DEPS
for dependencies required to build the release,
or to include extra applications in the release:REL_DEPS = recon
SHELL_DEPS
for dependencies to make available when running
the make shell
command:SHELL_DEPS = tddreloader
DEPS = cowboy
If you need a different version, you need to define another variable. There are two ways to do this, each being useful for different reasons.
dep_$(DEP_NAME)_commit
variable. In the case of Cowboy, this would look like this:
DEPS = cowboy -dep_cowboy_commit = 2.0.0-pre.2
Erlang.mk will use the package index to get all information about Cowboy, except the commit number which will be overriden.
If you need to set the fetch method or repository information
@@ -225,12 +182,7 @@ too, for example because you want to use your own fork, or
simply because the project is missing from the index, you
can define the dep_$(DEP_NAME)
variable with everything:
DEPS = cowboy -dep_cowboy = git https://github.com/essen/cowboy 2.0.0-pre.2
This will fetch Cowboy from your fork at the given commit.
For example, to fetch Cowboy with tag 2.0.0-pre.2 from Git:
dep_cowboy = git https://github.com/ninenines/cowboy 2.0.0-pre.2
Or to fetch Ehsa tag 4.0.3 from Mercurial:
dep_ehsa = hg https://bitbucket.org/a12n/ehsa 4.0.3
Git also comes with a concept of submodules. Erlang.mk can
automatically initializes and updates submodules for dependencies,
as long as they were added beforehand using git submodule add
:
dep_cowboy = git-submodule
The svn
method only has a repository value, but that’s
simply because the SVN repository URL can also contain
the path and commit.
This would fetch an example project from the trunk:
dep_ex1 = svn https://example.com/svn/trunk/project/ex1
And this would fetch a separate example project from a specific commit:
dep_ex2 = svn svn://example.com/svn/branches/erlang-proj/ex2@264
You can copy a directory from your machine using the cp
method.
It only takes the path to copy from:
dep_cowboy = cp $(HOME)/ninenines/cowboy
Finally, you can use a package from the Hex repository:
dep_cowboy = hex 1.0.3
To give an example, this is what the Git method does:
define dep_fetch_git - git clone -q -n -- $(call dep_repo,$1) $(DEPS_DIR)/$(call dep_name,$1); \ - cd $(DEPS_DIR)/$(call dep_name,$1) && git checkout -q $(call dep_commit,$1); -endef
Note that, like dependency information, this custom fetch method must be written before including erlang.mk.
To ignore a dependency, simply add it to the IGNORE_DEPS
variable:
IGNORE_DEPS += edown proper
This will only ignore dependencies that are needed for building. It is therefore safe to write:
IGNORE_DEPS += edown proper -TEST_DEPS = proper
The PropEr application will be fetched as intended when
running make tests
or make check
. It will however
not be fetched when running make
or make deps
.
=
will work. But to avoid it biting you later on, do this:
DEPS_DIR ?= $(CURDIR)/libs
The $(CURDIR)
part is important, otherwise dependencies of
dependencies will be fetched in the wrong directory.
Erlang.mk will also export the REBAR_DEPS_DIR
variable for
@@ -656,19 +560,11 @@ Other projects with no Makefile are left untouched.
You can disable the replacing of the erlang.mk file by
defining the NO_AUTOPATCH_ERLANG_MK
variable:
NO_AUTOPATCH_ERLANG_MK = 1
You can also disable autopatch entirely for a few select
projects using the NO_AUTOPATCH
variable:
NO_AUTOPATCH = cowboy ranch cowlib