From owner-freebsd-arch@FreeBSD.ORG Sat Mar 29 15:34:40 2003 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id BA21837B401 for ; Sat, 29 Mar 2003 15:34:40 -0800 (PST) Received: from harmony.village.org (rover.bsdimp.com [204.144.255.66]) by mx1.FreeBSD.org (Postfix) with ESMTP id CCEB443FE5 for ; Sat, 29 Mar 2003 15:34:39 -0800 (PST) (envelope-from imp@bsdimp.com) Received: from localhost (warner@rover2.village.org [10.0.0.1]) by harmony.village.org (8.12.8/8.12.3) with ESMTP id h2TNYbA7016298 for ; Sat, 29 Mar 2003 16:34:37 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Sat, 29 Mar 2003 16:33:43 -0700 (MST) Message-Id: <20030329.163343.53040416.imp@bsdimp.com> To: arch@freebsd.org From: "M. Warner Losh" X-Mailer: Mew version 2.1 on Emacs 21.2 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: depend + all vs dependall X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Mar 2003 23:34:42 -0000 NetBSD created a dependall target some time ago. This target does a make depend and then a make all so they only have to traverse the tree once for these two stages rather than twice. The time of a buildworld came up in a discussion recently and I thought I'd see how hard it would be to do something similar in FreeBSD. Here are my preliminary results. Machine: Dell Inspiron 8000, 256M RAM, P3-700 time make buildworld (2:04:34 wall time, didn't save the actual output :-(. Machine: Dual Athlon XP2000+ 1.5G RAM aac controller. time make buildworld -j 8 -s run 0: did the above to 'flush the caches/load the sources in ram' Pre-change: Run 1: 1941.458u 723.640s 32:23.67 137.1% 2747+2215k 1447+145802io 465pf+0w Run 2: 1942.160u 729.972s 31:45.84 140.2% 2748+2212k 1423+145755io 465pf+0w After Changes: Run 1: 1922.767u 723.847s 30:48.64 143.1% 2785+2201k 1312+148256io 465pf+0w Run 2: 1922.661u 725.477s 30:49.99 143.1% 2788+2201k 1378+148489io 465pf+0w So it looks like it saves a little over a minute out of 32 (1925s average vs 1849s average, or almost a 4% reduction) on my big build box. My only concern with the patches is that they might interact badly with a bug I remember from the FreeBSD 1.1R days, but can't reproduce, in make. Once upon a time, 'make depend all' was different than 'make depend && make all' because the .depend files weren't re-read after the depend phase, but before the all phase, whereas two makes this would be the case. Since this change combines the two, I'm a little worried about that. Is that still a bug in FreeBSD's make? It won't matter for a pure, virgin tree, but might for incremental builds... Comments? Warner http://perforce.freebsd.org/chv.cgi?CH=27577 Change 27577 by imp@imp_hammer on 2003/03/29 11:24:15 create a new dependall target. # I don't know if the ancient bug about depend is fixed or not. Affected files ... .. //depot/user/imp/freebsd-imp/Makefile#14 edit .. //depot/user/imp/freebsd-imp/Makefile.inc1#18 edit .. //depot/user/imp/freebsd-imp/share/mk/bsd.README#3 edit .. //depot/user/imp/freebsd-imp/share/mk/bsd.dep.mk#3 edit .. //depot/user/imp/freebsd-imp/share/mk/bsd.subdir.mk#2 edit Differences ... ==== //depot/user/imp/freebsd-imp/Makefile#14 (text+ko) ==== @@ -89,8 +89,8 @@ # order, but that's not important. # TGTS= all all-man buildkernel buildtools buildworld checkdpadd clean \ - cleandepend cleandir depend distribute distributeworld everything \ - hierarchy install installcheck installkernel \ + cleandepend cleandir depend dependall distribute distributeworld \ + everything hierarchy install installcheck installkernel \ reinstallkernel installmost installworld libraries lint maninstall \ mk most obj objlink regress rerelease tags update @@ -189,8 +189,7 @@ @echo "--------------------------------------------------------------" @cd ${.CURDIR}/usr.bin/make; \ ${MMAKE} obj && \ - ${MMAKE} depend && \ - ${MMAKE} all && \ + ${MMAKE} dependall && \ ${MMAKE} install DESTDIR=${MAKEPATH} BINDIR= # ==== //depot/user/imp/freebsd-imp/Makefile.inc1#18 (text+ko) ==== @@ -32,7 +32,7 @@ # # Standard targets (not defined here) are documented in the makefiles in # /usr/share/mk. These include: -# obj depend all install clean cleandepend cleanobj +# obj depend dependall all install clean cleandepend cleanobj # Put initial settings here. SUBDIR= @@ -319,18 +319,12 @@ @echo ">>> stage 4: building libraries" @echo "--------------------------------------------------------------" cd ${.CURDIR}; ${WMAKE} -DNOHTML -DNOINFO -DNOMAN -DNOFSCHG libraries -_depend: - @echo - @echo "--------------------------------------------------------------" - @echo ">>> stage 4: make dependencies" - @echo "--------------------------------------------------------------" - cd ${.CURDIR}; ${WMAKE} par-depend everything: @echo @echo "--------------------------------------------------------------" @echo ">>> stage 4: building everything.." @echo "--------------------------------------------------------------" - cd ${.CURDIR}; ${WMAKE} all + cd ${.CURDIR}; ${WMAKE} dependall WMAKE_TOOL_TGTS= @@ -341,7 +335,7 @@ .if !defined(SUBDIR_OVERRIDE) WMAKE_TOOL_TGTS+= _cross-tools .endif -WMAKE_TGTS= ${WMAKE_TOOL_TGTS} _includes _libraries _depend everything +WMAKE_TGTS= ${WMAKE_TOOL_TGTS} _includes _libraries everything buildworld: ${WMAKE_TGTS} .ORDER: ${WMAKE_TGTS} @@ -501,7 +495,7 @@ ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} obj # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case. .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KRNLSRCDIR}/modules) -.for target in obj depend all +.for target in obj dependall cd ${.CURDIR}/sys/modules/aic7xxx/aicasm; \ MAKEOBJDIRPREFIX=${KRNLOBJDIR}/${_kernel}/modules \ ${MAKE} -DNO_CPU_CFLAGS ${target} @@ -509,10 +503,11 @@ .endif .if !defined(NO_KERNELDEPEND) cd ${KRNLOBJDIR}/${_kernel}; \ - ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} depend -DNO_MODULES_OBJ -.endif + ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} dependall -DNO_MODULES_OBJ +.else cd ${KRNLOBJDIR}/${_kernel}; \ ${KMAKEENV} ${MAKE} KERNEL=${INSTKERNNAME} all -DNO_MODULES_OBJ +.endif @echo "--------------------------------------------------------------" @echo ">>> Kernel build for ${_kernel} completed on `LC_ALL=C date`" @echo "--------------------------------------------------------------" @@ -620,8 +615,7 @@ ${ECHODIR} "===> ${_tool}"; \ cd ${.CURDIR}/${_tool}; \ ${MAKE} DIRPRFX=${_tool}/ obj; \ - ${MAKE} DIRPRFX=${_tool}/ depend; \ - ${MAKE} DIRPRFX=${_tool}/ all; \ + ${MAKE} DIRPRFX=${_tool}/ dependall; \ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install .endfor @@ -681,8 +675,7 @@ ${ECHODIR} "===> ${_tool}"; \ cd ${.CURDIR}/${_tool}; \ ${MAKE} DIRPRFX=${_tool}/ obj; \ - ${MAKE} DIRPRFX=${_tool}/ depend; \ - ${MAKE} DIRPRFX=${_tool}/ all; \ + ${MAKE} DIRPRFX=${_tool}/ dependall; \ ${MAKE} DIRPRFX=${_tool}/ DESTDIR=${MAKEOBJDIRPREFIX} install .endfor @@ -762,8 +755,7 @@ .if exists(${.CURDIR}/${_lib}) ${ECHODIR} "===> ${_lib}"; \ cd ${.CURDIR}/${_lib}; \ - ${MAKE} DIRPRFX=${_lib}/ depend; \ - ${MAKE} DIRPRFX=${_lib}/ all; \ + ${MAKE} DIRPRFX=${_lib}/ dependall; \ ${MAKE} DIRPRFX=${_lib}/ install .endif .endfor @@ -782,7 +774,7 @@ _prebuild_libs: ${_prebuild_libs:S/$/__L/} _generic_libs: ${_generic_libs:S/$/__L/} -.for __target in clean cleandepend cleandir depend includes obj +.for __target in clean cleandepend cleandir depend dependall includes obj .for entry in ${SUBDIR} ${entry}.${__target}__D: .PHONY @if test -d ${.CURDIR}/${entry}.${MACHINE_ARCH}; then \ ==== //depot/user/imp/freebsd-imp/share/mk/bsd.README#3 (text+ko) ==== @@ -169,6 +169,8 @@ depend: make the dependencies for the source files, and store them in the file .depend. + dependall: + make depend then make all install: install the program and its manual pages; if the Makefile does not itself define the target install, the targets ==== //depot/user/imp/freebsd-imp/share/mk/bsd.dep.mk#3 (text+ko) ==== @@ -31,6 +31,9 @@ # Make the dependencies for the source files, and store # them in the file ${DEPENDFILE}. # +# dependall: +# make depend and then all +# # tags: # In "ctags" mode, create a tags file for the source files. # In "gtags" mode, create a (GLOBAL) gtags file for the @@ -183,3 +186,7 @@ echo "LDADD -> $$ldadd1" ; \ fi .endif + +.PHONY: dependall +.ORDER: afterdepend all +dependall: depend all ==== //depot/user/imp/freebsd-imp/share/mk/bsd.subdir.mk#2 (text+ko) ==== @@ -25,8 +25,8 @@ # put the stuff into the right "distribution". # # afterinstall, all, all-man, beforeinstall, checkdpadd, -# clean, cleandepend, cleandir, depend, install, lint, maninstall, -# obj, objlink, realinstall, regress, tags +# clean, cleandepend, cleandir, depend, dependall, install, lint, +# maninstall, obj, objlink, realinstall, regress, tags # .include @@ -67,7 +67,7 @@ .for __target in all all-man checkdpadd clean cleandepend cleandir \ - depend distribute lint maninstall \ + depend dependall distribute lint maninstall \ obj objlink realinstall regress tags ${__target}: _SUBDIR .endfor