#############################################################################
##
#A  make_mpw                    GAP source                         Dave Bayer
##
##  This file is a Makefile for GAP on the Mac with Mac Programmers Workshop.
##  Rename the file to 'GAP.make', place it in the source folder, and try it.
##  You must also copy the source file  'fix_siow.c' into the  source folder.
##
##  If you use MPW 3.3.1,  copy the  'C' tool  from MPW 3.2.3  into the tools
##  folder as 'C3.2.3' and change the definition below to 'CPP = C3.2.3 -e2'.
##  This is necessary because the preprocessor in MPW 3.3.1 is broken.
##
##  Any nonsense in this  file is due to Martin Schoenert who reorganized it.
##  (Why can't Apple support the standard makefile format, or if they have to
##  replace it, at least replace it with something that is really better? ;-)
##

##  CPP      = C3.2.3 -e2  (use this definition for MPW version 3.3.1)
CPP      = C3.2.3 -e2
CC       = C

# for a 32bit SIOW version
DEFINES  =  -d SYS_IS_MAC_MPW                   -d SYS_HAS_STRING_PROTO
COPTIONS =  -model far  -sym on  -opt full  -w
LOPTIONS =  -model far  -sym on             -w  -t APPL  -C '????'
LIBFILES =  "{CLibraries}"StdClib.o SIOW_NoMAZ.o            
            "{Libraries}"Runtime.o "{Libraries}"Interface.o
SEGMENTS = 
REZCMD   =  Rez -a "{RIncludes}"SIOW.r -o {PROGRAM}
.c.o         .c
	{CPP}            {default}.c >  {default}.i
	{CC}  {COPTIONS} {default}.i -o {default}.c.o -s gap
	Delete {default}.i
system.c.o   system.c
	{CPP} {DEFINES}  system.c    >  system.i
	{CC}  {COPTIONS} system.i    -o system.c.o    -s gap
	Delete system.i

# for a 32bit TOOL version
#DEFINES  =  -d SYS_IS_MAC_MPW  -d SYS_HAS_TOOL  -d SYS_HAS_STRING_PROTO
#COPTIONS =  -model far  -sym on  -opt full  -w
#LOPTIONS =  -model far  -sym on             -w  -t MPST  -C 'MPS '
#LIBFILES =  "{CLibraries}"StdClib.o "{Libraries}"Stubs.o    
#            "{Libraries}"Runtime.o "{Libraries}"Interface.o 
#            "{Libraries}"ToolLibs.o
#SEGMENTS = 
#REZCMD   =
#.c.o         .c
#	{CPP}            {default}.c >  {default}.i
#	{CC}  {COPTIONS} {default}.i -o {default}.c.o -s gap
#	Delete {default}.i
#system.c.o   system.c
#	{CPP} {DEFINES}  system.c    >  system.i
#	{CC}  {COPTIONS} system.i    -o system.c.o    -s gap
#	Delete system.i

# for a 16bit SIOW version (which seems to be a little bit slower):
#DEFINES  =  -d SYS_IS_MAC_MPW                   -d SYS_HAS_STRING_PROTO
#COPTIONS =  -m          -sym on  -opt full  -w
#LOPTIONS =              -sym on             -w  -t APPL  -C '????'
#LIBFILES =  "{CLibraries}"StdClib.o SIOW_NoMAZ.o            
#            "{Libraries}"Runtime.o "{Libraries}"Interface.o
#SEGMENTS =  -sg Main=gap,gasman,system -sn read=scanner -sn idents=eval
#REZCMD   =  Rez -a "{RIncludes}"SIOW.r -o {PROGRAM}
#.c.o         .c
#	{CPP}            {default}.c >  {default}.i
#	{CC}  {COPTIONS} {default}.i -o {default}.c.o -s {default}
#	Delete {default}.i
#system.c.o   system.c
#	{CPP} {DEFINES}  system.c    >  system.i
#	{CC}  {COPTIONS} system.i    -o system.c.o    -s system
#	Delete system.i

# for a 16bit TOOL version (which seems to be a little bit slower):
#DEFINES  =  -d SYS_IS_MAC_MPW  -d SYS_HAS_TOOL  -d SYS_HAS_STRING_PROTO
#COPTIONS =  -m          -sym on  -opt full  -w
#LOPTIONS =              -sym on             -w  -t MPST  -C 'MPS '
#LIBFILES =  "{CLibraries}"StdClib.o "{Libraries}"Stubs.o    
#            "{Libraries}"Runtime.o "{Libraries}"Interface.o 
#            "{Libraries}"ToolLibs.o
#SEGMENTS =  -sg Main=gap,gasman,system -sn read=scanner -sn idents=eval
#REZCMD   =
#.c.o         .c
#	{CPP}            {default}.c >  {default}.i
#	{CC}  {COPTIONS} {default}.i -o {default}.c.o -s {default}
#	Delete {default}.i
#system.c.o   system.c
#	{CPP} {DEFINES}  system.c    >  system.i
#	{CC}  {COPTIONS} system.i    -o system.c.o    -s system
#	Delete system.i


#############################################################################
##
#T  Dependencies  . . . . . . . . .  dependencies between the packages of GAP
##
##  Following are the dependencies between the various packages of GAP.  Note
##  that the dependencies '<package>.o: <package>.c' are  not  given,  'make'
##  adds them automagically.
##
INCBASC  =  system.h gasman.h scanner.h idents.h eval.h integer.h
INCFLDS  =  rational.h cyclotom.h unknown.h finfield.h polynom.h
INCGRPS  =  permutat.h word.h costab.h tietze.h agcollec.h aggroup.h pcpresen.h
INCLIST  =  list.h plist.h set.h vector.h vecffe.h range.h blister.h string.h
INCLANG  =  record.h statemen.h function.h coding.h

gap.c.o                  {INCBASC} list.h plist.h string.h read.h {INCLANG}
system.c.o    system.h
gasman.c.o    gasman.h   system.h
scanner.c.o   scanner.h  system.h
idents.c.o    idents.h   system.h gasman.h
read.c.o      read.h     {INCBASC}
eval.c.o      eval.h     {INCBASC} {INCFLDS} {INCGRPS} {INCLIST} {INCLANG} 
integer.c.o   integer.h  {INCBASC}
rational.c.o  rational.h {INCBASC}
cyclotom.c.o  cyclotom.h {INCBASC} list.h
unknown.c.o   unknown.h  {INCBASC}
finfield.c.o  finfield.h {INCBASC}
polynom.c.o   polynom.h  {INCBASC} list.h plist.h vector.h vecffe.h finfield.h
permutat.c.o  permutat.h {INCBASC} list.h
word.c.o      word.h     {INCBASC} list.h agcollec.h
costab.c.o    costab.h   {INCBASC} list.h
tietze.c.o    tietze.h   {INCBASC} list.h word.h agcollec.h
agcollec.c.o  agcollec.h {INCBASC} list.h word.h aggroup.h
aggroup.c.o   aggroup.h  {INCBASC} list.h plist.h word.h agcollec.h finfield.h
pcpresen.c.o  pcpresen.h {INCBASC} list.h plist.h word.h agcollec.h aggroup.h
list.c.o      list.h     {INCBASC} set.h permutat.h record.h
plist.c.o     plist.h    {INCBASC} list.h range.h record.h
set.c.o       set.h      {INCBASC} list.h plist.h range.h
vector.c.o    vector.h   {INCBASC} list.h plist.h range.h
vecffe.c.o    vecffe.h   {INCBASC} list.h plist.h range.h
range.c.o     range.h    {INCBASC} list.h plist.h
blister.c.o   blister.h  {INCBASC} list.h plist.h range.h set.h
string.c.o    string.h   {INCBASC} list.h plist.h range.h
record.c.o    record.h   {INCBASC} plist.h string.h
statemen.c.o  statemen.h {INCBASC} list.h
function.c.o  function.h {INCBASC} plist.h record.h statemen.h
coding.c.o    coding.h   {INCBASC} list.h plist.h blister.h finfield.h vecffe.h


#############################################################################
##
#T  Linkage . . . . . . . . . . . . . . . . . . . . . .  commands to link GAP
##
OBJBASC  =  gap.c.o system.c.o gasman.c.o scanner.c.o idents.c.o read.c.o eval.c.o
OBJFLDS  =  integer.c.o rational.c.o cyclotom.c.o unknown.c.o finfield.c.o polynom.c.o
OBJGRPS  =  permutat.c.o word.c.o costab.c.o tietze.c.o agcollec.c.o aggroup.c.o pcpresen.c.o
OBJLIST  =  list.c.o plist.c.o set.c.o vector.c.o vecffe.c.o range.c.o blister.c.o string.c.o
OBJLANG  =  record.c.o statemen.c.o function.c.o coding.c.o
OBJECTS  =  {OBJBASC} {OBJFLDS} {OBJGRPS} {OBJLIST} {OBJLANG}

{PROGRAM}    {OBJECTS} SIOW_NoMAZ.o "{RIncludes}"SIOW.r GAP.make
	Link {LOPTIONS} {SEGMENTS} -o {PROGRAM} {OBJECTS} {LIBFILES}
	{REZCMD}


#############################################################################
##
#T  SIOW_NoMAZ.o  . . . . . . . . . . .  commands to fix the SIOW object file
##
SIOW_NoMAZ.o "{Libraries}"SIOW.o fix_siow GAP.make
	fix_siow "{Libraries}"SIOW.o SIOW_NoMAZ.o

fix_siow     fix_siow.c.o GAP.make
	Link -model far -d -t MPST -c 'MPS ' -o fix_siow     
	    fix_siow.c.o                                     
	    "{CLibraries}"StdClib.o "{Libraries}"Stubs.o     
	    "{Libraries}"Runtime.o "{Libraries}"Interface.o

fix_siow.c.o  fix_siow.c GAP.make
	C -r -model far fix_siow.c




