Subject: some speed-ups for recursive makes in pkgsrc
To: None <tech-pkg@netbsd.org>
From: Paul Kranenburg <pk@cs.few.eur.nl>
List: tech-pkg
Date: 10/05/2003 23:53:14
Here are some simple changes for your consideration which improve
the performance for recursive make's. In my case I got a 20% speed
up for `make fetch-list' (on a somewhat dated Pentium II/300MHz,
but with fast disks).

The `PASSIVE_FETCH' thing in bsd.pkg.mk is not a speed-up, but to
make `make fetch-list | sh' work, which otherwise would choke
badly whenever an invocation of ftp decides to go interactive
(e.g. on host lookup failure, or http authentication required, etc.).
In that case ftp will happily gobble up all the rest of the fetch
script..

-pk


Index: bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.1291
diff -c -r1.1291 bsd.pkg.mk
*** bsd.pkg.mk	28 Sep 2003 08:52:13 -0000	1.1291
--- bsd.pkg.mk	5 Oct 2003 21:48:21 -0000
***************
*** 819,824 ****
--- 819,827 ----
  .if defined(PASSIVE_FETCH)
  FETCH_BEFORE_ARGS += -p
  .endif
+ .if defined(PIPED_FETCH)
+ FETCH_AFTER_ARGS?= </dev/null
+ .endif
  
  # Check if we got "rman" with XFree86, for packages that need "rman".
  .if defined(USE_RMAN)
Index: bsd.prefs.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.prefs.mk,v
retrieving revision 1.128
diff -c -r1.128 bsd.prefs.mk
*** bsd.prefs.mk	24 Sep 2003 12:22:04 -0000	1.128
--- bsd.prefs.mk	5 Oct 2003 21:48:21 -0000
***************
*** 23,35 ****
--- 23,38 ----
  
  .ifndef OPSYS
  OPSYS!=			${UNAME} -s
+ .MAKEOVERRIDES+=	OPSYS
  .endif
  MAKEFLAGS+=		OPSYS=${OPSYS}
  .ifndef OS_VERSION
  OS_VERSION!=		${UNAME} -r
+ .MAKEOVERRIDES+=	OS_VERSION
  .endif
  .ifndef LOWER_OS_VERSION
  LOWER_OS_VERSION!=	echo ${OS_VERSION} | tr 'A-Z' 'a-z'
+ .MAKEOVERRIDES+=	LOWER_OS_VERSION
  .endif
  MAKEFLAGS+=		OS_VERSION=${OS_VERSION}
  
Index: compiler.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/compiler.mk,v
retrieving revision 1.15
diff -c -r1.15 compiler.mk
*** compiler.mk	28 Sep 2003 09:53:56 -0000	1.15
--- compiler.mk	5 Oct 2003 21:48:21 -0000
***************
*** 78,94 ****
--- 78,100 ----
  
  # Darwin's gcc reports "Apple Computer ... based on gcc version ...",
  # so we can't just grep for ^gcc.
+ .if !defined(_CC_VERSION_STRING)
  _CC_VERSION_STRING!=	if ${CC} -v 2>&1 | ${GREP} -q 'gcc version'; then \
  				echo `${CC} -v 2>&1 | ${GREP} 'gcc version'`; \
  			fi
+ .MAKEOVERRIDES+=	_CC_VERSION_STRING
+ .endif
  
  # egcs is considered to be gcc-2.8.1.
  .  if !empty(_CC_VERSION_STRING:Megcs*)
  _CC_VERSION=		2.8.1
  _CC_IS_GCC=		YES
  .  elif !empty(_CC_VERSION_STRING:Mgcc*)
+ .  if !defined(_CC_VERSION)
  _CC_VERSION!=		${CC} -dumpversion
  _CC_IS_GCC=		YES
+ .MAKEOVERRIDES+=	_CC_VERSION _CC_IS_GCC
+ .  endif
  .  endif
  
  .  if defined(_CC_IS_GCC)