From owner-freebsd-audit Sun Feb 11 8:30:58 2001 Delivered-To: freebsd-audit@freebsd.org Received: from harmony.village.org (rover.village.org [204.144.255.66]) by hub.freebsd.org (Postfix) with ESMTP id 357A437B401; Sun, 11 Feb 2001 08:30:54 -0800 (PST) Received: from harmony.village.org (localhost.village.org [127.0.0.1]) by harmony.village.org (8.11.1/8.11.1) with ESMTP id f1BGUrW23037; Sun, 11 Feb 2001 09:30:53 -0700 (MST) (envelope-from imp@harmony.village.org) Message-Id: <200102111630.f1BGUrW23037@harmony.village.org> To: audit@freebsd.org, peter@freebsd.org, bde@freebsd.org Subject: kmod.mk patches to fix excessive recompiling Date: Sun, 11 Feb 2001 09:30:53 -0700 From: Warner Losh Sender: owner-freebsd-audit@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG For a long time I've noticed that too many things recompile in the modules when I rebuild after a cvs update. I've tracked the problem down now. kmod.mk puts @ and machine as dependencies for all the sources. This is done to ensure that the link exists, but for no other reasons. However, when the link does exist, the directory mod time comes into consideration (that directory is the target of the symlink). So, whenever $S or $S/$MACHINE/include changes, all files are rebuilt inn the modules tree. My laptop is only a 300MHz Pentium, so this can take longer than my attention span. Please find enclosed patches that fix this problem. They just add checks to see if the files don't exist before making them a dependency. This works well for me and so I'm sharing it with the world. The prime motivator to finding this problem was vi dumped core in src/sys and that caused all the modules to recompile. Needless to say, this ticked me off enough to fix this problem (but strangely, not enough to upgrade my laptop's userland to fix vi :-). Warner Index: kmod.mk =================================================================== RCS file: /home/imp/FreeBSD/CVS/src/sys/conf/kmod.mk,v retrieving revision 1.90 diff -u -r1.90 kmod.mk --- kmod.mk 2001/01/28 21:24:05 1.90 +++ kmod.mk 2001/02/11 16:25:20 @@ -158,7 +158,14 @@ .MAIN: all all: objwarn ${PROG} all-man _SUBDIR -beforedepend ${OBJS}: ${_ILINKS} +beforedepend ${OBJS}: +.if !exists(@) +beforedepend ${OBJS}: @ +.endif +.if !exists(machine) +beforedepend ${OBJS}: machine +.endif + # Search for kernel source tree in standard places. .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys @@ -269,7 +276,9 @@ .for _src in ${SRCS:M${_srcsrc:T:R}.${_ext}} CLEANFILES+= ${_src} .if !target(${_src}) +.if !exists(@) ${_src}: @ +.endif .if exists(@) ${_src}: @/kern/makeobjops.pl @/${_srcsrc} .endif @@ -282,7 +291,9 @@ .for _ext in c h .if ${SRCS:Mvnode_if.${_ext}} != "" CLEANFILES+= vnode_if.${_ext} +.if !exists(@) vnode_if.${_ext}: @ +.endif .if exists(@) vnode_if.${_ext}: @/kern/vnode_if.pl @/kern/vnode_if.src .endif To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-audit" in the body of the message