# This file is part of the FreeType project.
#
# It builds the library and test programs for amiga using SAS/C
# and smake
#
# Use this file while in the 'test/arch/amigaos' directory with
# the following statements:
#
#  smake assign
#  smake
#
# the 'assign' step creates an assignment to simplify referencing
# the core library module, as smake has quite a few limitations in
# dealing with multi-directory projects.

OBJB = ttapi.o    ttcache.o ttcalc.o  ttcmap.o   ttdebug.o \
       ttextend.o ttfile.o  ttgload.o ttinterp.o ttload.o \
       ttmemory.o ttmutex.o ttobjs.o  ttraster.o

OBJS = freetype.o

OBJX = ftxgasp.o ftxkern.o ftxpost.o ftxcmap.o ftxwidth.o ftxerr18.o \
       ftxsbit.o ftxgsub.o ftxopen.o

CORE = FT:lib/
COREXT = $(CORE)extend/
TST = FT:test/

OPTIMIZER = optimize optcomp=5 optdep=4 optinlocal optrdep=4

SCFLAGS = idlen=40 idir=$(CORE)arch/amigaos idir=$(CORE)

TSCFLAGS = $(SCFLAGS) idir=$(TST) idir=$(COREXT)

LIB=ttf.lib
TOPTS=$(TSCFLAGS) link lib=$(LIB) lib=lib:scm.lib \
      lib=lib:sc.lib lib=lib:amiga.lib

EXE = ftzoom ftlint ftview fttimer ftmetric \
      ftdump ftstring ftstrpnm ftsbit ftstrtto

TOBJ = gw_amiga.o gmain.o common.o blitter.o

all:	ttf.lib $(EXE)

assign:
	assign FT: ///

ttf.lib: $(OBJS) $(OBJX)
	oml $@ r $(OBJS) $(OBJX) 

ttfdbg.lib: $(OBJB) $(OBJX)
	oml $@ r $(OBJB) $(OBJX) 

clean:
	-delete \#?.o
	-delete //\#?.o
	-delete \#?.lib
	-delete $(EXE)


#
# freetype library core single object
#
freetype.o: $(CORE)arch/amigaos/freetype.c
	sc $(SCFLAGS) code=far $(OPTIMIZER) objname=$@ $<

#
# freetype library core as separate objects
#
ttapi.o: $(CORE)ttapi.c
	sc $(SCFLAGS) objname=$@ $<
ttcache.o: $(CORE)ttcache.c
	sc $(SCFLAGS) objname=$@ $<
ttcalc.o: $(CORE)ttcalc.c
	sc $(SCFLAGS) objname=$@ $<
ttcmap.o: $(CORE)ttcmap.c
	sc $(SCFLAGS) objname=$@ $<
ttdebug.o: $(CORE)ttdebug.c
	sc $(SCFLAGS) objname=$@ $<
ttextend.o: $(CORE)ttextend.c
	sc $(SCFLAGS) objname=$@ $<
ttfile.o: $(CORE)ttfile.c
	sc $(SCFLAGS) objname=$@ $<
ttgload.o: $(CORE)ttgload.c
	sc $(SCFLAGS) objname=$@ $<
ttinterp.o: $(CORE)ttinterp.c
	sc $(SCFLAGS) objname=$@ $<
ttload.o: $(CORE)ttload.c
	sc $(SCFLAGS) objname=$@ $<
ttmemory.o: $(CORE)ttmemory.c
	sc $(SCFLAGS) objname=$@ $<
ttmutex.o: $(CORE)ttmutex.c
	sc $(SCFLAGS) objname=$@ $<
ttobjs.o: $(CORE)ttobjs.c
	sc $(SCFLAGS) objname=$@ $<
ttraster.o: $(CORE)ttraster.c
	sc $(SCFLAGS) objname=$@ $<

#
# library extentions
#
ftxgasp.o: $(COREXT)ftxgasp.c
	sc $(SCFLAGS) objname=$@ $<
ftxkern.o: $(COREXT)ftxkern.c
	sc $(SCFLAGS) objname=$@ $<
ftxpost.o: $(COREXT)ftxpost.c
	sc $(SCFLAGS) objname=$@ $<
ftxcmap.o: $(COREXT)ftxcmap.c
	sc $(SCFLAGS) objname=$@ $<
ftxwidth.o: $(COREXT)ftxwidth.c
	sc $(SCFLAGS) objname=$@ $<
ftxerr18.o: $(COREXT)ftxerr18.c
	sc $(SCFLAGS) objname=$@ $<
ftxsbit.o: $(COREXT)ftxsbit.c
	sc $(SCFLAGS) objname=$@ $<
ftxgsub.o: $(COREXT)ftxgsub.c
	sc $(SCFLAGS) objname=$@ $<
ftxopen.o: $(COREXT)ftxopen.c
	sc $(SCFLAGS) objname=$@ $<

#
# Test programs
#
ftzoom: $(TST)ftzoom.c $(TOBJ) $(LIB)
	sc $(TST)ftzoom.c programname=$@ $(TOBJ) $(TOPTS)

ftlint: $(TST)ftlint.c common.o $(LIB)
	sc $(TST)ftlint.c programname=$@ common.o $(TOPTS)

ftdump: $(TST)ftdump.c common.o $(LIB)
	sc $(TST)ftdump.c programname=$@ common.o $(TOPTS)

# use unsigned char so full latin1 encoding may be used in string argument
ftstring: $(TST)ftstring.c $(TOBJ) display.o $(LIB)
	sc $(TST)ftstring.c uchar programname=$@ $(TOBJ) display.o $(TOPTS)

ftview: $(TST)ftview.c $(TOBJ) display.o $(LIB)
	sc $(TST)ftview.c programname=$@ $(TOBJ) display.o $(TOPTS)

fttimer: $(TST)fttimer.c $(TOBJ) $(LIB)
	sc $(TST)fttimer.c programname=$@ $(TOBJ) $(TOPTS)

ftstrpnm: $(TST)ftstrpnm.c common.o $(LIB)
	sc $(TST)ftstrpnm.c uchar programname=$@ common.o $(TOPTS)

ftsbit: $(TST)ftsbit.c common.o $(LIB)
	sc $(TST)ftsbit.c programname=$@ common.o $(TOPTS)

ftmetric: $(TST)ftmetric.c common.o $(LIB)
	sc $(TST)ftmetric.c programname=$@ common.o $(TOPTS)

# use unsigned char so full latin1/UTF8 encoding may be used in argument
ftstrtto: $(TST)ftstrtto.c $(TOBJ) display.o arabic.o $(LIB)
	sc $(TST)ftstrtto.c uchar programname=$@ $(TOBJ) \
           arabic.o display.o $(TOPTS)

#
# Test program support modules
#

gw_amiga.o: gw_amiga.c 
	sc gw_amiga.c $(TSCFLAGS)

common.o: $(TST)common.c
	sc $(TSCFLAGS) objname=$@ $<

blitter.o: $(TST)blitter.c
	sc $(TSCFLAGS) objname=$@ $<

display.o: $(TST)display.c
	sc $(TSCFLAGS) objname=$@ $<

gmain.o: $(TST)gmain.c
	sc $(TSCFLAGS) objname=$@ $<

arabic.o: $(TST)arabic.c
	sc $(TSCFLAGS) objname=$@ $<

# end of smakefile
