#
# Makefile for FreeType2 link library using Amiga SAS/C 6.58
#
# to build from the builds/amiga directory call
#
#  smake assign
#  smake
#
# Your programs source code should start with this
# (uncomment the parts you do not need to keep the program small):
# ---8<---
#define FT_USE_AUTOHINT // autohinter
#define FT_USE_RASTER   // monochrome rasterizer
#define FT_USE_SMOOTH   // anti-aliasing rasterizer
#define FT_USE_TT       // truetype font driver
#define FT_USE_T1       // type1 font driver
#define FT_USE_T42      // type42 font driver
#define FT_USE_T1CID    // cid-keyed type1 font driver
#define FT_USE_CFF      // opentype font driver
#define FT_USE_BDF      // bdf bitmap font driver
#define FT_USE_PCF      // pcf bitmap font driver
#define FT_USE_PFR      // pfr font driver
#define FT_USE_WINFNT   // windows .fnt|.fon bitmap font driver
#include "FT:src/base/ftinit.c"
# ---8<---
#
# link your programs with ft2_680x0.lib and either ftsystem.o or ftsystempure.o
# (and either ftdebug.o or ftdebugpure.o if you enabled FT_DEBUG_LEVEL_ERROR or
# FT_DEBUG_LEVEL_TRACE in include/freetype/config/ftoption.h).

OBJBASE = ftbase.o ftglyph.o ftbbox.o ftmm.o ftsynth.o

OBJSYSTEM = ftsystem.o ftsystempure.o

OBJDEBUG = ftdebug.o ftdebugpure.o

OBJAHINT = autohint.o ahoptim.o

OBJPSHINT = pshinter.o

OBJPSAUX = psaux.o

OBJPSNAM = psnames.o

OBJRAST = raster.o

OBJSMOOTH = smooth.o

OBJSFNT = sfnt.o

OBJCACHE = ftcache.o

OBJPS = $(OBJPSAUX) $(OBJPSNAM) $(OBJPSHINT)

OBJRASTER = $(OBJRAST) $(OBJSMOOTH)

OBJFONTD = cff.o type1.o type42.o type1cid.o\
	   truetype.o winfnt.o bdf.o pcf.o pfr.o

CORE = FT:src/

CPU       = 68000
#CPU      = 68020
#CPU      = 68030
#CPU      = 68040
#CPU      = 68060

OPTIMIZER = optinlocal

SCFLAGS = optimize opttime optsched strmerge strsect=near idlen=40 cpu=$(CPU)\
	  idir=include/ idir=$(CORE) idir=FT:include/ nostackcheck nochkabort\
	  noicons ignore=79,85,110,306 parameters=both

LIB  = ft2_$(CPU).lib

# sample linker options
OPTS = link lib=$(LIB),lib:sc.lib,lib:amiga.lib,lib:debug.lib\
       smallcode smalldata noicons utillib

# sample program entry
#myprog: myprog.c ftsystem.o $(LIB)
#	sc $< programname=$@ ftsystem.o $(SCFLAGS) $(OPTS)

all:	$(LIB) $(OBJSYSTEM) $(OBJDEBUG)

assign:
	assign FT: //

# uses separate object modules in lib to make for easier debugging
# also, can make smaller programs if entire engine is not used
ft2_$(CPU).lib:  $(OBJBASE) $(OBJAHINT) $(OBJPS) $(OBJRASTER) $(OBJSFNT) $(OBJCACHE) $(OBJFONTD)
	oml $@ r $(OBJBASE) $(OBJAHINT) $(OBJPS) $(OBJRASTER) $(OBJSFNT) $(OBJCACHE) $(OBJFONTD)

clean:
	-delete \#?.o

realclean: clean
	-delete ft2$(CPU).lib

#
# freetype library base
#
ftbase.o: $(CORE)base/ftbase.c
	sc $(SCFLAGS) objname=$@ $<
ftinit.o: $(CORE)base/ftinit.c
	sc $(SCFLAGS) objname=$@ $<
ftsystem.o: $(CORE)base/ftsystem.c
	sc $(SCFLAGS) objname=$@ $<
ftsystempure.o: src/base/ftsystem.c	## pure version for use in run-time library etc
	sc $(SCFLAGS) objname=$@ $<
ftdebug.o: $(CORE)base/ftdebug.c
	sc $(SCFLAGS) objname=$@ $<
ftdebugpure.o: src/base/ftdebug.c	## pure version for use in run-time library etc
	sc $(SCFLAGS) objname=$@ $<
#
# freetype library base extensions
#
ftglyph.o: $(CORE)base/ftglyph.c
	sc $(SCFLAGS) objname=$@ $<
ftbbox.o: $(CORE)base/ftbbox.c
	sc $(SCFLAGS) objname=$@ $<
ftmm.o: $(CORE)base/ftmm.c
	sc $(SCFLAGS) objname=$@ $<
ftsynth.o: $(CORE)base/ftsynth.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library autohinting module
#
autohint.o: $(CORE)autohint/autohint.c
	sc $(SCFLAGS) objname=$@ $<
#
# freetype library autohinting module extensions
#
ahoptim.o: $(CORE)autohint/ahoptim.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library PS hinting module
#
pshinter.o: $(CORE)pshinter/pshinter.c
	sc $(SCFLAGS) objname=$@ $<
#
# freetype library PS support module
#
psaux.o: $(CORE)psaux/psaux.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library PS glyph names module
#
psnames.o: $(CORE)psnames/psnames.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library monochrome raster module
#
raster.o: $(CORE)raster/raster.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library anti-aliasing raster module
#
smooth.o: $(CORE)smooth/smooth.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library 'sfnt' module
#
sfnt.o: $(CORE)sfnt/sfnt.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library glyph and image caching system (still experimental)
#
ftcache.o: $(CORE)cache/ftcache.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library OpenType font driver
#
cff.o: $(CORE)cff/cff.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library TrueType font driver
#
truetype.o: $(CORE)truetype/truetype.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library Type1 font driver
#
type1.o: $(CORE)type1/type1.c
	sc $(SCFLAGS) objname=$@ $<

#
# FreeType2 library Type42 font driver
#
type42.o: $(CORE)type42/type42.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library CID-keyed Type1 font driver
#
type1cid.o: $(CORE)cid/type1cid.c
	sc $(SCFLAGS) objname=$@ $<
#
# freetype library CID-keyed Type1 font driver extensions
#
#cidafm.o: $(CORE)cid/cidafm.c
#	sc $(SCFLAGS) objname=$@ $<

#
# freetype library BDF bitmap font driver
#
bdf.o: $(CORE)bdf/bdf.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library PCF bitmap font driver
#
pcf.o: $(CORE)pcf/pcf.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library PFR font driver
#
pfr.o: $(CORE)pfr/pfr.c
	sc $(SCFLAGS) objname=$@ $<

#
# freetype library Windows FNT/FON bitmap font driver
#
winfnt.o: $(CORE)winfonts/winfnt.c
	sc $(SCFLAGS) objname=$@ $<
