Very long SRCS list with unusually long src/ prefix
Ruslan Ermilov
ru at FreeBSD.org
Thu Feb 5 01:15:47 PST 2004
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!= 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,
--
Ruslan Ermilov
FreeBSD committer
ru at FreeBSD.org
-------------- next part --------------
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-current/attachments/20040205/bd6c38cb/attachment-0001.bin
More information about the freebsd-current
mailing list