From owner-freebsd-current@FreeBSD.ORG Thu Feb 5 01:15:47 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 71FA816A4CE; Thu, 5 Feb 2004 01:15:47 -0800 (PST) Received: from phantom.cris.net (phantom.cris.net [212.110.130.74]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3539C43D1F; Thu, 5 Feb 2004 01:15:38 -0800 (PST) (envelope-from ru@FreeBSD.org.ua) Received: from phantom.cris.net (ru@localhost [127.0.0.1]) by phantom.cris.net (8.12.10/8.12.10) with ESMTP id i159GZoh014780; Thu, 5 Feb 2004 11:16:35 +0200 (EET) (envelope-from ru@FreeBSD.org.ua) Received: (from ru@localhost) by phantom.cris.net (8.12.10/8.12.10/Submit) id i159GZ4O014775; Thu, 5 Feb 2004 11:16:35 +0200 (EET) (envelope-from ru) Date: Thu, 5 Feb 2004 11:16:34 +0200 From: Ruslan Ermilov To: current@FreeBSD.org Message-ID: <20040205091634.GC13932@FreeBSD.org.ua> Mail-Followup-To: current@FreeBSD.org, Ruslan Ermilov Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ieNMXl1Fr3cevapt" Content-Disposition: inline User-Agent: Mutt/1.5.5.1i cc: Juli Mallett cc: Warner Losh cc: Bruce Evans Subject: 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 09:15:47 -0000 --ieNMXl1Fr3cevapt Content-Type: multipart/mixed; boundary="CblX+4bnyfN0pR09" Content-Disposition: inline --CblX+4bnyfN0pR09 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Gang, 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. Demo: : SRCS!=3D jot 50000 : all: : @echo mkdep ${SRCS} We already use an approach similar to what is in the patch, to build kernel dependencies, except here we also need to take into account possible .PATH: hints, hence some complexities in the implementation. Comments/reviews/suggestions are highly accepted and appreciated. (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.) Cheers, --=20 Ruslan Ermilov FreeBSD committer ru@FreeBSD.org --CblX+4bnyfN0pR09 Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=p 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 + ${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]*} .endif .if !empty(DPSRCS:M*.cc) || !empty(DPSRCS:M*.C) || !empty(DPSRCS:M*.cpp) || \ !empty(DPSRCS:M*.cxx) - ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \ - ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BID]*} \ - ${.ALLSRC:M*.cc} ${.ALLSRC:M*.C} ${.ALLSRC:M*.cpp} ${.ALLSRC:M*.cxx} + (cd ${.CURDIR}; ${MAKE} _mkdep_cc) | xargs env \ + ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \ + ${CXXFLAGS:M-nostdinc*} ${CXXFLAGS:M-[BID]*} .endif .if !empty(DPSRCS:M*.m) - ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \ + (cd ${.CURDIR}; ${MAKE} _mkdep_m) | xargs env \ + ${MKDEPCMD} -f ${DEPENDFILE} -a ${MKDEP} \ ${OBJCFLAGS:M-nostdinc*} ${OBJCFLAGS:M-[BID]*} \ - ${OBJCFLAGS:M-Wno-import*} \ - ${.ALLSRC:M*.m} + ${OBJCFLAGS:M-Wno-import*} .endif .if target(_EXTRADEPEND) _EXTRADEPEND: .USE --CblX+4bnyfN0pR09-- --ieNMXl1Fr3cevapt Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFAIgnyUkv4P6juNwoRArOpAJwNPibKw6FmXcMRAf8Z8k/iCeG74ACfVOU0 +maeWrzab2tiTJcoyl4UJCw= =3TC2 -----END PGP SIGNATURE----- --ieNMXl1Fr3cevapt--