Date: Sat, 12 Aug 1995 16:53:28 +0200 From: Wolfram Schneider <wosch@cs.tu-berlin.de> To: hackers@freebsd.org Subject: Makefile speedup Message-ID: <199508121453.QAA25534@caramba.cs.tu-berlin.de>
next in thread | raw e-mail | index | archive | help
[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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508121453.QAA25534>
