163df1173Spetede#!/usr/bin/ksh93 27c478bd9Sstevel@tonic-gate# 37c478bd9Sstevel@tonic-gate# CDDL HEADER START 47c478bd9Sstevel@tonic-gate# 57c478bd9Sstevel@tonic-gate# The contents of this file are subject to the terms of the 6b84bdc30Smeem# Common Development and Distribution License (the "License"). 7b84bdc30Smeem# You may not use this file except in compliance with the License. 87c478bd9Sstevel@tonic-gate# 97c478bd9Sstevel@tonic-gate# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 107c478bd9Sstevel@tonic-gate# or http://www.opensolaris.org/os/licensing. 117c478bd9Sstevel@tonic-gate# See the License for the specific language governing permissions 127c478bd9Sstevel@tonic-gate# and limitations under the License. 137c478bd9Sstevel@tonic-gate# 147c478bd9Sstevel@tonic-gate# When distributing Covered Code, include this CDDL HEADER in each 157c478bd9Sstevel@tonic-gate# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 167c478bd9Sstevel@tonic-gate# If applicable, add the following below this CDDL HEADER, with the 177c478bd9Sstevel@tonic-gate# fields enclosed by brackets "[]" replaced with your own identifying 187c478bd9Sstevel@tonic-gate# information: Portions Copyright [yyyy] [name of copyright owner] 197c478bd9Sstevel@tonic-gate# 207c478bd9Sstevel@tonic-gate# CDDL HEADER END 217c478bd9Sstevel@tonic-gate# 224e5b757fSkupfer 237c478bd9Sstevel@tonic-gate# 24b83ec4edSjmcp# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved. 25d7693b08SRoland Mainz# Copyright 2011 Nexenta Systems, Inc. All rights reserved. 26306f6ed4SGarrett D'Amore# Copyright 2014 Garrett D'Amore <garrett@damore.org> 275ca82e69SJohn Levon# Copyright 2020 Joyent, Inc. 286112cec5SJoshua M. Clulow# Copyright 2020 Oxide Computer Company 29*864a8d69SBill Sommerfeld# Copyright 2023 Bill Sommerfeld 307c478bd9Sstevel@tonic-gate# 317c478bd9Sstevel@tonic-gate# Uses supplied "env" file, based on /opt/onbld/etc/env, to set shell variables 327c478bd9Sstevel@tonic-gate# before spawning a shell for doing a release-style builds interactively 337c478bd9Sstevel@tonic-gate# and incrementally. 347c478bd9Sstevel@tonic-gate# 357c478bd9Sstevel@tonic-gate 36d7693b08SRoland Mainzfunction fatal_error 37d7693b08SRoland Mainz{ 38d7693b08SRoland Mainz print -u2 "${progname}: $*" 39d7693b08SRoland Mainz exit 1 40d7693b08SRoland Mainz} 41d7693b08SRoland Mainz 4263df1173Spetedefunction usage 4363df1173Spetede{ 4463df1173Spetede OPTIND=0 4563df1173Spetede getopts -a "${progname}" "${USAGE}" OPT '-?' 4663df1173Spetede exit 2 4763df1173Spetede} 4863df1173Spetede 4963df1173Spetedetypeset -r USAGE=$'+ 5063df1173Spetede[-?\n@(#)\$Id: bldenv (OS/Net) 2008-04-06 \$\n] 5163df1173Spetede[-author?OS/Net community <tools-discuss@opensolaris.org>] 5263df1173Spetede[+NAME?bldenv - spawn shell for interactive incremental OS-Net 5363df1173Spetede consolidation builds] 5463df1173Spetede[+DESCRIPTION?bldenv is a useful companion to the nightly(1) script for 5563df1173Spetede doing interactive and incremental builds in a workspace 5663df1173Spetede already built with nightly(1). bldenv spawns a shell set up 5763df1173Spetede with the same environment variables taken from an env_file, 5863df1173Spetede as prepared for use with nightly(1).] 5963df1173Spetede[+?In addition to running a shell for interactive use, bldenv 6063df1173Spetede can optionally run a single command in the given environment, 6163df1173Spetede in the vein of sh -c or su -c. This is useful for 6263df1173Spetede scripting, when an interactive shell would not be. If the 6363df1173Spetede command is composed of multiple shell words or contains 6463df1173Spetede other shell metacharacters, it must be quoted appropriately.] 6563df1173Spetede[+?bldenv is particularly useful for testing Makefile targets 6663df1173Spetede like clobber, install and _msg, which otherwise require digging 6763df1173Spetede through large build logs to figure out what is being 6863df1173Spetede done.] 6963df1173Spetede[+?By default, bldenv will invoke the shell specified in 7063df1173Spetede $SHELL. If $SHELL is not set or is invalid, csh will be 7163df1173Spetede used.] 7263df1173Spetede[c?force the use of csh, regardless of the value of $SHELL.] 7363df1173Spetede[f?invoke csh with the -f (fast-start) option. This option is valid 7463df1173Spetede only if $SHELL is unset or if it points to csh.] 75ea01a15aSJohn Levon[d?set up environment for doing DEBUG builds. The default is non-DEBUG, 76ea01a15aSJohn Levon unless the -F flag is specified in the nightly file.] 7763df1173Spetede[t?set up environment to use the tools in usr/src/tools (this is the 7863df1173Spetede default, use +t to use the tools from /opt/onbld)] 7963df1173Spetede 8063df1173Spetede<env_file> [command] 8163df1173Spetede 8263df1173Spetede[+EXAMPLES]{ 8363df1173Spetede [+?Example 1: Interactive use]{ 8463df1173Spetede [+?Use bldenv to spawn a shell to perform a DEBUG build and 8563df1173Spetede testing of the Makefile targets clobber and install for 8663df1173Spetede usr/src/cmd/true.] 8763df1173Spetede [+\n% rlogin wopr-2 -l gk 8863df1173Spetede{root::wopr-2::49} bldenv -d /export0/jg/on10-se.env 8963df1173SpetedeBuild type is DEBUG 9063df1173SpetedeRELEASE is 5.10 9163df1173SpetedeVERSION is wopr-2::on10-se::11/01/2001 9263df1173SpetedeRELEASE_DATE is May 2004 9363df1173SpetedeThe top-level `setup\' target is available to build headers 9463df1173Spetedeand tools. 9563df1173SpetedeUsing /usr/bin/tcsh as shell. 9663df1173Spetede{root::wopr-2::49} 9763df1173Spetede{root::wopr-2::49} cd $SRC/cmd/true 9863df1173Spetede{root::wopr-2::50} make 9963df1173Spetede{root::wopr-2::51} make clobber 10063df1173Spetede/usr/bin/rm -f true true.po 10163df1173Spetede{root::wopr-2::52} make 10263df1173Spetede/usr/bin/rm -f true 10363df1173Spetedecat true.sh > true 10463df1173Spetedechmod +x true 10563df1173Spetede{root::wopr-2::53} make install 10663df1173Spetedeinstall -s -m 0555 -u root -g bin -f /export0/jg/on10-se/proto/root_sparc/usr/bin true 10763df1173Spetede`install\' is up to date.] 10863df1173Spetede } 10963df1173Spetede [+?Example 2: Non-interactive use]{ 11063df1173Spetede [+?Invoke bldenv to create SUNWonbld with a single command:] 11163df1173Spetede [+\nexample% bldenv onnv_06 \'cd $SRC/tools && make pkg\'] 11263df1173Spetede } 11363df1173Spetede} 11463df1173Spetede[+SEE ALSO?\bnightly\b(1)] 11563df1173Spetede' 11663df1173Spetede 11763df1173Spetede# main 11863df1173Spetedebuiltin basename 11963df1173Spetede 12063df1173Spetede# boolean flags (true/false) 12163df1173Spetedetypeset flags=( 12263df1173Spetede typeset c=false 12363df1173Spetede typeset f=false 12463df1173Spetede typeset d=false 12563df1173Spetede typeset O=false 12663df1173Spetede typeset o=false 12763df1173Spetede typeset t=true 12863df1173Spetede typeset s=( 12963df1173Spetede typeset e=false 13063df1173Spetede typeset h=false 13163df1173Spetede typeset d=false 13263df1173Spetede typeset o=false 13363df1173Spetede ) 134ea01a15aSJohn Levon typeset d_set=false 135ea01a15aSJohn Levon typeset DF_build=false 13663df1173Spetede) 13763df1173Spetede 138d7693b08SRoland Mainztypeset progname="$(basename -- "${0}")" 13963df1173Spetede 1407c478bd9Sstevel@tonic-gateOPTIND=1 1417c478bd9Sstevel@tonic-gate 142ea01a15aSJohn Levonwhile getopts -a "${progname}" "${USAGE}" OPT ; do 14363df1173Spetede case ${OPT} in 14463df1173Spetede c) flags.c=true ;; 14563df1173Spetede +c) flags.c=false ;; 14663df1173Spetede f) flags.f=true ;; 14763df1173Spetede +f) flags.f=false ;; 148ea01a15aSJohn Levon d) flags.d=true ; flags.d_set=true ;; 149ea01a15aSJohn Levon +d) flags.d=false ; flags.d_set=true ;; 15063df1173Spetede t) flags.t=true ;; 15163df1173Spetede +t) flags.t=false ;; 15263df1173Spetede \?) usage ;; 15363df1173Spetede esac 15463df1173Spetededone 15563df1173Spetedeshift $((OPTIND-1)) 1567c478bd9Sstevel@tonic-gate 1577c478bd9Sstevel@tonic-gate# test that the path to the environment-setting file was given 15863df1173Spetedeif (( $# < 1 )) ; then 15963df1173Spetede usage 1607c478bd9Sstevel@tonic-gatefi 1617c478bd9Sstevel@tonic-gate 1627c478bd9Sstevel@tonic-gate# force locale to C 16363df1173Spetedeexport \ 16491d74a54SRichard Lowe LANG=C \ 16591d74a54SRichard Lowe LC_ALL=C \ 16663df1173Spetede LC_COLLATE=C \ 16763df1173Spetede LC_CTYPE=C \ 16863df1173Spetede LC_MESSAGES=C \ 16963df1173Spetede LC_MONETARY=C \ 17063df1173Spetede LC_NUMERIC=C \ 17163df1173Spetede LC_TIME=C 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate# clear environment variables we know to be bad for the build 17463df1173Spetedeunset \ 17563df1173Spetede LD_OPTIONS \ 176c3e6cb59SRichard Lowe LD_LIBRARY_PATH \ 177c3e6cb59SRichard Lowe LD_AUDIT \ 178c3e6cb59SRichard Lowe LD_BIND_NOW \ 179c3e6cb59SRichard Lowe LD_BREADTH \ 180c3e6cb59SRichard Lowe LD_CONFIG \ 18163df1173Spetede LD_DEBUG \ 182c3e6cb59SRichard Lowe LD_FLAGS \ 183c3e6cb59SRichard Lowe LD_LIBRARY_PATH_64 \ 184c3e6cb59SRichard Lowe LD_NOVERSION \ 185c3e6cb59SRichard Lowe LD_ORIGIN \ 18663df1173Spetede LD_LOADFLTR \ 187c3e6cb59SRichard Lowe LD_NOAUXFLTR \ 188c3e6cb59SRichard Lowe LD_NOCONFIG \ 189c3e6cb59SRichard Lowe LD_NODIRCONFIG \ 190c3e6cb59SRichard Lowe LD_NOOBJALTER \ 19163df1173Spetede LD_PRELOAD \ 192c3e6cb59SRichard Lowe LD_PROFILE \ 19363df1173Spetede CONFIG \ 19463df1173Spetede GROUP \ 19563df1173Spetede OWNER \ 19663df1173Spetede REMOTE \ 19763df1173Spetede ENV \ 19863df1173Spetede ARCH \ 19963df1173Spetede CLASSPATH 2007c478bd9Sstevel@tonic-gate 201eefeb0ceSBill Sommerfeld# set variables we want environment file to be able to override 202eefeb0ceSBill SommerfeldMAKEFLAGS=e 203eefeb0ceSBill Sommerfeld 2040756aa0bSGavin Maltby# 2050756aa0bSGavin Maltby# Setup environment variables 2060756aa0bSGavin Maltby# 2070756aa0bSGavin Maltbyif [[ -f /etc/nightly.conf ]]; then 2080756aa0bSGavin Maltby source /etc/nightly.conf 2090756aa0bSGavin Maltbyfi 2100756aa0bSGavin Maltby 21163df1173Spetedeif [[ -f "$1" ]]; then 21263df1173Spetede if [[ "$1" == */* ]]; then 21363df1173Spetede source "$1" 2147c478bd9Sstevel@tonic-gate else 21563df1173Spetede source "./$1" 2167c478bd9Sstevel@tonic-gate fi 2177c478bd9Sstevel@tonic-gateelse 21863df1173Spetede if [[ -f "/opt/onbld/env/$1" ]]; then 21963df1173Spetede source "/opt/onbld/env/$1" 2207c478bd9Sstevel@tonic-gate else 22163df1173Spetede printf \ 22263df1173Spetede 'Cannot find env file as either %s or /opt/onbld/env/%s\n' \ 22363df1173Spetede "$1" "$1" 2247c478bd9Sstevel@tonic-gate exit 1 2257c478bd9Sstevel@tonic-gate fi 2267c478bd9Sstevel@tonic-gatefi 2277c478bd9Sstevel@tonic-gateshift 2287c478bd9Sstevel@tonic-gate 229d7693b08SRoland Mainz# Check if we have sufficient data to continue... 230d7693b08SRoland Mainz[[ -v CODEMGR_WS ]] || fatal_error "Error: Variable CODEMGR_WS not set." 231d7693b08SRoland Mainz[[ -d "${CODEMGR_WS}" ]] || fatal_error "Error: ${CODEMGR_WS} is not a directory." 232d7693b08SRoland Mainz[[ -f "${CODEMGR_WS}/usr/src/Makefile" ]] || fatal_error "Error: ${CODEMGR_WS}/usr/src/Makefile not found." 233d7693b08SRoland Mainz 2345ca82e69SJohn Levon# must match the getopts in nightly 2357c478bd9Sstevel@tonic-gateOPTIND=1 23663df1173SpetedeNIGHTLY_OPTIONS="-${NIGHTLY_OPTIONS#-}" 237306f6ed4SGarrett D'Amorewhile getopts '+0ABCDdFfGIilMmNnpRrtUuwW' FLAG $NIGHTLY_OPTIONS 2387c478bd9Sstevel@tonic-gatedo 23963df1173Spetede case "$FLAG" in 24063df1173Spetede t) flags.t=true ;; 24163df1173Spetede +t) flags.t=false ;; 242ea01a15aSJohn Levon F) flags.DF_build=true ;; 24363df1173Spetede *) ;; 2447c478bd9Sstevel@tonic-gate esac 2457c478bd9Sstevel@tonic-gatedone 2467c478bd9Sstevel@tonic-gate 247ea01a15aSJohn Levon# DEBUG is a little bit complicated. First, bldenv -d/+d over-rides 248ea01a15aSJohn Levon# the env file. Otherwise, we'll default to DEBUG iff we are *not* 249ea01a15aSJohn Levon# building non-DEBUG bits at all. 250ea01a15aSJohn Levonif [ "${flags.d_set}" != "true" ] && "${flags.DF_build}"; then 251ea01a15aSJohn Levon flags.d=true 252ea01a15aSJohn Levonfi 253ea01a15aSJohn Levon 25448bc00d6SjmcpPOUND_SIGN="#" 2556112cec5SJoshua M. Clulowbasews=$(basename -- "$CODEMGR_WS") 25648bc00d6Sjmcp# have we set RELEASE_DATE in our env file? 25748bc00d6Sjmcpif [ -z "$RELEASE_DATE" ]; then 25848bc00d6Sjmcp RELEASE_DATE=$(LC_ALL=C date +"%B %Y") 25948bc00d6Sjmcpfi 2606112cec5SJoshua M. Clulownow=$(LC_ALL=C date +%Y-%b-%d) 2616112cec5SJoshua M. ClulowDEV_CM_TAIL="development build: $LOGNAME $now [$basews]" 2626112cec5SJoshua M. Clulow 2636112cec5SJoshua M. Clulow# 2646112cec5SJoshua M. Clulow# We export POUND_SIGN, RELEASE_DATE and DEV_CM_TAIL to speed up the build 2656112cec5SJoshua M. Clulow# process by avoiding repeated shell invocations to evaluate Makefile.master 2666112cec5SJoshua M. Clulow# definitions. 2676112cec5SJoshua M. Clulow# 2686112cec5SJoshua M. Clulowexport POUND_SIGN RELEASE_DATE DEV_CM_TAIL 26948bc00d6Sjmcp 27063df1173Spetedeprint 'Build type is \c' 27163df1173Spetedeif ${flags.d} ; then 27263df1173Spetede print 'DEBUG' 273ea01a15aSJohn Levon SUFFIX="" 2747c478bd9Sstevel@tonic-gate unset RELEASE_BUILD 2757c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 2767c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 2773c562093SToomas Soome 2783c562093SToomas Soome if [ -n "$DEBUG_CONSOLE_COLOR" ]; then 2793c562093SToomas Soome export DEFAULT_CONSOLE_COLOR="$DEBUG_CONSOLE_COLOR" 2803c562093SToomas Soome fi 2817c478bd9Sstevel@tonic-gateelse 2827c478bd9Sstevel@tonic-gate # default is a non-DEBUG build 28363df1173Spetede print 'non-DEBUG' 284ea01a15aSJohn Levon SUFFIX="-nd" 28563df1173Spetede export RELEASE_BUILD= 2867c478bd9Sstevel@tonic-gate unset EXTRA_OPTIONS 2877c478bd9Sstevel@tonic-gate unset EXTRA_CFLAGS 2883c562093SToomas Soome 2893c562093SToomas Soome if [ -n "$RELEASE_CONSOLE_COLOR" ]; then 2903c562093SToomas Soome export DEFAULT_CONSOLE_COLOR="$RELEASE_CONSOLE_COLOR" 2913c562093SToomas Soome fi 2927c478bd9Sstevel@tonic-gatefi 2937c478bd9Sstevel@tonic-gate 2947c478bd9Sstevel@tonic-gate# update build-type variables 29563df1173SpetedePKGARCHIVE="${PKGARCHIVE}${SUFFIX}" 2967c478bd9Sstevel@tonic-gate 297ea01a15aSJohn Levon# Set PATH for a build 298b84bdc30SmeemPATH="/opt/onbld/bin:/opt/onbld/bin/${MACH}:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/bin:/usr/sbin:/usr/ucb:/usr/etc:/usr/openwin/bin:/usr/sfw/bin:/opt/sfw/bin:." 299ea01a15aSJohn Levonif [[ "${SUNWSPRO}" != "" ]]; then 300ea01a15aSJohn Levon export PATH="${SUNWSPRO}/bin:$PATH" 301ea01a15aSJohn Levonfi 3027c478bd9Sstevel@tonic-gate 303b1a0a82dSRobert Mustacchiif [[ -n "${MAKE}" ]]; then 304b1a0a82dSRobert Mustacchi if [[ -x "${MAKE}" ]]; then 305b1a0a82dSRobert Mustacchi export PATH="$(dirname -- "${MAKE}"):$PATH" 306b1a0a82dSRobert Mustacchi else 307b1a0a82dSRobert Mustacchi print "\$MAKE (${MAKE}) is not a valid executible" 308ea01a15aSJohn Levon exit 1 309b1a0a82dSRobert Mustacchi fi 310e119f243SRobert Mustacchifi 311e119f243SRobert Mustacchi 31263df1173SpetedeTOOLS="${SRC}/tools" 313ead1f93eSLiane PrazaTOOLS_PROTO="${TOOLS}/proto/root_${MACH}-nd" ; export TOOLS_PROTO 3147c478bd9Sstevel@tonic-gate 31563df1173Spetedeif "${flags.t}" ; then 31663df1173Spetede export ONBLD_TOOLS="${ONBLD_TOOLS:=${TOOLS_PROTO}/opt/onbld}" 3177c478bd9Sstevel@tonic-gate 31863df1173Spetede export STABS="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/stabs" 31963df1173Spetede export CTFSTABS="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfstabs" 32063df1173Spetede export GENOFFSETS="${TOOLS_PROTO}/opt/onbld/bin/genoffsets" 3217c478bd9Sstevel@tonic-gate 32263df1173Spetede export CTFCONVERT="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfconvert" 32363df1173Spetede export CTFMERGE="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ctfmerge" 324806bd0e6SGordon Ross export NDRGEN="${TOOLS_PROTO}/opt/onbld/bin/${MACH}/ndrgen" 3257c478bd9Sstevel@tonic-gate 3267c478bd9Sstevel@tonic-gate PATH="${TOOLS_PROTO}/opt/onbld/bin/${MACH}:${PATH}" 3277c478bd9Sstevel@tonic-gate PATH="${TOOLS_PROTO}/opt/onbld/bin:${PATH}" 3287c478bd9Sstevel@tonic-gate export PATH 3297c478bd9Sstevel@tonic-gatefi 3307c478bd9Sstevel@tonic-gate 3310756aa0bSGavin Maltbyexport DMAKE_MODE=${DMAKE_MODE:-parallel} 33263df1173Spetede 3337ed54634SRobert Mustacchi# 3347ed54634SRobert Mustacchi# Work around folks who have historically used GCC_ROOT and convert it to 3357ed54634SRobert Mustacchi# GNUC_ROOT. We leave GCC_ROOT in the environment for now (though this could 3367ed54634SRobert Mustacchi# mess up the case where multiple different gcc versions are being used to 3377ed54634SRobert Mustacchi# shadow). 3387ed54634SRobert Mustacchi# 3397ed54634SRobert Mustacchiif [[ -n "${GCC_ROOT}" ]]; then 3407ed54634SRobert Mustacchi export GNUC_ROOT=${GCC_ROOT} 3417ed54634SRobert Mustacchifi 3427ed54634SRobert Mustacchi 3437c478bd9Sstevel@tonic-gateDEF_STRIPFLAG="-s" 3447c478bd9Sstevel@tonic-gate 3457c478bd9Sstevel@tonic-gateTMPDIR="/tmp" 3467c478bd9Sstevel@tonic-gate 34763df1173Spetedeexport \ 34863df1173Spetede PATH TMPDIR \ 34963df1173Spetede POUND_SIGN \ 35048bc00d6Sjmcp DEF_STRIPFLAG \ 35148bc00d6Sjmcp RELEASE_DATE 35263df1173Spetedeunset \ 35363df1173Spetede CFLAGS \ 35463df1173Spetede LD_LIBRARY_PATH 3557c478bd9Sstevel@tonic-gate 3567c478bd9Sstevel@tonic-gate# a la ws 3577c478bd9Sstevel@tonic-gateENVLDLIBS1= 3587c478bd9Sstevel@tonic-gateENVLDLIBS2= 3597c478bd9Sstevel@tonic-gateENVLDLIBS3= 3607c478bd9Sstevel@tonic-gateENVCPPFLAGS1= 3617c478bd9Sstevel@tonic-gateENVCPPFLAGS2= 3627c478bd9Sstevel@tonic-gateENVCPPFLAGS3= 3637c478bd9Sstevel@tonic-gateENVCPPFLAGS4= 3647c478bd9Sstevel@tonic-gatePARENT_ROOT= 365ead1f93eSLiane PrazaPARENT_TOOLS_ROOT= 3667c478bd9Sstevel@tonic-gate 36763df1173Spetedeif [[ "$MULTI_PROTO" != "yes" && "$MULTI_PROTO" != "no" ]]; then 36863df1173Spetede printf \ 369b83ec4edSjmcp 'WARNING: invalid value for MULTI_PROTO (%s); setting to "no".\n' \ 37063df1173Spetede "$MULTI_PROTO" 37163df1173Spetede export MULTI_PROTO="no" 3724e5b757fSkupferfi 3734e5b757fSkupfer 37463df1173Spetede[[ "$MULTI_PROTO" == "yes" ]] && export ROOT="${ROOT}${SUFFIX}" 3754e5b757fSkupfer 3767c478bd9Sstevel@tonic-gateENVLDLIBS1="-L$ROOT/lib -L$ROOT/usr/lib" 3777c478bd9Sstevel@tonic-gateENVCPPFLAGS1="-I$ROOT/usr/include" 3787c478bd9Sstevel@tonic-gate 379*864a8d69SBill Sommerfeld# Per usr/src/cmd/make/bin/main.cc, MAKEFLAGS could be in one of two styles. 380*864a8d69SBill Sommerfeld# If '-' or '=' is present, it is a new-style MAKEFLAGS which could be 381*864a8d69SBill Sommerfeld# pasted into the command line as-is. 382*864a8d69SBill Sommerfeld# Otherwise it is old-style (just a list of flag letters with no -) 383*864a8d69SBill Sommerfeld# make always converts MAKEFLAGS to new-style in the environment of 384*864a8d69SBill Sommerfeld# the processes it spawns 385*864a8d69SBill Sommerfeld 386*864a8d69SBill Sommerfeldcase $MAKEFLAGS in 387*864a8d69SBill Sommerfeld *-* | *=*) 388*864a8d69SBill Sommerfeld print "New-style MAKEFLAGS detected; no change made" 389*864a8d69SBill Sommerfeld print "" 390*864a8d69SBill Sommerfeld ;; 391*864a8d69SBill Sommerfeld *e*) 392*864a8d69SBill Sommerfeld ;; 393*864a8d69SBill Sommerfeld *) 394*864a8d69SBill Sommerfeld MAKEFLAGS="${MAKEFLAGS}e" 395*864a8d69SBill Sommerfeld print "MAKEFLAGS is now '${MAKEFLAGS}'" 396*864a8d69SBill Sommerfeld print "" 397*864a8d69SBill Sommerfeld ;; 398*864a8d69SBill Sommerfeldesac 399*864a8d69SBill Sommerfeld 40063df1173Spetedeexport \ 40163df1173Spetede ENVLDLIBS1 \ 40263df1173Spetede ENVLDLIBS2 \ 40363df1173Spetede ENVLDLIBS3 \ 40463df1173Spetede ENVCPPFLAGS1 \ 40563df1173Spetede ENVCPPFLAGS2 \ 40663df1173Spetede ENVCPPFLAGS3 \ 40763df1173Spetede ENVCPPFLAGS4 \ 40863df1173Spetede MAKEFLAGS \ 409cdf0c1d5Smjnelson PARENT_ROOT \ 4105c70f01eSRichard Lowe PARENT_TOOLS_ROOT 41163df1173Spetede 41263df1173Spetedeprintf 'RELEASE is %s\n' "$RELEASE" 41363df1173Spetedeprintf 'VERSION is %s\n' "$VERSION" 41463df1173Spetedeprintf 'RELEASE_DATE is %s\n\n' "$RELEASE_DATE" 41563df1173Spetede 41663df1173Spetedeif [[ -f "$SRC/Makefile" ]] && egrep -s '^setup:' "$SRC/Makefile" ; then 41763df1173Spetede print "The top-level 'setup' target is available \c" 41863df1173Spetede print "to build headers and tools." 41963df1173Spetede print "" 42063df1173Spetede 42163df1173Spetedeelif "${flags.t}" ; then 42263df1173Spetede printf \ 42363df1173Spetede 'The tools can be (re)built with the install target in %s.\n\n' \ 42463df1173Spetede "${TOOLS}" 4257c478bd9Sstevel@tonic-gatefi 4267c478bd9Sstevel@tonic-gate 4270756aa0bSGavin Maltby# 4280756aa0bSGavin Maltby# place ourselves in a new task, respecting BUILD_PROJECT if set. 4290756aa0bSGavin Maltby# 4300756aa0bSGavin Maltby/usr/bin/newtask -c $$ ${BUILD_PROJECT:+-p$BUILD_PROJECT} 4317c478bd9Sstevel@tonic-gate 43263df1173Spetedeif [[ "${flags.c}" == "false" && -x "$SHELL" && \ 433d7693b08SRoland Mainz "$(basename -- "${SHELL}")" != "csh" ]]; then 4347c478bd9Sstevel@tonic-gate # $SHELL is set, and it's not csh. 4357c478bd9Sstevel@tonic-gate 43663df1173Spetede if "${flags.f}" ; then 43763df1173Spetede print 'WARNING: -f is ignored when $SHELL is not csh' 4387c478bd9Sstevel@tonic-gate fi 4397c478bd9Sstevel@tonic-gate 44063df1173Spetede printf 'Using %s as shell.\n' "$SHELL" 44163df1173Spetede exec "$SHELL" ${@:+-c "$@"} 4427c478bd9Sstevel@tonic-gate 44363df1173Spetedeelif "${flags.f}" ; then 44463df1173Spetede print 'Using csh -f as shell.' 4457c478bd9Sstevel@tonic-gate exec csh -f ${@:+-c "$@"} 4467c478bd9Sstevel@tonic-gate 4477c478bd9Sstevel@tonic-gateelse 44863df1173Spetede print 'Using csh as shell.' 4497c478bd9Sstevel@tonic-gate exec csh ${@:+-c "$@"} 4507c478bd9Sstevel@tonic-gatefi 45163df1173Spetede 45263df1173Spetede# not reached 453