aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2018-11-29 15:34:27 +0100
committerLoïc Hoguin <[email protected]>2018-11-29 15:34:27 +0100
commit305080b98a4312591efe03872be99951ac09da6e (patch)
tree62769599e56c98408dc601b77c7e096466df1669
parent2d35cb644d973f81af09c6f8d342e4838a548f7b (diff)
downloaderlang.mk-305080b98a4312591efe03872be99951ac09da6e.tar.gz
erlang.mk-305080b98a4312591efe03872be99951ac09da6e.tar.bz2
erlang.mk-305080b98a4312591efe03872be99951ac09da6e.zip
Add the target help-plugins to document external plugins
It's better than extending help:: because this gets printed at the end instead of before Erlang.mk's own help.
-rw-r--r--core/plugins.mk5
-rw-r--r--doc/src/guide/external_plugins.asciidoc9
-rw-r--r--test/core_plugins.mk24
3 files changed, 38 insertions, 0 deletions
diff --git a/core/plugins.mk b/core/plugins.mk
index d540e7d..17bad7a 100644
--- a/core/plugins.mk
+++ b/core/plugins.mk
@@ -9,3 +9,8 @@ $(foreach p,$(DEP_PLUGINS),\
$(eval $(if $(findstring /,$p),\
$(call core_dep_plugin,$p,$(firstword $(subst /, ,$p))),\
$(call core_dep_plugin,$p/plugins.mk,$p))))
+
+help:: help-plugins
+
+help-plugins::
+ $(verbose) :
diff --git a/doc/src/guide/external_plugins.asciidoc b/doc/src/guide/external_plugins.asciidoc
index 68deb82..5f165f5 100644
--- a/doc/src/guide/external_plugins.asciidoc
+++ b/doc/src/guide/external_plugins.asciidoc
@@ -76,6 +76,15 @@ 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.
+Plugins can include some help text by extending the target
+`help-plugins`:
+
+[source,make]
+----
+help-plugins::
+ $(verbose) printf "%s\n" "" "Run benchmark: $(MAKE) perfs"
+----
+
=== Early-stage plugins
Plugins declared in `DEP_PLUGINS` are loaded near the end of Erlang.mk.
diff --git a/test/core_plugins.mk b/test/core_plugins.mk
index 4ab71fb..7a0e53d 100644
--- a/test/core_plugins.mk
+++ b/test/core_plugins.mk
@@ -85,6 +85,30 @@ core-plugins-early-local: build clean
$i "Run 'make plugin2' and check that it prints plugin2"
$t $(MAKE) --no-print-directory -C $(APP) plugin2 | grep -qw plugin2
+core-plugins-early-help: build clean
+
+ $i "Bootstrap a new OTP library named $(APP)"
+ $t mkdir $(APP)/
+ $t cp ../erlang.mk $(APP)/
+ $t $(MAKE) -C $(APP) -f erlang.mk bootstrap-lib $v
+
+ $i "Write external plugin helpful_plugin"
+ $t mkdir $(APP)/helpful_plugin
+ $t echo "help-plugins:: ; @echo WORKING" >> $(APP)/helpful_plugin/early-plugins.mk
+
+ $i "Inject external plugin dependencies into $(APP)"
+ $t echo 'BUILD_DEPS = helpful_plugin' >> $(APP)/Makefile.tmp
+ $t echo 'DEP_EARLY_PLUGINS = helpful_plugin' >> $(APP)/Makefile.tmp
+ $t echo 'dep_helpful_plugin = cp helpful_plugin' >> $(APP)/Makefile.tmp
+ $t cat $(APP)/Makefile >> $(APP)/Makefile.tmp
+ $t mv $(APP)/Makefile.tmp $(APP)/Makefile
+
+ $i "Build the application"
+ $t $(MAKE) -C $(APP) $v
+
+ $i "Run 'make help' and check that it prints external plugins help"
+ $t test -n "`$(MAKE) -C $(APP) help` | grep WORKING"
+
core-plugins-local: build clean
$i "Bootstrap a new OTP library named $(APP)"