changeset 2852:f2bec2d589d6

Parallel dependency resolution by Jonathan Schleifer.
author Tony Vroon <chainsaw@gentoo.org>
date Wed, 30 Jul 2008 23:04:46 +0100
parents 7a000caead28
children 59ff744e1e23
files buildsys.mk.in
diffstat 1 files changed, 28 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/buildsys.mk.in	Wed Jul 30 17:25:24 2008 +0300
+++ b/buildsys.mk.in	Wed Jul 30 23:04:46 2008 +0100
@@ -1,5 +1,5 @@
 #
-#  Copyright (c) 2007, Jonathan Schleifer <js-buildsys@webkeks.org>
+#  Copyright (c) 2007 - 2008, Jonathan Schleifer <js-buildsys@webkeks.org>
 #
 #  https://webkeks.org/hg/buildsys/
 #
@@ -46,7 +46,7 @@
 LIB_LDFLAGS = @LIB_LDFLAGS@
 LIB_PREFIX = @LIB_PREFIX@
 LIB_SUFFIX = @LIB_SUFFIX@
-PLUGIN_DEFNAME = `echo -n ${subst ${PLUGIN_SUFFIX},,${PLUGIN}} | tr [:lower:] [:upper:] | tr -C [:alnum:] _`
+PLUGIN_DEFNAME = `echo ${subst ${PLUGIN_SUFFIX},,${PLUGIN}} | tr [:lower:] [:upper:]`
 PLUGIN_CPPFLAGS = @PLUGIN_CPPFLAGS@ -D${PLUGIN_DEFNAME}_CFGID=\"${subst ${PLUGIN_SUFFIX},,${PLUGIN}}\"
 PLUGIN_CFLAGS = @PLUGIN_CFLAGS@
 PLUGIN_LDFLAGS = @PLUGIN_LDFLAGS@
@@ -75,11 +75,11 @@
 OBJS3 = ${OBJS2:.cxx=.o}
 OBJS4 = ${OBJS3:.d=.o}
 OBJS5 = ${OBJS4:.erl=.beam}
-OBJS += ${OBJS5:.m=.o}
-DEPS += ${OBJS:.o=.dep}
+OBJS6 = ${OBJS5:.m=.o}
+OBJS += ${OBJS6:.xpm=.o}
 
 .SILENT:
-.SUFFIXES: .beam .c .cc .cxx .d .dep .erl .m
+.SUFFIXES: .beam .c .cc .cxx .d .dep .erl .m .xpm
 .PHONY: all subdirs pre-depend depend install install-extra uninstall uninstall-extra clean distclean
 
 all:
@@ -96,17 +96,25 @@
 
 depend: pre-depend ${SRCS}
 	regen=0; \
+	deps=""; \
 	test -f .deps || regen=1; \
-	for i in ${SRCS}; do test $$i -nt .deps && regen=1; done; \
-	if test x"$$regen" = x"1" -a x"${DEPS}" != "x"; then \
+	for i in ${SRCS}; do \
+		case $$i in \
+			*.o) \
+				test $$i -nt .deps && regen=1; \
+				deps="$${deps%.o}.dep $$i"; \
+				;; \
+		esac; \
+	done; \
+	if test x"$$regen" = x"1" -a x"$$deps" != "x"; then \
 		${DEPEND_STATUS}; \
 		rm -f .deps; \
-		if ${MAKE} ${MFLAGS} ${DEPS}; then \
-			cat ${DEPS} >.deps; \
-			rm -f ${DEPS}; \
+		if ${MAKE} ${MFLAGS} $$deps; then \
+			cat $$deps >.deps; \
+			rm -f $$deps; \
 			${DEPEND_OK}; \
 		else \
-			rm -f .deps ${DEPS}; \
+			rm -f .deps $$deps; \
 			${DEPEND_FAILED}; \
 		fi; \
 	fi
@@ -115,6 +123,7 @@
 	${CPP} ${CPPFLAGS} -M $< >$@
 
 .d.dep:
+.xpm.dep:
 
 pre-depend:
 
@@ -198,6 +207,14 @@
 		${COMPILE_FAILED}; \
 	fi
 
+.xpm.o:
+	${COMPILE_STATUS}
+	if ${CC} ${CFLAGS} ${CPPFLAGS} -x c -c -o $@ $<; then \
+		${COMPILE_OK}; \
+	else \
+		${COMPILE_FAILED}; \
+	fi
+
 install: ${LIB} ${STATIC_LIB} ${PLUGIN} ${PROG} install-extra
 	for i in ${SUBDIRS}; do \
 		${DIR_ENTER}; \