Date: Thu, 5 Feb 2004 11:16:34 +0200 From: Ruslan Ermilov <ru@FreeBSD.org> To: current@FreeBSD.org Cc: Bruce Evans <bde@FreeBSD.org> Subject: Very long SRCS list with unusually long src/ prefix Message-ID: <20040205091634.GC13932@FreeBSD.org.ua>
next in thread | raw e-mail | index | archive | help
--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--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040205091634.GC13932>