# buildmac - MPW Shell script to build Awk using Apple's MRC compiler.
# buildmac is Copyright Daniel K. Allen, 1999-2003.
# All rights reserved.
#
# 22 Jan 1999 - Created by Dan Allen.
# 25 Mar 1999 - Updated for newer Awk.
#
# Porting notes for the Mac:
# 
# 1.  main in main.c needs to have its prototype changed to:
# 
#     int main(int argc, char *argv[], char *environ[])
#
# 2.  popen and pclose in missing95.c need to have as their body the
#			older style
#
#				return NULL;
#
#			as parallel pipes are not supported by MPW.
#
#	3.	To make your Mac more responsive while long awk scripts run,
#			you may want to add some SpinCursor calls to support cooperative multitasking.
#
# All of these minor changes can be put under "#ifdef powerc" for portability's sake.
#
#

If {1} == "clean"
	Delete -i awk maketab maketab.c.o ytab.c.o b.c.o main.c.o parse.c.o proctab.c proctab.c.o tran.c.o lib.c.o run.c.o lex.c.o missing95.c.o
Else
	MRC ytab.c -w off -opt speed
	MRC b.c -w off -opt speed
	MRC main.c -w off -opt speed
	MRC parse.c -w off -opt speed
	MRC maketab.c -w off -opt speed
	PPCLink -o maketab maketab.c.o "{PPCLibraries}InterfaceLib" "{PPCLibraries}MathLib" "{PPCLibraries}StdCLib" "{PPCLibraries}StdCRuntime.o" "{PPCLibraries}PPCCRuntime.o" "{PPCLibraries}PPCToolLibs.o" -t MPST -c 'MPS '
	maketab > proctab.c
	MRC proctab.c -w off -opt speed
	MRC tran.c -w off -opt speed
	MRC lib.c -w off -opt speed
	MRC run.c -w off -opt speed
	MRC lex.c -w off -opt speed
	MRC missing95.c -w off -opt speed
	PPCLink -o awk ytab.c.o b.c.o main.c.o parse.c.o proctab.c.o tran.c.o lib.c.o run.c.o lex.c.o missing95.c.o "{PPCLibraries}InterfaceLib" "{PPCLibraries}MathLib" "{PPCLibraries}StdCLib" "{PPCLibraries}StdCRuntime.o" "{PPCLibraries}PPCCRuntime.o" "{PPCLibraries}PPCToolLibs.o" -d
	SetFile awk -d . -m . -t MPST -c 'MPS '
End
