#	File Make -  Make instructions for HyperCard XCMD examples.
#
#	Copyright Apple Computer, Inc. 1988
#	All rights reserved.
#
#	This makefile builds:
#		The sample Pascal XCMD:		LittleDialog
#		The sample Pascal XFCN:		Reduce
#		The sample C XCMD:			LittleDialog
#		The sample C XFCN:			Reduce
#		The sample Assembler XCMD:	LittleDialog
#		The sample Assembler XFCN:	Reduce


#	Determine specific options:
#
#	The XCMD can be installed directly into the appropriate stack
#	by setting {Dest} to the correct pathname.

Set Dest	'∂"HyperXExample Stack∂"'
Set Debug	'-mbg off'
Set Libs	'∂"{Libraries}HyperXLib.o∂" ∂"{Libraries}Interface.o∂" '


#	Determine information specific to each XCMD or XFCN:
#	Each XCMD and XFCN must have a unique resource id.

If {1} =~ /Reduce.[pca]/
	Set 2 'XFCN=12'
Else If {1} =~ /LittleDialog.[pca]/
	Set 2 'XCMD=10002'
Else
	If ({#} == 1) && ({1} =~ /≈.[pca]/)
		Echo "# {1} must be assigned an XCMD resource number in the Make file."
	Else
		Echo "# Command must be of the form: Make filename.[pca]"
	End
	Exit 1
End


#	Determine the language specific options:

If {1} =~ /(≈)®1.p/
	Set Lang Pascal
	Set LOpts "-w -rt {2} -m ENTRYPOINT -sg {®1}"
	Set LLibs '∂"{PLibraries}PasLib.o∂"'
Else If {1} =~ /(≈)®1.c/
	Set Lang "C -b"
	Set LOpts "-w -rt {2} -m ENTRYPOINT -sg {®1}"
	Set LLibs '∂"{CLibraries}StdCLib.o∂" ∂"{Libraries}Runtime.o∂"'
Else If {1} =~ /(≈)®1.a/
	Set Lang 'Asm -w'
	Set LOpts "-w -rt {2} -m ENTRYPOINT -sg {®1}"
	Set LLibs ''
	Set Debug ''
End


#	Create the actual build commands:

If `Newer {1} {1}.o`
	Echo {Lang} {1} {Debug}
End

Echo Link {LOpts} -o {Dest} {1}.o {Libs} {LLibs}

If `Exists {®1}.r`
	Echo Rez {®1}.r -o {Dest} -append
End


#	Select the output lines and press "Enter" to complete the build.