5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License, Version 1.0 only
7 # (the "License"). You may not use this file except in compliance
10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
11 # or http://www.opensolaris.org/os/licensing.
12 # See the License for the specific language governing permissions
13 # and limitations under the License.
15 # When distributing Covered Code, include this CDDL HEADER in each
16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
17 # If applicable, add the following below this CDDL HEADER, with the
18 # fields enclosed by brackets "[]" replaced with your own identifying
19 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright (c) 1998-2001 by Sun Microsystems, Inc.
25 # All rights reserved.
27 #ident "%Z%%M% %I% %E% SMI"
30 # Script to build the MDB modules present in a workspace against the set of
31 # include files saved in an MDB "root" (created with mkroot.sh), and install
32 # resulting modules into this tree so that it can be used as the argument
33 # to ``mdb -R'' or by mdb's auto-detect code, used by the mdb.sh wrapper.
34 # We use the ``make dmods'' target to do the build -- this is equivalent to
35 # make install, but does not build the debugger itself, and pass a special
36 # define (_MDB_BLDID) into the compilation environment so that the module
37 # source can detect the various changes in header files, etc. This is only
38 # used for module source kept on mdb.eng that needs to compile against
39 # legacy builds of the operating system.
46 if [ $# -ne 0 -a "x$1" = x-R
]; then
51 if [ $# -ne 1 -o -z "${INCROOT:=$1}" -o ! -d "$INCROOT" ]; then
52 echo "Usage: $PNAME [-R] root-dir"
61 if [ -z "$SRC" -a -z "$SRCTOP" ]; then
62 echo "$PNAME: \$SRC or \$SRCTOP must be set" >& 2
66 if [ -z "$ROOT" ]; then
67 echo "$PNAME: \$ROOT must be set" >& 2
71 if [ -z "$SRC" ]; then
77 # Derive a build-id based on the name of the $ROOT directory. The build-id
78 # is passed into the compilation environment as _MDB_BLDID, and consists of
79 # a 4-digit hexadecimal number whose first two digits are the release number
80 # (e.g. 0x27XX for Solaris 2.7) and whose last two digits are the build number.
82 case "`basename $INCROOT`" in
83 s297_fcs
) BLDID
=0x2637 ;;
84 s998_fcs
) BLDID
=0x2721 ;;
85 s28_fcs
) BLDID
=0x2838 ;;
86 s399_
*) BLDID
=0x27FF ;;
87 s599_
*) BLDID
=0x27FF ;;
88 s899_
*) BLDID
=0x27FF ;;
89 s1199_
*) BLDID
=0x27FF ;;
90 s81_
*) BLDID
=0x81`basename $INCROOT | sed 's/s81_//' | tr -cd '[0-9]'` ;;
91 *) echo "$PNAME: cannot derive _MDB_BLDID for $INCROOT" >& 2; exit 1 ;;
95 # Set up the necessary environment variables to perform a build. Basically
96 # we need to do the same stuff as bld_env or bfmenv.
98 [ `id | cut -d'(' -f1` != 'uid=0' ] && CH
='#' || CH
=; export CH
99 VERSION
=${VERSION:-"`basename $INCROOT`:`date '+%m/%d/%y'`"}; export VERSION
100 MACH
=`uname -p`; export MACH
101 TMPDIR
=/tmp
; export TMPDIR
102 NODENAME
=`uname -n`; export NODENAME
103 PATH
="$PUBLIC/bin:$PUBLIC/bin/$MACH:/opt/onbld/bin:/opt/onbld/bin/$MACH:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/usr/openwin/bin:."; export PATH
104 MAKEFLAGS
=e
; export MAKEFLAGS
107 # We need to export $BLDID into the compilation environment, and make sure
108 # to remap the default include path from /usr/include to $INCROOT/usr/include.
110 ENVCPPFLAGS1
="-nostdinc -I$INCROOT/usr/include"; export ENVCPPFLAGS1
111 ENVCPPFLAGS2
="-D_MDB_BLDID=$BLDID"; export ENVCPPFLAGS2
112 ENVCPPFLAGS3
=; export ENVCPPFLAGS3
113 ENVCPPFLAGS4
=; export ENVCPPFLAGS4
115 ENVLDLIBS1
=; export ENVLDLIBS1
116 ENVLDLIBS2
=; export ENVLDLIBS2
117 ENVLDLIBS3
=; export ENVLDLIBS3
119 cd $SRC && make clobber
&& make dmods