Browse Source

Compile dependencies only once

We keep track of which dependencies we compiled in the current
session in the $(ERLANG_MK_TMP)/deps.log file.

This will help save a little time when projects depend more than
once on the same dependency. While going in the directory and
running make was already quick, it's quicker if not, and the
logs end up cleaner.
Loïc Hoguin 10 years ago
parent
commit
dd3f29a5bc
1 changed files with 13 additions and 5 deletions
  1. 13 5
      core/deps.mk

+ 13 - 5
core/deps.mk

@@ -40,13 +40,21 @@ ifneq ($(SKIP_DEPS),)
 deps::
 deps::
 else
 else
 deps:: $(ALL_DEPS_DIRS)
 deps:: $(ALL_DEPS_DIRS)
+ifneq ($(IS_DEP),1)
+	@rm -f $(ERLANG_MK_TMP)/deps.log
+endif
 	@for dep in $(ALL_DEPS_DIRS) ; do \
 	@for dep in $(ALL_DEPS_DIRS) ; do \
-		if [ -f $$dep/GNUmakefile ] || [ -f $$dep/makefile ] || [ -f $$dep/Makefile ] ; then \
-			$(MAKE) -C $$dep IS_DEP=1 || exit $$? ; \
+		if grep -q ^$$dep$$$$ $(ERLANG_MK_TMP)/deps.log; then \
+			echo -n; \
 		else \
 		else \
-			echo "ERROR: No Makefile to build dependency $$dep." ; \
-			exit 1 ; \
-		fi ; \
+			echo $$dep >> $(ERLANG_MK_TMP)/deps.log; \
+			if [ -f $$dep/GNUmakefile ] || [ -f $$dep/makefile ] || [ -f $$dep/Makefile ]; then \
+				$(MAKE) -C $$dep IS_DEP=1 || exit $$?; \
+			else \
+				echo "ERROR: No Makefile to build dependency $$dep."; \
+				exit 1; \
+			fi \
+		fi \
 	done
 	done
 endif
 endif