changeset 2372:3799c5a932a9

Make dependency generation threaded.
author Jonathan Schleifer <js-audacious@webkeks.org>
date Sun, 10 Feb 2008 10:23:20 +0100
parents 47f6f73438c3
children 77cd6da06def
files buildsys.mk.in
diffstat 1 files changed, 13 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/buildsys.mk.in	Sun Feb 10 07:32:37 2008 +0300
+++ b/buildsys.mk.in	Sun Feb 10 10:23:20 2008 +0100
@@ -72,9 +72,10 @@
 OBJS4 = ${OBJS3:.d=.o}
 OBJS5 = ${OBJS4:.erl=.beam}
 OBJS += ${OBJS5:.m=.o}
+DEPS += ${OBJS:.o=.dep}
 
 .SILENT:
-.SUFFIXES: .beam .c .cc .cxx .d .erl .m
+.SUFFIXES: .beam .c .cc .cxx .d .dep .erl .m
 .PHONY: all subdirs pre-depend depend install install-extra uninstall uninstall-extra clean distclean
 
 all:
@@ -94,24 +95,21 @@
 	test -f .deps || regen=1; \
 	for i in ${SRCS}; do test $$i -nt .deps && regen=1; done; \
 	if test x"$$regen" = x"1"; then \
-		list=""; \
 		${DEPEND_STATUS}; \
-		for i in ${SRCS}; do \
-			case $${i##*.} in \
-			c|cc|cxx|m) \
-				list="$$list $$i"; \
-				;; \
-			esac; \
-		done; \
-		if test x"$$list" != "x"; then \
-			if ${CC} ${CPPFLAGS} -M $$list >.deps; then \
-				${DEPEND_OK}; \
-			else \
-				${DEPEND_FAILED}; \
-			fi; \
+		rm -f .deps; \
+		if ${MAKE} ${MFLAGS} ${DEPS}; then \
+			${DEPEND_OK}; \
+		else \
+			rm -f .deps; \
+			${DEPEND_FAILED}; \
 		fi; \
 	fi
 
+.c.dep .cc.dep .cxx.dep .m.dep:
+	${CPP} ${CPPFLAGS} -M $< >>.deps
+
+.d.dep:
+
 pre-depend:
 
 ${PROG} ${PROG_NOINST}: ${EXT_DEPS} ${OBJS}