diff options
-rw-r--r-- | README.md | 13 | ||||
-rw-r--r-- | core/deps.mk | 2 | ||||
-rw-r--r-- | core/erlc.mk | 2 | ||||
-rw-r--r-- | erlang.mk | 8 | ||||
-rw-r--r-- | plugins/bootstrap.mk | 2 | ||||
-rw-r--r-- | plugins/ct.mk | 2 |
6 files changed, 25 insertions, 4 deletions
@@ -72,6 +72,15 @@ DEPS = cowboy include erlang.mk ``` +If you need to specify multiple dependencies, you can specify each +of them separated by spaces: + +``` Makefile +PROJECT = my_project +DEPS = cowboy gun +include erlang.mk +``` + If the project you want is not included in the package index, or if you want a different version, a few options are available. You can edit the package file and contribute to it by opening a pull request. @@ -206,6 +215,10 @@ variable. It takes the arguments that will then be passed to You can specify a list of modules to be compiled first using the `COMPILE_FIRST` variable. +If `{id, "git"},` is found in your project's `.app.src`, the +extended output of `git describe ...` will replace it. This +can be retrieved at runtime via `application:get_key/2`. + Bootstrap plugin ---------------- diff --git a/core/deps.mk b/core/deps.mk index 490e675..b46a7c0 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -58,8 +58,8 @@ endef define dep_target $(DEPS_DIR)/$(1): @mkdir -p $(DEPS_DIR) - @if [ ! -f $(PKG_FILE2) ]; then $(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)); fi ifeq (,$(dep_$(1))) + @if [ ! -f $(PKG_FILE2) ]; then $(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)); fi @DEPPKG=$$$$(awk 'BEGIN { FS = "\t" }; $$$$1 == "$(1)" { print $$$$2 " " $$$$3 " " $$$$4 }' $(PKG_FILE2);); \ VS=$$$$(echo $$$$DEPPKG | cut -d " " -f1); \ REPO=$$$$(echo $$$$DEPPKG | cut -d " " -f2); \ diff --git a/core/erlc.mk b/core/erlc.mk index 03e174e..a7f73f8 100644 --- a/core/erlc.mk +++ b/core/erlc.mk @@ -30,8 +30,10 @@ app:: erlc-include ebin/$(PROJECT).app echo "Empty modules entry not found in $(PROJECT).app.src. Please consult the erlang.mk README for instructions." >&2; \ exit 1; \ fi + $(eval GITDESCRIBE := $(shell git describe --dirty --abbrev=7 --tags --always --first-parent 2>/dev/null || true)) $(appsrc_verbose) cat src/$(PROJECT).app.src \ | sed "s/{modules,[[:space:]]*\[\]}/{modules, \[$(MODULES)\]}/" \ + | sed "s/{id,[[:space:]]*\"git\"}/{id, \"$(GITDESCRIBE)\"}/" \ > ebin/$(PROJECT).app define compile_erl @@ -132,8 +132,8 @@ endef define dep_target $(DEPS_DIR)/$(1): @mkdir -p $(DEPS_DIR) - @if [ ! -f $(PKG_FILE2) ]; then $(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)); fi ifeq (,$(dep_$(1))) + @if [ ! -f $(PKG_FILE2) ]; then $(call core_http_get,$(PKG_FILE2),$(PKG_FILE_URL)); fi @DEPPKG=$$$$(awk 'BEGIN { FS = "\t" }; $$$$1 == "$(1)" { print $$$$2 " " $$$$3 " " $$$$4 }' $(PKG_FILE2);); \ VS=$$$$(echo $$$$DEPPKG | cut -d " " -f1); \ REPO=$$$$(echo $$$$DEPPKG | cut -d " " -f2); \ @@ -217,8 +217,10 @@ app:: erlc-include ebin/$(PROJECT).app echo "Empty modules entry not found in $(PROJECT).app.src. Please consult the erlang.mk README for instructions." >&2; \ exit 1; \ fi + $(eval GITDESCRIBE := $(shell git describe --dirty --abbrev=7 --tags --always --first-parent 2>/dev/null || true)) $(appsrc_verbose) cat src/$(PROJECT).app.src \ | sed "s/{modules,[[:space:]]*\[\]}/{modules, \[$(MODULES)\]}/" \ + | sed "s/{id,[[:space:]]*\"git\"}/{id, \"$(GITDESCRIBE)\"}/" \ > ebin/$(PROJECT).app define compile_erl @@ -278,6 +280,7 @@ help:: bs_appsrc = "{application, $(PROJECT), [" \ " {description, \"\"}," \ " {vsn, \"0.1.0\"}," \ + " {id, \"git\"}," \ " {modules, []}," \ " {registered, []}," \ " {applications, [" \ @@ -290,6 +293,7 @@ bs_appsrc = "{application, $(PROJECT), [" \ bs_appsrc_lib = "{application, $(PROJECT), [" \ " {description, \"\"}," \ " {vsn, \"0.1.0\"}," \ + " {id, \"git\"}," \ " {modules, []}," \ " {registered, []}," \ " {applications, [" \ @@ -580,7 +584,7 @@ build-ct-deps: $(ALL_TEST_DEPS_DIRS) @for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep; done build-ct-suites: build-ct-deps - $(gen_verbose) erlc -v $(TEST_ERLC_OPTS) -o test/ \ + $(gen_verbose) erlc -v $(TEST_ERLC_OPTS) -I include/ -o test/ \ $(wildcard test/*.erl test/*/*.erl) -pa ebin/ tests-ct: ERLC_OPTS = $(TEST_ERLC_OPTS) diff --git a/plugins/bootstrap.mk b/plugins/bootstrap.mk index 084cde3..9397253 100644 --- a/plugins/bootstrap.mk +++ b/plugins/bootstrap.mk @@ -19,6 +19,7 @@ help:: bs_appsrc = "{application, $(PROJECT), [" \ " {description, \"\"}," \ " {vsn, \"0.1.0\"}," \ + " {id, \"git\"}," \ " {modules, []}," \ " {registered, []}," \ " {applications, [" \ @@ -31,6 +32,7 @@ bs_appsrc = "{application, $(PROJECT), [" \ bs_appsrc_lib = "{application, $(PROJECT), [" \ " {description, \"\"}," \ " {vsn, \"0.1.0\"}," \ + " {id, \"git\"}," \ " {modules, []}," \ " {registered, []}," \ " {applications, [" \ diff --git a/plugins/ct.mk b/plugins/ct.mk index a2e64ef..4453b70 100644 --- a/plugins/ct.mk +++ b/plugins/ct.mk @@ -45,7 +45,7 @@ build-ct-deps: $(ALL_TEST_DEPS_DIRS) @for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep; done build-ct-suites: build-ct-deps - $(gen_verbose) erlc -v $(TEST_ERLC_OPTS) -o test/ \ + $(gen_verbose) erlc -v $(TEST_ERLC_OPTS) -I include/ -o test/ \ $(wildcard test/*.erl test/*/*.erl) -pa ebin/ tests-ct: ERLC_OPTS = $(TEST_ERLC_OPTS) |