diff options
author | Jean-Sébastien Pédron <[email protected]> | 2017-05-12 09:30:45 +0200 |
---|---|---|
committer | Loïc Hoguin <[email protected]> | 2017-05-12 11:57:30 +0200 |
commit | cd99adbb98d8965c65f68da2853f14506756d7b3 (patch) | |
tree | 697617c1a027e425ad67d0fc6f042bf81abbd585 /core | |
parent | ae5415d4a1000022c568932e7a6efa96e684b016 (diff) | |
download | erlang.mk-cd99adbb98d8965c65f68da2853f14506756d7b3.tar.gz erlang.mk-cd99adbb98d8965c65f68da2853f14506756d7b3.tar.bz2 erlang.mk-cd99adbb98d8965c65f68da2853f14506756d7b3.zip |
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`.
Diffstat (limited to 'core')
-rw-r--r-- | core/deps.mk | 16 | ||||
-rw-r--r-- | core/plugins.mk | 6 |
2 files changed, 16 insertions, 6 deletions
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))) diff --git a/core/plugins.mk b/core/plugins.mk index 73f2d47..d540e7d 100644 --- a/core/plugins.mk +++ b/core/plugins.mk @@ -5,12 +5,6 @@ DEP_PLUGINS ?= -define core_dep_plugin --include $(DEPS_DIR)/$(1) - -$(DEPS_DIR)/$(1): $(DEPS_DIR)/$(2) ; -endef - $(foreach p,$(DEP_PLUGINS),\ $(eval $(if $(findstring /,$p),\ $(call core_dep_plugin,$p,$(firstword $(subst /, ,$p))),\ |