From 724521b68c19f107437db9fa2ee8def6ff604e0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?=
 <jean-sebastien@rabbitmq.com>
Date: Fri, 12 May 2017 10:19:24 +0200
Subject: Support plugins local to the application

If the application's Makefile specify either:
    DEP_PLUGINS = $(PROJECT)
or e.g.:
    DEP_PLUGINS = $(PROJECT)/mk/dist.mk
then load the plugin from the application instead of a dependency.

This helps when you have an application with common Erlang modules and
Erlang.mk plugins: your common application can load Erlang.mk plugins
exactly like other applications depending on the common application.
---
 doc/src/guide/external_plugins.asciidoc | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

(limited to 'doc/src/guide/external_plugins.asciidoc')

diff --git a/doc/src/guide/external_plugins.asciidoc b/doc/src/guide/external_plugins.asciidoc
index c398c59..68deb82 100644
--- a/doc/src/guide/external_plugins.asciidoc
+++ b/doc/src/guide/external_plugins.asciidoc
@@ -101,3 +101,31 @@ DEP_EARLY_PLUGINS = common_deps
 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)
-- 
cgit v1.2.3

