mmake 12.5 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548
#! /bin/sh
#
# Stole this from the common SGI mmake. Hack it up to only do PR. Typical
# usage is
#
#	mmake -cuH
#
# This is a stripped version of SGI internal graphics build script mmake.
# When defining new commands, make efforts to avoid collision with current
# command flags so future integration would be easy.
#
# Key Example of usage
#
#	mmake -Iu	build the header files and p_tupdate all files
#	mmake -H	builds everything
#	mmake -c	clobbers everything
#	mmake -a	runs the nightly regression tests (will be done after
#			all other build activity has completed, if any).
#
# List of things you should do on your system prior to running this script:
#
#       1. Reserve a workarea underneath your home account that's large enough
#	   to hold the PR sources & executables (this script, mmake, will set
#	   $WORKAREA to $HOME/mdevroot.
#
#	2. nfs mount the source tree (ie madman:/mdev)
#
#	   Note: this is not necessary if you put the following lines in your
#	         $WORKAREA/.workarea file:
#
#	   workarea.sm_location: /mdev
#	   workarea.sm_machine: madman
#          workarea.sm_transport_method: network
#
#	3. Setup an account on the srctree host machine (e.g. madman); ptools 
#	   will use rsh to access the machine hosting the source tree.
#
#	4. Get all of the standard system libraries and header files installed
#	   underneath your $WORKAREA.  There are two ways you can do this:
#
#	Method One:
#
#          Make sure your local machine has a full complement of compilers
#	   and build tools.  The PR build environment does not use a workarea
#	   based TOOLROOT, so do not set this environment variable or attempt
#	   to set up a TOOLROOT in your source tree; it's needless complexity
#	   at this stage of development.  The Irix subsystems you must 
#	   install include the following:
#
#	   compiler_dev  (be sure to get the internal headers too)
#	   compiler_eoe
#	   gl_dev	 (GL header files & libimage.a image file support)
#	   x_dev	 (X11 header files & libraries)
#
#	   Symlink everything in your /usr/include directory to your
#	   $WORKAREA/usr/include with the following commands:
#
#	   ln -s /usr/include/* $WORKAREA/usr/include
#	   rm $WORKAREA/usr/include/make     (break the symlink...)
#	   mkdir $WORKAREA/usr/include/make  (...so we can install headers)
#	   ln -s /usr/include/make/* $WORKAREA/usr/include/make
#
#	   Symlink everything in your /usr/lib directory to your 
#	   $WORKAREA/usr/lib with the following commands:
#
#	   ln -s /usr/lib/* $WORKAREA/usr/lib
#
#	Method Two:
#
#	   Install the build isms needed to build PR software directly into 
#          your $WORKAREA (this will install all the necessary include files 
#	   and libraries into your build arena rooted beneath $WORKAREA):
#
# inst -a -x -f /hosts/babylon.wpd/usr/dist/sherwood/LATEST.5.2MR/root/build_root -r $ROOT
#
# inst -a -x -f /hosts/babylon.wpd/usr/dist/sherwood/LATEST.5.2MR/root/cmplrs_root -r $ROOT
#
# inst -a -x -f /hosts/babylon.wpd/usr/dist/sherwood/LATEST.5.2MR/root/gfx_root -r $ROOT
#
# inst -a -x -f /hosts/babylon.wpd/usr/dist/sherwood/LATEST.5.2MR/root/irix_root -r $ROOT
#
# inst -a -x -f /hosts/babylon.wpd/usr/dist/sherwood/LATEST.5.2MR/root/man_root -r $ROOT
#
# inst -a -x -f /hosts/babylon.wpd/usr/dist/sherwood/LATEST.5.2MR/root/x_root -r $ROOT
#
#
#	5. nfs mount the ecad based tools on your build machine; you can
#	   use automount if you create the following symlink as root on
#	   your machine (for example) and run the automount daemon
#	   (do a chkconfig automount on and reboot if it's not already on):
#
#	   ln -s /hosts/mileena.engr/ecad /ecad	
#	   (this assumes the ecad tools are on a machine called "mileena.engr")
#
#	6. For info on how to setup a nightly build, see the file
#	   "README.nightly".  The script 'mnightly' will set the necessary 
#	   environment variables, then invoke mmake to clobber, update & build,
#	   then sends you (via e-mail) a filtered report of what actually got 
#	   done during the build.
#
# IMPORTANT NOTES:
#	
# Options (ones we support are marked with PR)
#
#	-0	IP20 build
#
#	-1	IP21 build
#
#	-2	MAGNUM/IP12 build
#
#	-3	IP22 build
#
#	-4	IP4 build
#
#	-5	IP5/IP7/IP13/IP15 build
#
#	-6	IP6 build
#
#	-7	R4000/IP17 build
#
#	-8	4D100 build
#
#	-9	R4000/IP19 build
#
# PR	-a	Run PR nightly regressions (used to install new IRIX4 ISMs) 
#		(these will be run after all other build activity completes,
#		 if any).
#
#	-b	specify the inst ROOT for IRIX4 ISMs (default is $ROOT) 
#
# PR	-c	clobber
#
#	-e	build EXPRESS graphics
#
#	-g	build CLOVER1 graphics
#
#	-h	"build irix gfx x" ISM directory identifier	eg. -h P26
#		to specify ISMs at /hosts/babylon.engr/usr/dist/5.1/P26
#
# 	-i	install new "build irix gfx x" ISMs (default is LATEST)
#
#	-j	"cmplrs" ISM directory identifier		eg. -j P25
#		to specify ISMs at /hosts/babylon.engr/usr/dist/5.1/P25
#
#	-k	install new "cmplrs" ISMs (default is LATEST)
#
#	-l	(ell) build LIGHT graphics
#
#	-n	build Newport graphics
#
#	-p	build PI graphics
#
#	-q	RAGANROK ISM directory identifier eg. -q 8028
#
#	-r	install new RAGANROK ISMs (default is LATEST)
#
#	-s	build SERVER graphics
#
#	-t	build GT graphics
#
# PR	-u	update the tree
#
#	-x	build GTX graphics
#
#	-v	build VGX graphics
#
#	-w	build SKYWRITER version of VGX graphics
#
#	-z	build VENICE graphics
#
#	-A	specify $IRIX4ROOT				eg. -A $ROOT/4
#
#	-B	build GLdebug
#
#	-C	build X clients
#
# PR	-F	build diags - Currently only VENICE/MIRAGE supported
#
#	-G	build GLs
#
# PR	-H	build simulator related stuff (libsimgl, tests libs, & sim)
#			=> venice stuff is currently incomplete
#
# PR	-I	build symbolic linked headers and libraries
#		WAS - build headers
#
#	-J	abort when about to start building (useful for doing tree clobbers)
#
#	-K	build kernels
#
# PR	-L	turn on library builds.
#		WAS - turn on libgl.a build, off dy default (now)
#
# PR	-M	real machine where src code is		eg. -M jake
#
#	-N	build libglnohw.a
#
#	-O	build OpenGLs
#
#	-P	toolroot				eg. -P ~/trees/cctoolroot
#
#	-Q	build GTST
#
# PR	-R	$ROOT					eg. -R ~/jake
#
#	-S	build libgl_s using a 4.0 ROOT & TOOLROOT as specified in the
#		environment variable IRIX4ROOT 
#
# PR	-T	where the root of the srctree is on	eg. -T jake
#		src code machine.
#
# PR	-U	build ucode
#
# PR	-W	specifiy $WORKAREA			eg. -W ~/tree/shrwd
#
#	-V	build corresponding video bits.
#
#	-X	build xserver
#	
#	-Y	build X libraries (default off)
#
#	-Z	specify automount path to ISMs		eg. -Z /hosts/myhost/dist/5.1/
#
#
# Note
#	There are interdepenancies between WORKAREA ROOT TOOLROOT.  The
#	script tried to do the right thing.
#
# Examples
#
#	mmake
#		does nothing
#
#	cd $HOME
#
#	mmake -cuzGIKU -W $HOME/trees/sherwood 
#		- p_tupdates virtually everyting you need for VENICE dev.
#		- builds VENICE ucode, gl, and kernel for IP7
#
#	mmake -cuzGXIKU -W $HOME/trees/sherwood 
#		- All that the previous one does and builds the X server
#
#	mmake -05K -W $HOME/trees/sherwood 
#		- makes IP20 and IP5 kernels 
#

echo "\n"`basename $0`" $@ started - `date`\n"

#
# Initial enviroment settings
#
P_TUPDATE="p_tupdate -v"
P_CHECK="p_check -s"
P_PURGE="p_purge -yiu"
MAKE="make -k"

DIAGBUILD=FALSE
ABORTBUILD=FALSE
SKELETON=FALSE

SRCMACH="madman"
SRCTREE="mdev"
WORKAREA="$HOME/mdevroot"

UPDATE=FALSE
CLOBBER=FALSE
REGRESSION=FALSE

INCBUILD=FALSE
BUILD=FALSE

#########################################################################
#
# Parse input
# 
########################################################################
#
# mmake from sherwood has - while getopts 0123456789ab:cegh:ij:klnpq:rstuxvwzA:BCFGHIJKLMN:OP:QR:ST:UVW:XYZ: c

while getopts acuHIJMP:R:T:W: c
do
    case $c in
	a)	REGRESSION=TRUE ;;
	c)	CLOBBER=TRUE ;;
	u)	UPDATE=TRUE ;;
	H)	BUILD=TRUE ;;
	I)	INCBUILD=TRUE ;;
	J)	ABORTBUILD=TRUE ;;
	M)	SRCMACH=$OPTARG ;;
	P)	TOOLROOT=$OPTARG ;;
	R)	ROOT=$OPTARG ;;
	T)	SRCTREE=$OPTARG ;;
	W)	WORKAREA=$OPTARG ;;
	\?)	echo $USAGE; exit 2 ;;
    esac
done
shift `expr $OPTIND - 1`

#
# Turn on trace
set -x

# Setup misc environment stuff
#
TMPDIR=/usr/tmp

#
# Test for missing enviroment stuff
#
if test -z "$WORKAREA"
then
    if test -z "$ROOT"
    then
	WORKAREA=$ROOT
    else
	echo "$WORKAREA not set, use -W"
	exit 2
    fi
fi

if test -z "$ROOT"; then ROOT=$WORKAREA; fi
if test -z "$TOOLROOT"; then TOOLROOT=/; fi

# Aliases
#
PR=$WORKAREA/PR
PATH=.:/usr/local/bin/ptools:$ROOT/usr/bsd:$ROOT/usr/sbin:$ROOT/bin:/usr/bsd:/bin:/usr/bin:/usr/sbin:/etc:/usr/etc:/lib

# force no -cckr since so many things flame with it turned on
unset SGI_CC

echo "WORKAREA = $WORKAREA"
echo "TOOLROOT = $TOOLROOT"
echo "ROOT = $ROOT"

# Exports
#
export ROOT WORKAREA PATH TMPDIR TOOLROOT 

#########################################################################
#
# Build Tree Skeleton
#
#########################################################################

SKELETON=TRUE
if test $SKELETON = TRUE
then
    if [ ! -d $ROOT ]; then mkdir -p $ROOT; fi
    if [ ! -d $TOOLROOT ]; then mkdir -p $TOOLROOT; fi
    if [ ! -d $WORKAREA ]; then mkdir -p $WORKAREA; fi

    cd $WORKAREA; 

    if [ ! -f $WORKAREA/.workarea ] 
    then 
	touch .workarea 
	echo "workarea.sm_location: /$SRCTREE" >>.workarea 
	echo "workarea.sm_machine: $SRCMACH" >>.workarea

	CLOBBER=FALSE;
    fi

    if [ ! -f $WORKAREA/census ] 
    then 
	touch census
    fi

    for dir in  $WORKAREA		\
		$WORKAREA/usr/include	\
		$WORKAREA/usr/lib	\
		$PR/doc
    do
	if [ ! -d $dir ];  then mkdir -p $dir; fi
    done

fi

#########################################################################
#
# Clobber stuff
#
#########################################################################

if test $CLOBBER = TRUE
then

    #
    # For now, C simulators, ucode,  host libraries
    #

    for dir in  $PR/include		\
		$PR/libultra		\
		$PR/tools		\
		$PR/iosim		\
		$PR/debugger		\
		$PR/rspasm		\
		$PR/rspsim		\
		$PR/rdpsim		\
		$PR/rdpsim/test		\
		$PR/rdpsim/test/rdp	\
		$PR/man			\
		$PR/rspcode		\
		$PR/apps		\
		$PR/apps.released
    do
	cd $dir; make clobber; make clean
    done
fi


#########################################################################
#
# tupdate stage
#
#########################################################################

if test $UPDATE = TRUE
then
    # Grab new mmake in case people have it symlinked
    #
    cd $PR/doc; $P_TUPDATE; $P_CHECK | $P_PURGE 

    # Grab new defs & rules
    cd $PR; $P_TUPDATE PRdefs PRrules

    if test $INCBUILD = TRUE
    then
	# header files
	#
	cd $WORKAREA/usr/include; ln -s /usr/include/* .

	# libraries
	#
	cd $WORKAREA/usr/lib; ln -s /usr/lib/* .
    fi

    #
    # C simulators, ucode, host libraries, apps, iosim environment
    #

    for dir in  $PR/include		\
		$PR/libultra		\
		$PR/tools		\
		$PR/iosim		\
		$PR/debugger		\
		$PR/rspasm		\
		$PR/rspsim		\
		$PR/hw			\
                $PR/hw2                 \
                $PR/rdpsim		\
		$PR/rspcode		\
		$PR/doc			\
		$PR/man			\
		$PR/apps		\
		$PR/apps.released
    do
	cd $dir; $P_TUPDATE; $P_CHECK | $P_PURGE;
    done

fi

#########################################################################
#
# build stage
#
#########################################################################

if test $ABORTBUILD = TRUE
then
    exit 0;
fi

INSTOPTS=-t
export INSTOPTS

if test $BUILD = TRUE
then

	cd $PR; make headers
	cd $PR; make exports

    #
    # C simulators, ucode,  host libraries, apps
    #

    for dir in  $PR/include		\
    		$PR/libultra		\
		$PR/tools		\
		$PR/debugger		\
		$PR/rspasm		\
		$PR/rspsim		\
		$PR/rdpsim		\
		$PR/rdpsim/test/rdp	\
		$PR/rspcode		\
		$PR/iosim		\
		$PR/man			\
		$PR/apps		\
		$PR/apps.released
    do
	cd $dir; make -k install
    done

fi

#########################################################################
#
# regression stage
#
#########################################################################

if test $REGRESSION = TRUE
then


#
# Build the iosim based simulator for the verilog mspan debugging environment,
# then build the nightly regression targets in apps/rdpatt, apps/rdpcov, 
# apps/rdpew, apps/rdptex, and finally in the RDP simulator directory.
#

RSP_UCODE=../../rspcode/graphics
export RSP_UCODE

    #
    # Build 'simv.ipc', and put the goodies in rdpsim/test/rdp.
    #
    cd $PR/hw/chip/sim; make ipc SIMVDIR="$PR/rdpsim/test/rdp"

    #
    # Build the nightly_regression targets in the apps directories, then
    # use the rdram files generated there by making the nightly_regression
    # target in PR/rdpsim/test/rdp.
    #
    for dir in  $PR/apps/rdpatt		\
		$PR/apps/rdpcov		\
		$PR/apps/rdpew		\
		$PR/apps/rdptex		\
		$PR/apps/rdpms		\
		$PR/rdpsim/test/rdp
    do
	cd $dir; make nightly_regression
    done
fi

#########################################################################

echo `basename $0`" $@ ended - `date`\n"