From owner-freebsd-hackers Sat Aug 12 08:09:35 1995 Return-Path: hackers-owner Received: (from majordom@localhost) by freefall.FreeBSD.org (8.6.11/8.6.6) id IAA28258 for hackers-outgoing; Sat, 12 Aug 1995 08:09:35 -0700 Received: from mail.cs.tu-berlin.de (mail.cs.tu-berlin.de [130.149.17.13]) by freefall.FreeBSD.org (8.6.11/8.6.6) with ESMTP id IAA28252 for ; Sat, 12 Aug 1995 08:09:26 -0700 Received: from caramba.cs.tu-berlin.de (wosch@caramba.cs.tu-berlin.de [130.149.144.4]) by mail.cs.tu-berlin.de (8.6.12/8.6.12) with ESMTP id QAA09619 for ; Sat, 12 Aug 1995 16:53:34 +0200 From: Wolfram Schneider Received: (wosch@localhost) by caramba.cs.tu-berlin.de (8.6.12/8.6.9) id QAA25534; Sat, 12 Aug 1995 16:53:28 +0200 Date: Sat, 12 Aug 1995 16:53:28 +0200 Message-Id: <199508121453.QAA25534@caramba.cs.tu-berlin.de> To: hackers@freebsd.org Subject: Makefile speedup MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Sender: hackers-owner@freebsd.org Precedence: bulk [next try] I review the Makefiles in /usr/share/mk/bsd.*.mk. In my opinion there are redundant, slow and inefficient. Example: 1)make cleandir 7 processes: 1 make, 4 rm, 2 sh $ cd /usr/src/bin/chmod $ make cleandir rm -f .depend /usr3/src/bin/chmod/tags rm -f a.out [Ee]rrs mklog chmod chmod.o rm -f /usr3/src/bin/chmod/tags .depend cd /usr3/src/bin/chmod; rm -rf obj; First rm(1) is superfluously, due a missing .if !target(cleandir) in bsd.dep.mk. '[Ee]rrs' are meta-chars, make(1) call sh(1). Replace [Ee]rss with 'errs Errs' avoid calling /bin/sh. Arguments of 3th rm(1) can be added to previous rm. /usr3/src/bin/chmod/obj is a softlink. Add it to previous rm (and avoid a /bin/sh due ';') 2 processes: make + rm $ make cleandir rm -f a.out Errs errs mklog chmod chmod.o /usr3/src/bin/chmod/tags .depend /usr3/src/bin/chmod/obj 2) Redundant 'obj:', 5 x the same code $ egrep -A 8 '^obj:' /usr/share/mk/*.mk Should be replaced with a small perl script. 3) .depend & mkdep in bsd.dep.mk: tons of sh,test, sed. Should be replaced with a perl script. Here are the patches for make cleandir. If someone want the perl scripts, send me an email. Wolfram --- 1.1 1995/08/08 20:19:56 +++ bsd.prog.mk 1995/08/08 22:28:03 @@ -1,5 +1,5 @@ # from: @(#)bsd.prog.mk 5.26 (Berkeley) 6/25/91 -# $Id: bsd.prog.mk,v 1.1 1995/08/08 20:19:56 wosch Exp $ +# $Id: bsd.prog.mk,v 1.2 1995/08/08 22:13:04 wosch Exp $ .if exists(${.CURDIR}/../Makefile.inc) .include "${.CURDIR}/../Makefile.inc" @@ -138,14 +138,14 @@ .if !target(clean) clean: _PROGSUBDIR - rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES} + rm -f a.out Errs errs mklog ${PROG} ${OBJS} ${CLEANFILES} .endif .if !target(cleandir) cleandir: _PROGSUBDIR - rm -f a.out [Ee]rrs mklog ${PROG} ${OBJS} ${CLEANFILES} - rm -f ${.CURDIR}/tags .depend - cd ${.CURDIR}; rm -rf obj; + rm -f a.out Errs errs mklog ${PROG} ${OBJS} ${CLEANFILES} \ + ${.CURDIR}/tags .depend \ + ${.CURDIR}/obj .endif .if !target(install) --- 1.1 1995/08/08 20:19:56 +++ bsd.dep.mk 1995/08/08 22:15:06 @@ -1,4 +1,4 @@ -# $Id: bsd.dep.mk,v 1.1 1995/08/08 20:19:56 wosch Exp $ +# $Id: bsd.dep.mk,v 1.2 1995/08/08 22:10:45 wosch Exp $ # some of the rules involve .h sources, so remove them from mkdep line .if !target(depend) @@ -40,8 +40,10 @@ .endif .if defined(SRCS) +.if !target(cleandir) clean: cleandir: cleandepend cleandepend: rm -f .depend ${.CURDIR}/tags +.endif .endif