Very long SRCS list with unusually long src/ prefix
Bruce Evans
bde at zeta.org.au
Thu Feb 5 06:41:01 PST 2004
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
More information about the freebsd-current
mailing list