Module Name: src Committed By: joerg Date: Thu Nov 15 23:51:54 UTC 2012
Modified Files: src: Makefile build.sh src/lib: Makefile src/share/mk: Makefile src/tools: Makefile Added Files: src/share/mk: bsd.buildinstall.mk Log Message: Move the build_install logic from lib/Makefile into share/mk and re-use it for tools. The existing logic broke for the LLVM build with the recent .ORDER changes in make. To generate a diff of this commit: cvs rdiff -u -r1.300 -r1.301 src/Makefile cvs rdiff -u -r1.258 -r1.259 src/build.sh cvs rdiff -u -r1.194 -r1.195 src/lib/Makefile cvs rdiff -u -r1.46 -r1.47 src/share/mk/Makefile cvs rdiff -u -r0 -r1.1 src/share/mk/bsd.buildinstall.mk cvs rdiff -u -r1.158 -r1.159 src/tools/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/Makefile diff -u src/Makefile:1.300 src/Makefile:1.301 --- src/Makefile:1.300 Sun Nov 4 11:02:11 2012 +++ src/Makefile Thu Nov 15 23:51:53 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.300 2012/11/04 11:02:11 apb Exp $ +# $NetBSD: Makefile,v 1.301 2012/11/15 23:51:53 joerg Exp $ # # This is the top-level makefile for building NetBSD. For an outline of @@ -92,8 +92,6 @@ # obj: creates object directories. # do-distrib-dirs: creates the distribution directories. # includes: installs include files. -# do-tools-compat: builds the "libnbcompat" library; needed for some -# random host tool programs in the source tree. # do-lib: builds and installs prerequisites from lib # if ${MKCOMPAT} != "no". # do-compat-lib: builds and installs prerequisites from compat/lib @@ -455,12 +453,8 @@ do-${targ}: .PHONY ${targ} @true .endfor -.for dir in tools tools/compat -do-${dir:S/\//-/g}: .PHONY .MAKE -.for targ in dependall install - ${MAKEDIRTARGET} ${dir} ${targ} -.endfor -.endfor +do-tools: .PHONY .MAKE + ${MAKEDIRTARGET} tools build_install do-lib: .PHONY .MAKE ${MAKEDIRTARGET} lib build_install Index: src/build.sh diff -u src/build.sh:1.258 src/build.sh:1.259 --- src/build.sh:1.258 Wed Oct 31 13:05:09 2012 +++ src/build.sh Thu Nov 15 23:51:53 2012 @@ -1,5 +1,5 @@ #! /usr/bin/env sh -# $NetBSD: build.sh,v 1.258 2012/10/31 13:05:09 apb Exp $ +# $NetBSD: build.sh,v 1.259 2012/11/15 23:51:53 joerg Exp $ # # Copyright (c) 2001-2011 The NetBSD Foundation, Inc. # All rights reserved. @@ -1718,7 +1718,7 @@ createmakewrapper() eval cat <<EOF ${makewrapout} #! ${HOST_SH} # Set proper variables to allow easy "make" building of a NetBSD subtree. -# Generated from: \$NetBSD: build.sh,v 1.258 2012/10/31 13:05:09 apb Exp $ +# Generated from: \$NetBSD: build.sh,v 1.259 2012/11/15 23:51:53 joerg Exp $ # with these arguments: ${_args} # @@ -1767,8 +1767,7 @@ buildtools() if [ "${MKUPDATE}" = "no" ]; then make_in_dir tools cleandir fi - make_in_dir tools dependall - make_in_dir tools install + make_in_dir tools build_install statusmsg "Tools built to ${TOOLDIR}" } Index: src/lib/Makefile diff -u src/lib/Makefile:1.194 src/lib/Makefile:1.195 --- src/lib/Makefile:1.194 Sun Nov 11 17:34:06 2012 +++ src/lib/Makefile Thu Nov 15 23:51:53 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.194 2012/11/11 17:34:06 alnsn Exp $ +# $NetBSD: Makefile,v 1.195 2012/11/15 23:51:53 joerg Exp $ # from: @(#)Makefile 5.25.1.1 (Berkeley) 5/7/91 .include <bsd.own.mk> @@ -229,30 +229,5 @@ SUBDIR+= ../sys/rump/net/lib # Lua bindings come last, they might depend on anything SUBDIR+= lua -# -# build_install logic for src/Makefile. -# Compute a list of subdirectories delimited by .WAIT. -# Run "make dependall && make install" for all subdirectories in a group -# concurrently, but wait after each group. -# -SUBDIR_GROUPS= 1 -CUR_GROUP:= 1 -.for dir in ${SUBDIR} -. if ${dir} == ".WAIT" -CUR_GROUP:= ${CUR_GROUP}1 -SUBDIR_GROUPS:= ${SUBDIR_GROUPS} ${CUR_GROUP} -. else -SUBDIR_GROUP.${CUR_GROUP}+= ${dir} -.endif - -.endfor - -build_install: -.for group in ${SUBDIR_GROUPS} -. if !empty(SUBDIR_GROUP.${group}) - ${MAKEDIRTARGET} . ${SUBDIR_GROUP.${group}:C/^/dependall-/} - ${MAKEDIRTARGET} . ${SUBDIR_GROUP.${group}:C/^/install-/} -. endif -.endfor - +.include <bsd.buildinstall.mk> .include <bsd.subdir.mk> Index: src/share/mk/Makefile diff -u src/share/mk/Makefile:1.46 src/share/mk/Makefile:1.47 --- src/share/mk/Makefile:1.46 Fri Oct 7 16:29:40 2011 +++ src/share/mk/Makefile Thu Nov 15 23:51:53 2012 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.46 2011/10/07 16:29:40 plunky Exp $ +# $NetBSD: Makefile,v 1.47 2012/11/15 23:51:53 joerg Exp $ # @(#)Makefile 8.1 (Berkeley) 6/8/93 NOOBJ= # defined @@ -6,8 +6,8 @@ NOOBJ= # defined .include <bsd.own.mk> .if ${MKSHARE} != "no" -FILES= bsd.README bsd.clang-analyze.mk bsd.clean.mk bsd.dep.mk bsd.doc.mk \ - bsd.endian.mk bsd.files.mk \ +FILES= bsd.README bsd.buildinstall.mk bsd.clang-analyze.mk bsd.clean.mk \ + bsd.dep.mk bsd.doc.mk bsd.endian.mk bsd.files.mk \ bsd.gcc.mk bsd.hostlib.mk bsd.hostprog.mk bsd.inc.mk bsd.info.mk \ bsd.init.mk bsd.ioconf.mk bsd.kernobj.mk bsd.kinc.mk bsd.klinks.mk \ bsd.kmodule.mk bsd.lib.mk bsd.links.mk bsd.lua.mk \ Index: src/tools/Makefile diff -u src/tools/Makefile:1.158 src/tools/Makefile:1.159 --- src/tools/Makefile:1.158 Thu Nov 15 19:49:12 2012 +++ src/tools/Makefile Thu Nov 15 23:51:54 2012 @@ -1,7 +1,11 @@ -# $NetBSD: Makefile,v 1.158 2012/11/15 19:49:12 jkunz Exp $ +# $NetBSD: Makefile,v 1.159 2012/11/15 23:51:54 joerg Exp $ .include <bsd.own.mk> +# Make sure that the ordered build/install processing applies when using +# plain make. +.MAIN: build_install + .if defined(HAVE_GCC) || defined(HAVE_PCC) TOOLCHAIN_BITS= gmake .WAIT .endif @@ -80,12 +84,10 @@ SUBDIR= host-mkdep .WAIT compat .WAIT \ pwd_mkdb stat strfile sunlabel zic .if ${MKLLVM} != "no" -# .WAIT between llvm-tblgen and llvm-clang-tblgen ensures install -# rules works correctly SUBDIR+= \ llvm .WAIT \ llvm-lib/libLLVMSupport llvm-lib/libLLVMTableGen .WAIT \ - llvm-tblgen .WAIT llvm-clang-tblgen .WAIT \ + llvm-tblgen llvm-clang-tblgen .WAIT \ llvm-include .WAIT \ llvm-lib .WAIT \ llvm-clang @@ -179,6 +181,7 @@ all-${dir} depend-${dir} dependall-${dir .endif # } .include <bsd.subdir.mk> +.include <bsd.buildinstall.mk> .include <bsd.obj.mk> .if !defined(PREVIOUSTOOLDIR) @@ -202,59 +205,5 @@ realall realdepend: .MAKE .endif echo ${TOOLDIR} >PREVIOUSTOOLDIR -# For each .WAIT point, make sure the immediately preceding target is -# installed before building anything after that point. -# (dsl: which means that with: 'a b .WAIT c' the build of 'c' waits for the -# install of 'b', but not the install of 'a'.) -# -# We use the "internal" targets and dependencies generated by <bsd.subdir.mk> -# to achieve this. These targets look like: -# subdir-all: all-dir1 [.WAIT] all-dir2 etc.. -# subdir-install: install-dir1 [.WAIT] install-dir2 etc.. -# and so on for each element in ${TARGETS}, with .WAIT sources inserted at -# places corresponding to the .WAITs in our $SUBDIR variable. -# -# Also, since we're now mixing `install' with `all' and `depend' targets -# an order relationship between those in each individual subdirectory -# must be established. -# -_deps:= -_prev:= - -.for d in ${SUBDIR} # { -_this:= ${d} - -.if ${_this} == ".WAIT" # { - -# setup dependency to apply to all/depend targets in the next group -_deps:= ${_deps} ${_prev:S/^/install-/} - -# if we're building *only* individual targets (i.e. "dependall-yacc"), -# make sure prerequisite tools build before installing -# XXX: dsl: this is likely to generate a dependency loop since there is -# a .ORDER releation between the nodes as well. -.if !make(all) && !make(dependall) && !make(install) -install-${_prev}: dependall-${_prev} -.endif - -.else # ${_this} != ".WAIT" # } { - -# order depend/all/install targets for ${d} subdir. -.ORDER: depend-${d} all-${d} dependall-${d} install-${d} - -# prevent cleandir in real{all,depend} from interfering with subdir makes -.ORDER: realdepend dependall-${d} -.ORDER: realdepend depend-${d} -.ORDER: realall all-${d} - -# make all/depend-${d} dependent on list of install targets -depend-${d} all-${d} dependall-${d}: ${_deps} - -.endif # ${_this} != ".WAIT" # } - -# stash current name in case the next entry is .WAIT -_prev:= ${d} -.endfor # } - cleandir: rm -f ${CLEANFILES} Added files: Index: src/share/mk/bsd.buildinstall.mk diff -u /dev/null src/share/mk/bsd.buildinstall.mk:1.1 --- /dev/null Thu Nov 15 23:51:54 2012 +++ src/share/mk/bsd.buildinstall.mk Thu Nov 15 23:51:53 2012 @@ -0,0 +1,29 @@ +# $NetBSD: bsd.buildinstall.mk,v 1.1 2012/11/15 23:51:53 joerg Exp $ + +# +# build_install logic for src/Makefile +# Used by src/lib/Makefile and src/tools/Makefile. +# +# Compute a list of subdirectories delimited by .WAIT. +# Run "make dependall && make install" for all subdirectories in a group +# concurrently, but wait after each group. +# +SUBDIR_GROUPS= 1 +CUR_GROUP:= 1 +.for dir in ${SUBDIR} +. if ${dir} == ".WAIT" +CUR_GROUP:= ${CUR_GROUP}1 +SUBDIR_GROUPS:= ${SUBDIR_GROUPS} ${CUR_GROUP} +. else +SUBDIR_GROUP.${CUR_GROUP}+= ${dir} +.endif + +.endfor + +build_install: +.for group in ${SUBDIR_GROUPS} +. if !empty(SUBDIR_GROUP.${group}) + ${MAKEDIRTARGET} . ${SUBDIR_GROUP.${group}:C/^/dependall-/} + ${MAKEDIRTARGET} . ${SUBDIR_GROUP.${group}:C/^/install-/} +. endif +.endfor