#
#	File:		BuildDisplayMgrInit
#
#	Contains:	Finishes up a Display Manager INIT make.
#				Run this script after the system build for Display Manager has been done
#				to add a preflight check ('bnvs' resource) & INIT icons (if I get to them)
#
#		Suggested Build Lines:
#				{Make}Build System -p -macsbugSymbols off -init DisplayMgrINIT "DisplayMgr.o"  "{Worksheet}" ; "{DisplayMgr}BuildDisplayMgrInit"  "{Worksheet}"
#
#	Written by:	Ian Hendry
#
#	Copyright:	 1991-1993 by Apple Computer, Inc., all rights reserved.
#
#
#	Change History (most recent first):
#
#		 <1>	 3/25/93	IH		first checked in
#		 <2>	  3/5/93	IH		Fix suggested build lines
#		 <1>	  3/1/93	IH		first checked in
#		 		 2/26/93	IH		new today	
#
#	To Do:
#


set displayObjDir 		"{Sources}Objects:System:InitObjects:"
set displayDestDir		"{Sources}BuildResults:System:"
set displaySourceDir	"{Sources}ToolBox:DisplayMgr:"
set displayMgrINIT		"{displayDestDir}DisplayMgrINIT"

Echo
Echo "_____________________________"
Echo "Starting extension build of Display Manager."
Echo

Exists -d "{displayObjDir}" > dev:null
if {status}
	Echo "Creating objects folder"
	NewFolder "{displayObjDir}"
end

Echo "Assembling StartDisplayMgr.a"
Asm {displaySourceDir}StartDisplayMgr.a -o {displayObjDir}StartDisplayMgr.a.o -d debugging=1

Echo "Linking StartDisplayMgr.a.o into {displayMgrINIT}"
Link -o {displayMgrINIT} {displayObjDir}StartDisplayMgr.a.o -rt pflp=-16385

Echo "Rezing version info"
rez {displaySourceDir}DisplayMgrExtension.r -o {displayMgrINIT} -t INIT -c 'dspl' -a

Echo "Renaming extension"
Rename -y {displayMgrINIT} "{displayDestDir}Display Manager"

Echo "Setting file info"
SetFile "{displayDestDir}Display Manager" -a bi

# Make sure the parent dir is modified so finder knows
# This fixes an annoying fact that Finder does not notice when the file is renamed
Set tempTime "`Date -s`"
Loop
	Set nowTime "`Date -s`"
	if !("{nowTime}" =~ /"{tempTime}"/)
		SetFile "{displayDestDir}" -m "`Date -s`"
		break
	End
End


Echo "Finished build."
Echo "_____________________________"
