Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Move the build_install logic from lib/Makefile into share/mk...
details: https://anonhg.NetBSD.org/src/rev/80b505633a68
branches: trunk
changeset: 782709:80b505633a68
user: joerg <joerg%NetBSD.org@localhost>
date: Thu Nov 15 23:51:53 2012 +0000
description:
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.
diffstat:
Makefile | 12 ++------
build.sh | 7 ++--
lib/Makefile | 29 +------------------
share/mk/Makefile | 6 ++--
share/mk/bsd.buildinstall.mk | 29 +++++++++++++++++++
tools/Makefile | 65 ++++---------------------------------------
6 files changed, 47 insertions(+), 101 deletions(-)
diffs (254 lines):
diff -r 2782a2ae3234 -r 80b505633a68 Makefile
--- a/Makefile Thu Nov 15 22:22:53 2012 +0000
+++ b/Makefile Thu Nov 15 23:51:53 2012 +0000
@@ -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 @@
@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
diff -r 2782a2ae3234 -r 80b505633a68 build.sh
--- a/build.sh Thu Nov 15 22:22:53 2012 +0000
+++ b/build.sh Thu Nov 15 23:51:53 2012 +0000
@@ -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 @@
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 @@
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}"
}
diff -r 2782a2ae3234 -r 80b505633a68 lib/Makefile
--- a/lib/Makefile Thu Nov 15 22:22:53 2012 +0000
+++ b/lib/Makefile Thu Nov 15 23:51:53 2012 +0000
@@ -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 @@
# 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>
diff -r 2782a2ae3234 -r 80b505633a68 share/mk/Makefile
--- a/share/mk/Makefile Thu Nov 15 22:22:53 2012 +0000
+++ b/share/mk/Makefile Thu Nov 15 23:51:53 2012 +0000
@@ -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 @@
.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 \
diff -r 2782a2ae3234 -r 80b505633a68 share/mk/bsd.buildinstall.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/share/mk/bsd.buildinstall.mk Thu Nov 15 23:51:53 2012 +0000
@@ -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
diff -r 2782a2ae3234 -r 80b505633a68 tools/Makefile
--- a/tools/Makefile Thu Nov 15 22:22:53 2012 +0000
+++ b/tools/Makefile Thu Nov 15 23:51:53 2012 +0000
@@ -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 @@
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 @@
.endif # }
.include <bsd.subdir.mk>
+.include <bsd.buildinstall.mk>
.include <bsd.obj.mk>
.if !defined(PREVIOUSTOOLDIR)
@@ -202,59 +205,5 @@
.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}
Home |
Main Index |
Thread Index |
Old Index