#
#	Spell.make	- Makefile for Spell
#
#	Copyright © 1989, Claris Corporation.
#
#	This is a sub-makefile, called recursively when ::AppleWorks.make is
#	executed.
#
#	All modules (including Driver, Scrap, Pict., SS, DB, etc.)
#	should have similar makefiles in their respective folders.
#
#	This makefile rebuilds the module object files as necessary and creates a
#	file containing the necessary steps to link this module with the rest of 
#	AppleWorksGS.  ::AppleWorks.make combines the link files from the modules
#	into a script which it executes to create an executable.

#--------------------------------------------------------------------------------
#	Variables

AsmIIGSOptions	=
CIIGSOptions	=

Segment1		=	SPTHSTATIC
Segment2		=	SP
Segment3		=	TH
Segment4		=	SPTH

Module		=	Spell
ModuleDir		=	{AWGS}{Module}:

SrcDir 		=	{ModuleDir}Src:
IncDir 		=	{ModuleDir}Inc:
ObjDir 		=	{ModuleDir}Obj:

CLib			=	{AWGS}CLib:CLib

Linkfile		=	{ModuleDir}{Module}.link
Makefile		=	{ModuleDir}{Module}.make

GlobalIncludes	=	

GlobalMacros	=	{AWGS}Macros:Macros.dump



All_Objs		=	{Objs1} {Objs2} {Objs3} {Objs4}
Other_Objs	=	{Objs5}

DemoObjs		=	{ObjDir}spdemo.o

Objs			=	{Objs1} {Objs2} {Objs3} {Objs4}

Objs1		=	{ObjDir}engphon.o			¶
				{ObjDir}bytread.o

Objs2		=	{ObjDir}sp.o				¶
				{ObjDir}spdlg.o			¶
				{ObjDir}udedit.o			¶
				{ObjDir}chartype.o			¶
				{ObjDir}correct.o			¶
				{ObjDir}corrphon.o			¶
				{ObjDir}corrsubr.o			¶
				{ObjDir}clx.o				¶
				{ObjDir}lex.o				¶
				{ObjDir}isword.o			¶
				{ObjDir}spath.o			¶
				{ObjDir}sCLib.o			¶
				{ObjDir}clam.o

Objs3		=	{ObjDir}thdlg.o			¶
				{ObjDir}th.o				¶
				{ObjDir}thes.o				¶
				{ObjDir}thesutil.o			¶
				{ObjDir}unflect.o			¶
				{ObjDir}inflect.o			¶
				{ObjDir}unfexc.o			¶
				{ObjDir}dispunf.o			¶
				{ObjDir}tlex.o				¶
				{ObjDir}tsCLib.o
				
Objs4		=	{ObjDir}memory.o			¶
				{ObjDir}zalloc.o			¶
				{ObjDir}strdiff.o			¶
				{ObjDir}move.o				¶
				{ObjDir}strecpy.o			¶
				{ObjDir}phon.o				¶
				{ObjDir}proxzero.o			¶
				{ObjDir}proxio.o			¶
				{ObjDir}newutils.o

Objs5		=	{ObjDir}spint.o			¶
				{ObjDir}cortheta.o			¶
				{ObjDir}corasm.o			¶
				{ObjDir}clxasm.o			¶
				{ObjDir}lexasm.o			¶
				{ObjDir}thint.o			¶
				{ObjDir}tlexasm.o

SP_H	=			{ObjDir}clam.o				¶
				{ObjDir}clx.o				¶
				{ObjDir}lex.o				¶
				{ObjDir}memory.o			¶
				{ObjDir}sp.o				¶
				{ObjDir}spdemo.o			¶
				{ObjDir}spdlg.o			¶
				{ObjDir}uedit.o

TH_H =			{ObjDir}th.o				¶
				{ObjDir}thdlg.o			¶
				{ObjDir}thes.o				¶
				{ObjDir}tlex.o				¶
				{ObjDir}unfexc.o
				
ARRAYS = 			`suffixlist (@~arrays) {ALL_OBJS} {CLib}`
GLOBALS = 		`suffixlist (@~globals) {ALL_OBJS} {CLib}`
Objs1_main =		`suffixlist (@main) {Objs1}`
Objs2_main =		`suffixlist (@main) {Objs2}`
Objs3_main =		`suffixlist (@main) {Objs3}`
Objs4_main =		`suffixlist (@main) {Objs4}`
Demo_main	=		`suffixlist (@main) {DemoObjs}`
Demo_arrays =		`suffixlist (@~arrays) {DemoObjs}`
Demo_globals =		`suffixlist (@~globals) {DemoObjs}`
BobList =			{AWGS}Driver:Obj:BL.Å

#--------------------------------------------------------------------------------
#	Main target

{Linkfile}	ÄÄ	{Objs} {Makefile} {other_objs} {CLib}
	@if "`newer {Makefile} {LinkFile}`";					¶
		@echo	"# Creating {LinkFile} ¶É"
		@echo	"	-lib			{CLib}				¶¶" >  {Targ}
		@echo	"	-lseg		{Segment1}	{Objs1_main}	¶¶" >> {Targ}
		@echo	"							{Objs5}		¶¶" >> {Targ}
		@echo	"							{Arrays}		¶¶" >> {Targ}
		@echo	"							{Globals}		¶¶" >> {Targ}
		@echo	"	-lseg:dynamic	{Segment2}	{Objs2_main}	¶¶" >> {Targ}
		@echo	"	-lseg:dynamic	{Segment3}	{Objs3_main}	¶¶" >> {Targ}
		@echo	"	-lseg:dynamic	{Segment4}	{Objs4_main}	¶¶" >> {Targ}
		@echo	"							{CLib}(@main)	¶¶" >> {Targ}
	@else
		@touch {linkfile}
	@end

spdemo	ÄÄ {ALL_OBJS} {OTHER_OBJS} {DemoObjs} {CLib} spell.make
	@linkiigs -apw -o spdemo 						¶
	@	-lib {CLib}									¶
	@	-lseg main {ciigslibrary}start.obj {Demo_main} ¶
	@	-lseg	 	{Segment1}		{Objs1_main}	¶
	@								{Objs5}		¶
	@								{Demo_arrays}	¶
	@								{Demo_globals}	¶
	@								{BobList}		¶
	@								{ARRAYS}		¶
	@								{GLOBALS}		¶
	@	-lseg:dynamic {Segment2} 		{Objs2_main}	¶
	@	-lseg:dynamic {Segment3} 		{Objs3_main}	¶
	@	-lseg:dynamic {Segment4} 		{Objs4_main}	¶
	@								{CLib}(@main)	¶
	@	-t 'B5  ' -s > list
	duplicateiigs -mac -y spdemo :

{CLib}	Ä
	@!build	{BuildFlags}	-f {AWGS}CLib:CLib.make			{AWGS}CLib:CLib

#	Global Spell dependencies


clean	Ä
	@confirm "Delete {Module} objs and linkfile?"
	@if {status} == 0 then
		@set oldexit {exit}
		@unset exit
		delete	{Linkfile} {Objs}
		delete 	{objdir}Å.root {objdir}Å.a
		@set exit {oldexit}
	@end

#--------------------------------------------------------------------------------
#	Default rules

{ObjDir}	Ä	{SrcDir}

{SP_H}	Ä	{IncDir}sp.h

{TH_H}	Ä	{IncDir}th.h

{ObjDir}proxio.o	¶
{ObjDir}sp.o	¶
{ObjDir}spdlg.o	¶
{ObjDir}thdlg.co	¶
{ObjDir}udedit.o	¶
		Ä	{IncDir}driver.h

{OBJS5}	Ä	{GlobalMacros}

.o		Ä	.c
	CIIGS {CIIGSOptions} -i {IncDir} {DepDir}{Default}.c -o {TargDir}{Default}.o

.o		Ä	.s
	AsmIIGS {DepDir}{Default}.s -o {TargDir}{Default}.o -i {IncDir},{AWGS}Macros {AsmIIGSOptions}
