Very long SRCS list with unusually long src/ prefix
Ruslan Ermilov
ru at FreeBSD.org
Thu Feb 5 07:13:55 PST 2004
On Fri, Feb 06, 2004 at 01:40:45AM +1100, Bruce Evans wrote:
> On Thu, 5 Feb 2004, Ruslan Ermilov wrote:
[...]
> % +.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 :-).
>
But that's what this patch basically does: it splits possibly very
long ${.ALLSRC} list into pieces. It's very inefficient only in
traditional mode. Run this with and without -j1 to see the diff:
: COUNT!= jot 1000
:
: all:
: .for foo in ${COUNT}
: @echo $$$$ >/dev/null
: .endfor
> I can't see anything better using current make features. The make -V hack
> doesn't work with local variables.
>
Yes, because -V is meaningless 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.
>
Yeah.
> % ${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.
>
$ echo foo.c | xargs CC=cc mkdep
xargs: CC=cc: No such file or directory
Cheers,
--
Ruslan Ermilov
FreeBSD committer
ru at FreeBSD.org
-------------- 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/e2df6ebe/attachment-0001.bin
More information about the freebsd-current
mailing list