#
#
# Builds   {Any Build Parameters}
#
# by Steven Glass
# 16 Jan 89
#
# Executes the Build commands for each of the projects that makes up
# system disk 4.1.
#
#
# All parameters are passed directly to the build scripts that are run.
#
# This script should work no matter what the directory is set to 
# when it is run.
#
# If the script runs correctly to completion, then the directory will
# remain unchanged.
#
# Modified:
#
#	8/27/90	GAB	Removed build of BASIC.Launcher
#
##########################################################################
# Find out where I am
set myparent `files -f {Command}`
(evaluate "{myparent}" =~ /(([:]*:)+)1[:]*/ ) > Dev:Null
set myparent "{1}"
IF "{myparent}" == ""
  echo "*** ERROR:  Cannot determine script home directory."
  exit
END

unset exit

# Save the current dir
set ThisDir `Directory`


Directory {MyParent}

# make sure the All.Macros file is up to date
BuildProgram All.Macros

# build the SetLoadName tool
	Echo "# `Date -t` ----- Build of SetLoadName."
	Echo "# `Date -t` ----- Analyzing dependencies."
	Begin
		Echo "Set Echo 1"
		Make -f SetLoadName.make SetLoadName
	End > makeout
	Echo "# `Date -t` ----- Executing build commands."
	makeout
	Delete makeout
	Echo "# `Date -t` ----- Done."

Directory ::

# Start with the OS
Directory :gs.os:scripts:
build all -s -p {parameters}
save "{worksheet}"
# we don't really need to do this anymore, do we?
# duplicate -y ::workfolder:scm.bin A2CE_Sources:lou:

# Next is basic
Directory :::basic.system
BuildProgram basic.system {parameters}	# Basic.Launcher used to be here too!
save "{worksheet}"

# Third is the toolbox
Directory ::gstoolbox
Build.Tools {parameters}
save "{worksheet}"

# Finally, the utilities etc.
Directory ::a.u.g.
Build.all {parameters}
save "{worksheet}"

# build the Archiver application
Directory ::ArchiverGS
Buildprogram {parameters} Archiver.app
save "{worksheet}"

# build the synthLab application
Directory ::synthLab
Echo "# `Date -t` ----- Build of synthLAB stuff."
Buildprogram {parameters} all
save "{worksheet}"

Directory {ThisDir}

Set exit 1