From cd99adbb98d8965c65f68da2853f14506756d7b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-S=C3=A9bastien=20P=C3=A9dron?= Date: Fri, 12 May 2017 09:30:45 +0200 Subject: Support early-stage plugins through `$(DEP_EARLY_PLUGINS)` Regular plugins (`$(DEP_PLUGINS)`) are loaded near the end of Erlang.mk. This is fine when you want to modify variables initialized earlier in Erlang.mk or add new targets and variables. However, it doesn't allow you to declare more dependencies because they are loaded too late for that. This commit introduces a new variable, `$(DEP_EARLY_PLUGINS)`, which can be used to list plugins meant to be loaded near the beginning of Erlang.mk. Those allow to append to the list of dependencies. They work exactly like regular plugins otherwise. The default filename loaded is `early-plugins.mk`. --- core/deps.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'core/deps.mk') diff --git a/core/deps.mk b/core/deps.mk index 671ac45..719691a 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -21,6 +21,22 @@ export DEPS_DIR REBAR_DEPS_DIR = $(DEPS_DIR) export REBAR_DEPS_DIR +# External "early" plugins (see core/plugins.mk for regular plugins). +# They both use the core_dep_plugin macro. + +define core_dep_plugin +-include $(DEPS_DIR)/$(1) + +$(DEPS_DIR)/$(1): $(DEPS_DIR)/$(2) ; +endef + +DEP_EARLY_PLUGINS ?= + +$(foreach p,$(DEP_EARLY_PLUGINS),\ + $(eval $(if $(findstring /,$p),\ + $(call core_dep_plugin,$p,$(firstword $(subst /, ,$p))),\ + $(call core_dep_plugin,$p/early-plugins.mk,$p)))) + dep_name = $(if $(dep_$(1)),$(1),$(if $(pkg_$(1)_name),$(pkg_$(1)_name),$(1))) dep_repo = $(patsubst git://github.com/%,https://github.com/%, \ $(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo))) -- cgit v1.2.3