Subject: arg list too long?
To: None <tech-toolchain@netbsd.org>
From: Simon Gerraty <sjg@juniper.net>
List: tech-toolchain
Date: 06/01/2005 16:24:12
I hit this when trying to cross-build -current on a freebsd box.
Eventually the arg list will become too long, so the following patch 
might be useful...  (I think I posted this patch last year some time)

--sjg

Index: sys/conf/Makefile.kern.inc
===================================================================
RCS file: /cvsroot/src/sys/conf/Makefile.kern.inc,v
retrieving revision 1.65
diff -u -p -r1.65 Makefile.kern.inc
--- sys/conf/Makefile.kern.inc	1 Jun 2005 00:11:32 -0000	1.65
+++ sys/conf/Makefile.kern.inc	1 Jun 2005 23:21:09 -0000
@@ -295,11 +295,24 @@ dependall: depend all
 SRCS?=		${MD_SFILES} ${MD_CFILES} ${MI_CFILES} ${CFILES} ${SFILES}
 MKDEP_AFLAGS?=	${AFLAGS}
 MKDEP_CFLAGS?=	${CFLAGS}
+# We have to assume that we'll eventually run out of command line.
+# We already hit that on non-NetBSD hosts.
+_SFILES=${MD_SFILES} ${SFILES}
+_CFILES=${MD_CFILES} ${MI_CFILES} ${CFILES}
+_XargsMKDEP=${MKDEP:M*=*} xargs -t ${MKDEP:N*=*}
+
+# This dance is necessary to avoid long command lines.
+${SRCS:S,^,list-,}:
+	@echo ${.TARGET:S,^list-,,}
+
+_sfiles: ${_SFILES:S,^,list-,}
+_cfiles: ${_CFILES:S,^,list-,}
+
 .depend: ${SRCS} assym.h config_time.h
 	${_MKTARGET_CREATE}
-	${MKDEP} -- ${MKDEP_AFLAGS} ${CPPFLAGS} ${MD_SFILES} ${SFILES}
-	${MKDEP} -a -- ${MKDEP_CFLAGS} ${CPPFLAGS} ${MD_CFILES} ${MI_CFILES} \
-	    ${CFILES}
+	@> $@
+	@${.MAKE} -f ${MAKEFILE} _sfiles | ${_XargsMKDEP} -a -- ${MKDEP_AFLAGS} ${CPPFLAGS} 
+	@${.MAKE} -f ${MAKEFILE} _cfiles | ${_XargsMKDEP} -a -- ${MKDEP_CFLAGS} ${CPPFLAGS}
 	cat ${GENASSYM_CONF} ${GENASSYM_EXTRAS} | \
 	    ${GENASSYM} -- ${MKDEP} -f assym.dep -- \
 	    ${CFLAGS} ${CPPFLAGS}