From 750bdd359b0db9fc665d9a371b65ec7bb5d037c7 Mon Sep 17 00:00:00 2001 From: Jeffrey Griffin Date: Fri, 17 Feb 2017 11:16:57 -0800 Subject: compile apps in the right order by looking at their LOCAL_DEPS we also use LOCAL_DEPS at the top-level, if it exists, to determine which local apps to compile, in the interest of saving compile time for projects that have many apps and multiple release configurations --- core/deps.mk | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'core') diff --git a/core/deps.mk b/core/deps.mk index 994d484..43632ed 100644 --- a/core/deps.mk +++ b/core/deps.mk @@ -26,6 +26,7 @@ dep_repo = $(patsubst git://github.com/%,https://github.com/%, \ $(if $(dep_$(1)),$(word 2,$(dep_$(1))),$(pkg_$(1)_repo))) dep_commit = $(if $(dep_$(1)_commit),$(dep_$(1)_commit),$(if $(dep_$(1)),$(word 3,$(dep_$(1))),$(pkg_$(1)_commit))) +LOCAL_DEPS_DIRS = $(foreach a,$(LOCAL_DEPS),$(if $(wildcard $(APPS_DIR)/$(a)),$(APPS_DIR)/$(a))) ALL_APPS_DIRS = $(if $(wildcard $(APPS_DIR)/),$(filter-out $(APPS_DIR),$(shell find $(APPS_DIR) -maxdepth 1 -type d))) ALL_DEPS_DIRS = $(addprefix $(DEPS_DIR)/,$(foreach dep,$(filter-out $(IGNORE_DEPS),$(BUILD_DEPS) $(DEPS)),$(call dep_name,$(dep)))) @@ -48,9 +49,6 @@ dep_verbose = $(dep_verbose_$(V)) # Core targets. -ifdef IS_APP -apps:: -else apps:: $(ALL_APPS_DIRS) clean-tmp-deps.log ifeq ($(IS_APP)$(IS_DEP),) $(verbose) rm -f $(ERLANG_MK_TMP)/apps.log @@ -59,10 +57,15 @@ endif # Create ebin directory for all apps to make sure Erlang recognizes them # as proper OTP applications when using -include_lib. This is a temporary # fix, a proper fix would be to compile apps/* in the right order. +ifndef IS_APP $(verbose) for dep in $(ALL_APPS_DIRS) ; do \ mkdir -p $$dep/ebin || exit $$?; \ done - $(verbose) for dep in $(ALL_APPS_DIRS) ; do \ +endif +# at the toplevel: if LOCAL_DEPS is defined with at least one local app, only +# compile that list of apps. otherwise, compile everything. +# within an app: compile all LOCAL_DEPS that are (uncompiled) local apps + $(verbose) for dep in $(if $(LOCAL_DEPS_DIRS)$(IS_APP),$(LOCAL_DEPS_DIRS),$(ALL_APPS_DIRS)) ; do \ if grep -qs ^$$dep$$ $(ERLANG_MK_TMP)/apps.log; then \ :; \ else \ @@ -70,7 +73,6 @@ endif $(MAKE) -C $$dep IS_APP=1 || exit $$?; \ fi \ done -endif clean-tmp-deps.log: ifeq ($(IS_APP)$(IS_DEP),) -- cgit v1.2.3