From owner-freebsd-current@FreeBSD.ORG Thu Feb 5 10:01:00 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 F1AC916A4D3; Thu, 5 Feb 2004 10:00:59 -0800 (PST) Received: from mailout2.pacific.net.au (mailout2.pacific.net.au [61.8.0.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 1342B43D5D; Thu, 5 Feb 2004 10:00:55 -0800 (PST) (envelope-from bde@zeta.org.au) Received: from mailproxy1.pacific.net.au (mailproxy1.pacific.net.au [61.8.0.86])i15GJn5O006558; Fri, 6 Feb 2004 03:19:49 +1100 Received: from gamplex.bde.org (katana.zip.com.au [61.8.7.246]) i15GJlt4021778; Fri, 6 Feb 2004 03:19:47 +1100 Date: Fri, 6 Feb 2004 03:19:46 +1100 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: Ruslan Ermilov In-Reply-To: <20040205151425.GA18523@FreeBSD.org.ua> Message-ID: <20040206030956.F11456@gamplex.bde.org> References: <20040205091634.GC13932@FreeBSD.org.ua> <20040206012805.N8113@gamplex.bde.org> <20040205151425.GA18523@FreeBSD.org.ua> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: current@FreeBSD.org Subject: Re: 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 18:01:00 -0000 On Thu, 5 Feb 2004, Ruslan Ermilov wrote: > 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 That is slow too. I get 12.12 seconds with make, 2.36 with make -j1, 1.37 with a shell loop and bash-1, 1.35 with a shell loop and /bin/sh, and 0.0042 with jot 1000 >/dev/null. I wonder about all those little dependencies too. make already takes a noticeable amount of time to handle large subdirs (here it takes 0.48 seconds for a null "make depend"). > > % ${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 $ echo foo.c | CC=cc xargs mkdep Bruce