# PostScript interpreter make file (Amiga) - Post V1.7
# This version assumes SAS/C make (smake), C (sc), asm, slink

# Debug symbols

STDFLGS = NOSTKCHK PARM=r IGNORE=62,149,154 ERROR=ALL

SCDBG  = NODEBUG OPTIMIZE # no debug,            optimise
#SCDBG  = DBEUG=s OPTIMIZE # full debugging info, optimise
#SCDBG  = DEBUG=sf         # full debugging info, flush regs

# Include debugging code

 SCDBC  =                  # no debugging code
#SCDBC  = DEFINE=FONTDEBUG # font debugging code

# Cpu type and floating point (do not mix and match!)

#SCCPU  = CPU=any          # 68000 (or 68010/020/030)
#SCFPT  = MATH=i            # SAS/C IEEE library
#LIBFPT = lib:scmieee.lib   # SAS/C IEEE library

SCCPU  = CPU=68030                  # 68020 (or 68030)
SCFPT  = math=68881 DEFINE=M68881  # 68881 (or 68882)
LIBFPT = lib:scm881.lib            # 68881 (or 68882)

LINKOPT =
#LINKOPT = ADDSYM

#

LIBOBJ = postinit.o postdata.o postchar.o postfont.o postgraph.o postshade.o postdraw.o postint.o postop1.o postop2.o postop3.o postop4.o

# Default target

all:            post postband postlj post.library

# Main program

post:           post.o postasm.o
        slink $(LINKOPT) from lib:c.o post.o postasm.o to post lib lib:sc.lib lib:amiga.lib sd

# Band printing driver

postband:       postband.o postasm.o
        slink $(LINKOPT) from lib:c.o postband.o postasm.o to postband lib lib:sc.lib smalldata

# LaserJet driver

postlj:       postlj.o postasm.o
        slink $(LINKOPT) from lib:c.o postlj.o postasm.o to postlj lib lib:sc.lib smalldata

# Shared library

post.library:   postlib.o $(LIBOBJ)
        SLINK $(LINKOPT) <with <
FROM postlib.o $(LIBOBJ)
TO post.library
LIB $(LIBFPT) lib:sc.lib
#MAP pmap hsx
SMALLDATA
<
        protect post.library rwd

# Statically linked version for debugging

poststat:       poststat.o postasm.o $(LIBOBJ)
        SLINK $(LINKOPT) <with <
FROM lib:c.o poststat.o postasm.o $(LIBOBJ)
TO poststat
LIB $(LIBFPT) lib:sc.lib lib:amiga.lib
SMALLDATA
<

# The assembler routines contain FPU instructions

postasm.o:      postasm.a
        asm -m2 -iinclude: postasm.a

# The library structure

postlib.o:      postlib.a
        asm -d -m2 -iinclude: postlib.a

# The main program is compiled without stack checking as it contains a
# subtask, standard 68000 version only.

post.o:         post.c      postlib.h
        SC $(STDFLGS) $(SCDBG) post.c

poststat.o:     post.c      postlib.h
        SC $(STDFLGS) $(SCDBG) DEFINE=STATICLINK OBJNAME=poststat.o post.c

# The band printing driver, standard 6800 version only

postband.o:     postband.c  postlib.h
        SC $(STDFLGS) $(SCDBG) postband.c


# The LaserJet driver, standard 68000 version only

postlj.o:       postlj.c    postlib.h
        SC $(STDFLGS) $(SCDBG) postlj.c


# The library is compiled without stack checking, as it uses its caller's
# stack; 68000 and 68020/68881 versions.

.c.o:
        SC $(STDFLGS) $(SCDBG) $(SCDBC) $(SCCPU) $(SCFPT) $*.c

postinit.o:     postinit.c  postlib.h post.h
postdata.o:     postdata.c  post.h
postchar.o:     postchar.c  post.h
postfont.o:     postfont.c  post.h
postgraph.o:    postgraph.c post.h
postshade.o:    postshade.c post.h
postdraw.o:     postdraw.c  post.h
postint.o:      postint.c   post.h
postop1.o:      postop1.c   post.h
postop2.o:      postop2.c   post.h
postop3.o:      postop3.c   post.h
postop4.o:      postop4.c   post.h

clean:
    -delete \#?.o \#?.lnk

