aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/deps.mk89
-rw-r--r--core/erlc.mk4
-rw-r--r--core/test.mk2
3 files changed, 53 insertions, 42 deletions
diff --git a/core/deps.mk b/core/deps.mk
index cfbf9a4..c3842d1 100644
--- a/core/deps.mk
+++ b/core/deps.mk
@@ -201,7 +201,7 @@ define dep_autopatch_rebar.erl
false -> ok;
{Name, Source} ->
{Method, Repo, Commit} = case Source of
- {hex, V} -> {hex, undefined, V};
+ {hex, V} -> {hex, V, undefined};
{git, R} -> {git, R, master};
{M, R, {branch, C}} -> {M, R, C};
{M, R, {ref, C}} -> {M, R, C};
@@ -472,7 +472,25 @@ define dep_autopatch_appsrc.erl
halt()
endef
-define hex_fetch.erl
+define dep_fetch_git
+ git clone -q -n -- $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)); \
+ cd $(DEPS_DIR)/$(call dep_name,$(1)) && git checkout -q $(call dep_commit,$(1));
+endef
+
+define dep_fetch_hg
+ hg clone -q -U $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1)); \
+ cd $(DEPS_DIR)/$(call dep_name,$(1)) && hg update -q $(call dep_commit,$(1));
+endef
+
+define dep_fetch_svn
+ svn checkout -q $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1));
+endef
+
+define dep_fetch_cp
+ cp -R $(call dep_repo,$(1)) $(DEPS_DIR)/$(call dep_name,$(1));
+endef
+
+define dep_fetch_hex.erl
ssl:start(),
inets:start(),
{ok, {{_, 200, _}, _, Body}} = httpc:request(get,
@@ -484,49 +502,42 @@ define hex_fetch.erl
halt()
endef
+# Hex only has a package version. No need to look in the Erlang.mk packages.
+define dep_fetch_hex
+ $(call erlang,$(call dep_fetch_hex.erl,$(1),$(strip $(word 2,$(dep_$(1))))));
+endef
+
+define dep_fetch_fail
+ echo "Unknown or invalid dependency: $(1). Please consult the erlang.mk README for instructions." >&2; \
+ exit 78;
+endef
+
+# Kept for compatibility purposes with older Erlang.mk configuration.
+define dep_fetch_legacy
+ $(warning WARNING: '$(1)' dependency configuration uses deprecated format.) \
+ git clone -q -n -- $(word 1,$(dep_$(1))) $(DEPS_DIR)/$(1); \
+ cd $(DEPS_DIR)/$(1) && git checkout -q $(if $(word 2,$(dep_$(1))),$(word 2,$(dep_$(1))),master);
+endef
+
define dep_fetch
- if [ "$(2)" = "git" ]; then \
- git clone -q -n -- $(3) $(DEPS_DIR)/$(1); \
- cd $(DEPS_DIR)/$(1) && git checkout -q $(4); \
- elif [ "$(2)" = "hg" ]; then \
- hg clone -q -U $(3) $(DEPS_DIR)/$(1); \
- cd $(DEPS_DIR)/$(1) && hg update -q $(4); \
- elif [ "$(2)" = "svn" ]; then \
- svn checkout -q $(3) $(DEPS_DIR)/$(1); \
- elif [ "$(2)" = "cp" ]; then \
- cp -R $(3) $(DEPS_DIR)/$(1); \
- elif [ "$(2)" = "hex" ]; then \
- $(call erlang,$(call hex_fetch.erl,$(1),$(strip $(4)))); \
- else \
- echo "Unknown or invalid dependency: $(1). Please consult the erlang.mk README for instructions." >&2; \
- exit 78; \
- fi
+ $(if $(dep_$(1)), \
+ $(if $(dep_fetch_$(word 1,$(dep_$(1)))), \
+ $(word 1,$(dep_$(1))), \
+ legacy), \
+ $(if $(filter $(1),$(PACKAGES)), \
+ $(pkg_$(1)_fetch), \
+ fail))
endef
+dep_name = $(if $(dep_$(1)),$(1),$(pkg_$(1)_name))
+dep_repo = $(patsubst git://github.com/%,https://github.com/%, \
+ $(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo)))
+dep_commit = $(if $(dep_$(1)),$(word 3,$(dep_$(1))),$(pkg_$(1)_commit))
+
define dep_target
$(DEPS_DIR)/$(1):
$(verbose) mkdir -p $(DEPS_DIR)
-ifeq (,$(dep_$(1)))
- $(dep_verbose) $(call dep_fetch,$(pkg_$(1)_name),$(pkg_$(1)_fetch), \
- $(patsubst git://github.com/%,https://github.com/%,$(pkg_$(1)_repo)), \
- $(pkg_$(1)_commit))
-else
-ifeq (1,$(words $(dep_$(1))))
- $(dep_verbose) $(call dep_fetch,$(1),git, \
- $(patsubst git://github.com/%,https://github.com/%,$(dep_$(1))), \
- master)
-else
-ifeq (2,$(words $(dep_$(1))))
- $(dep_verbose) $(call dep_fetch,$(1),git, \
- $(patsubst git://github.com/%,https://github.com/%,$(word 1,$(dep_$(1)))), \
- $(word 2,$(dep_$(1))))
-else
- $(dep_verbose) $(call dep_fetch,$(1),$(word 1,$(dep_$(1))), \
- $(patsubst git://github.com/%,https://github.com/%,$(word 2,$(dep_$(1)))), \
- $(word 3,$(dep_$(1))))
-endif
-endif
-endif
+ $(dep_verbose) $(call dep_fetch_$(strip $(call dep_fetch,$(1))),$(1))
$(verbose) if [ -f $(DEPS_DIR)/$(1)/configure.ac -o -f $(DEPS_DIR)/$(1)/configure.in ]; then \
echo " AUTO " $(1); \
cd $(DEPS_DIR)/$(1) && autoreconf -Wall -vif -I m4; \
diff --git a/core/erlc.mk b/core/erlc.mk
index f6bd6fd..88895a2 100644
--- a/core/erlc.mk
+++ b/core/erlc.mk
@@ -72,7 +72,7 @@ endif
app-build: erlc-include ebin/$(PROJECT).app
$(eval GITDESCRIBE := $(shell git describe --dirty --abbrev=7 --tags --always --first-parent 2>/dev/null || true))
- $(eval MODULES := $(patsubst %,'%',$(sort $(notdir $(basename $(wildcard ebin/*.beam))))))
+ $(eval MODULES := $(patsubst %,'%',$(sort $(notdir $(basename $(shell find ebin -type f -name *.beam))))))
ifeq ($(wildcard src/$(PROJECT).app.src),)
$(app_verbose) echo $(subst $(newline),,$(subst ",\",$(call app_file,$(GITDESCRIBE),$(MODULES)))) \
> ebin/$(PROJECT).app
@@ -93,7 +93,7 @@ erlc-include:
fi
define compile_erl
- $(erlc_verbose) erlc -v $(ERLC_OPTS) -o ebin/ \
+ $(erlc_verbose) erlc -v $(if $(IS_DEP),$(filter-out -Werror,$(ERLC_OPTS)),$(ERLC_OPTS)) -o ebin/ \
-pa ebin/ -I include/ $(filter-out $(ERLC_EXCLUDE_PATHS),\
$(COMPILE_FIRST_PATHS) $(1))
endef
diff --git a/core/test.mk b/core/test.mk
index acc792a..83bbecb 100644
--- a/core/test.mk
+++ b/core/test.mk
@@ -20,7 +20,7 @@ ifneq ($(SKIP_DEPS),)
test-deps:
else
test-deps: $(ALL_TEST_DEPS_DIRS)
- $(verbose) for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep; done
+ $(verbose) for dep in $(ALL_TEST_DEPS_DIRS) ; do $(MAKE) -C $$dep IS_DEP=1; done
endif
ifneq ($(wildcard $(TEST_DIR)),)