From owner-freebsd-current@FreeBSD.ORG Thu Feb 5 06:41:00 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8CD1E16A4CF; Thu, 5 Feb 2004 06:41:00 -0800 (PST) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 4199943D48; Thu, 5 Feb 2004 06:40:49 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from mailproxy2.pacific.net.au (mailproxy2.pacific.net.au [61.8.0.87])i15Eem5O028092; Fri, 6 Feb 2004 01:40:48 +1100 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i15EejYc012885; Fri, 6 Feb 2004 01:40:46 +1100 Date: Fri, 6 Feb 2004 01:40:45 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Ruslan Ermilov In-Reply-To: <20040205091634.GC13932@FreeBSD.org.ua> Message-ID: <20040206012805.N8113@gamplex.bde.org> References: <20040205091634.GC13932@FreeBSD.org.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: Juli Mallett cc: Warner Losh cc: current@FreeBSD.org cc: Bruce Evans Subject: Re: Very long SRCS list with unusually long src/ prefix X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Feb 2004 14:41:01 -0000 On Thu, 5 Feb 2004, Ruslan Ermilov wrote: > Attached is the patch for bsd.dep.mk that addresses the problem > of "make depend" hitting the E2BIG limit when running mkdep(1) > with a very long argument list, caused by very long SRCS list > (as in libc), and with unusually long src/ prefix, that some of > you have experienced in the past. > (Don't suggest an approach used by NetBSD, by running mkdep(1) > for each source file separately. It has been attempted and is > deemed inefficient.) % Index: bsd.dep.mk % =================================================================== % RCS file: /home/ncvs/src/share/mk/bsd.dep.mk,v % retrieving revision 1.45 % diff -u -r1.45 bsd.dep.mk % --- bsd.dep.mk 27 Jan 2004 23:22:15 -0000 1.45 % +++ bsd.dep.mk 5 Feb 2004 08:36:59 -0000 % @@ -126,24 +126,35 @@ % # Different types of sources are compiled with slightly different flags. % # Split up the sources, and filter out headers and non-applicable flags. % DPSRCS+= ${SRCS} % + % +_mkdep_cS: ${DPSRCS:M*.[cS]:S/^/_mkdep_/} % +_mkdep_cc: ${DPSRCS:M*.cc:S/^/_mkdep_/} ${DPSRCS:M*.C:S/^/_mkdep_/} \ % + ${DPSRCS:M*.cpp:S/^/_mkdep_/} ${DPSRCS:M*.cxx:S/^/_mkdep_/} % +_mkdep_m: ${DPSRCS:M*.m:S/^/_mkdep_/} % +.for f in ${DPSRCS:M*.[cS]} ${DPSRCS:M*.cc} ${DPSRCS:M*.C} ${DPSRCS:M*.cpp} \ % + ${DPSRCS:M*.cxx} ${DPSRCS:M*.m} % +_mkdep_${f}: ${f} % + @echo ${.ALLSRC} % +.endfor % + This seems to run echo once for each file separately. It should be deemed inefficient :-). I can't see anything better using current make features. The make -V hack doesn't work with local variables. This and some other things would be easier and more efficient if make had a builtin echo. Then we could just use "builtin_echo ${.ALLSRC:M*.[cS]} | mkdep ..." in the rules below, and the make -V hack would not be needed in kern.post.mk. % ${DEPENDFILE}: ${DPSRCS} % rm -f ${DEPENDFILE} % .if !empty(DPSRCS:M*.[cS]) % - ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \ % - ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BID]*} \ % - ${.ALLSRC:M*.[cS]} % + (cd ${.CURDIR}; ${MAKE} _mkdep_cS) | xargs env \ % + ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \ % + ${CFLAGS:M-nostdinc*} ${CFLAGS:M-[BID]*} make uses a real shell, so the env shouldn't be needed. Bruce