summaryrefslogtreecommitdiffstats
path: root/docs/en/erlang.mk/1/guide/external_plugins.asciidoc
diff options
context:
space:
mode:
Diffstat (limited to 'docs/en/erlang.mk/1/guide/external_plugins.asciidoc')
-rw-r--r--docs/en/erlang.mk/1/guide/external_plugins.asciidoc54
1 files changed, 54 insertions, 0 deletions
diff --git a/docs/en/erlang.mk/1/guide/external_plugins.asciidoc b/docs/en/erlang.mk/1/guide/external_plugins.asciidoc
index d3dafaac..68deb825 100644
--- a/docs/en/erlang.mk/1/guide/external_plugins.asciidoc
+++ b/docs/en/erlang.mk/1/guide/external_plugins.asciidoc
@@ -75,3 +75,57 @@ The `THIS` variable is required to relatively include files.
This allows users to not only be able to select individual
plugins, but also select all plugins from the dependency
in one go if they wish to do so.
+
+=== Early-stage plugins
+
+Plugins declared in `DEP_PLUGINS` are loaded near the end of Erlang.mk.
+That's why you have access to all previously initialized variables.
+However, if you want your plugin to add common dependencies to
+your applications, a regular is loaded too late in the process.
+You need to use "Early-stage plugins". They are declared using the
+`DEP_EARLY_PLUGINS` variable instead. Plugins listed in this variable
+are loaded near the beginning of Erlang.mk Otherwise, they work exactly
+the same.
+
+If you only give the name of a dependency, the default file loaded is
+'early-plugins.mk'. You can specify a filename exactly like you would
+have done it with regular plugins.
+
+[source,make]
+# In your application's Makefile
+BUILD_DEPS = common_deps
+DEP_EARLY_PLUGINS = common_deps
+
+[source,make]
+# In the plugin's early-plugins.mk
+DEPS += cowboy
+TEST_DEPS = ct_helper
+dep_ct_helper = git https://github.com/ninenines/ct_helper master
+
+=== Loading plugins local to the application
+
+If the Erlang.mk plugin lives in the same directory or repository as your
+application or library, then you can load it exactly like an external
+plugin: the dependency name is simply the name of your application or
+library.
+
+For example, the following Makefile loads a plugin in the 'mk'
+subdirectory:
+
+[source,make]
+DEP_PLUGINS = $(PROJECT)/mk/dist.mk
+
+This also works with early-stage plugins:
+
+[source,make]
+DEP_EARLY_PLUGINS = $(PROJECT)/mk/variables.mk
+
+Like external plugins, if you do not specify the path to the plugin, it
+defaults to 'plugins.mk' or 'early-plugins.mk', located at the root of
+your application:
+
+[source,make]
+# Loads ./early-plugins.mk
+DEP_EARLY_PLUGINS = $(PROJECT)
+# Loads ./plugins.mk
+DEP_PLUGINS = $(PROJECT)