#===========================================================================
# Makefile for Zip, ZipNote, ZipCloak, ZipSplit     AMIGA SAS/C Version 6.58
# Version:  2.3                                     last revised:  24 Aug 98
#===========================================================================
# -John Bush, <John.Bush@East.Sun.COM>
#         or: <JBush@Bix.COM>

# updated for SAS/C Version 6.56+ and AmigaDOS 3.1 (V40)
# by Haidinger Walter, <walthaid@unix.ict.tuwien.ac.at>

# additional supplements and maintenance by Paul Kienitz

# This makefile should work with at least AmigaDOS 2.04 (V37)  (not tested)
# and will probably not work with AmigaDOS 1.3 (V34)

# If you have any improvements, critics or else please feel free to mail.
# Any response is appreciated. Haidinger Walter <walthaid@unix.ict.tuwien.ac.at>

# Available targets:
# all           builds all executeables below
# zip           builds zip executeable
# zipsplit      builds zipsplit executeable
# zipcloak      builds zipcloak executeable
# zipnote       builds zipnote executeable
# ziplm         builds low memory version of zip executable
# clean         remove all files created by the compilation
# spotless      like clean target but removes binaries too


##########################
# USER MACRO DEFINITIONS #
##########################

# *** NOTE ***
# The assembly version is not implemented yet.
# (Un)commenting the assembler macros has no effect unless the
# file dependencies are changed too.
# Most of the amiga/*.a files do not assmble with 68000 instructions.
# Any help is appreciated, of course.

# Set the processor to generate code for.
# Compiler:    ANY 68000 68010 68020 68030 68040 68060
# Assembler:     0     0     1     2     3     4   n/a
# Defaults: ANY and 0
#
CUSECPU = ANY
AUSECPU = 0

# UNCOMMENT to use 68020 instructions in the assembly version of deflate.o
# Only use if code is generated for 68020 or higher processors above.
# Note: You could use CPUTEST too to enable runtime cpu detection.
# However, it is not recommended since both 68000 and 68020 code will be
# included which would be an unnecessary increase in size.
# (see amiga/deflate.a for more information)
#
#AUSE020 = CPU020

# To disable the assembler replacements and use the standard C source,
# you have to change the Zip and ZipLM dependencies. See below for details.
# (remember that assembler use is *not* implemented yet)

# Uncomment both CUTIL and LUTIL to make use of utility.library of OS 2.04+
# The utility.library is *not* used for UnZipSFX to ensure maximum portability
# between the different Amiga systems (minimal config: 68000 and OS 1.2).
# You can change this by adding the $(LUTIL) macro in the UnZipSFX linking
# rules (See below: Final output targets, UnZipSFX:).
# WARNINGS when using the utility library:
# 1. All Executables will *only* work with AmigaDOS 2.04 (v37) or higher.
# 2. You *need not* compile/link with short-integers using the
#    utility.library. It will crash your machine. See Libraries below.
#
# Default: commented (not used)
#
#CUTIL = UTILLIB DEFINE=_UTILLIB
#LUTIL = WITH SC:LIB/utillib.with    # include necessary linker defines
# Choose one stack-handling method (default=faster)
# StackExtend: Dynamic runtime stack extension. You won't notice stack overflows.
# StackCheck: On a stack overflow a requester appears which allows you to exit.
# Note that either stack watching will slow down your executable because of the
# extra code run on each function entry. On the other hand, you won't crash
# anymore due to stack overflows. However, you should not have *any* stack
# problems with Info-ZIP programs if you raise your stack to 10000 (which I'd
# recommend as a minimum default stack for all applications) or more using the
# shell stack command. Type 'Stack 20000' or add it to your S:Shell-Startup.
# BTW: Typing 'Stack' prints your current stack size.
#
CSTACK = NOSTACKCHECK STACKEXTEND     # slow, but always works
#CSTACK = STACKCHECK NOSTACKEXTEND    # slow, requester & graceful exit
#CSTACK = NOSTACKCHECK NOSTACKEXTEND  # faster but relies on larger stack (>=10K)


#
# LIBRARIES
# ---------

# Choose one DATAOPTS , SASLIB , ASMOPTS and LSTARTUP
# Always comment/uncomment all macros of a set.

# Library to use with near data and 2-byte integers
# Notes: o  slower than 4-byte integers with 68000 cpu
#        o  *not* recommended due to poor overall performance
#        o  see comment in amiga/osdep.h
#DATAOPTS = DATA=NEAR SHORTINTEGERS DEF=_NEAR_DATA
#SASLIB   = scs
#ASMOPTS  = -dINT16
#LSTARTUP = cres.o

# Library to use with near data and 4-byte integers (DEFAULT)
# *** use this with the utility.library ***
DATAOPTS = DATA=NEAR DEF=_NEAR_DATA
SASLIB   = sc
ASMOPTS  =
LSTARTUP = cres.o

# Library to use with far data and 2-byte integers
# use if DYN_ALLOC is not defined
# old default - far data always works but is slower
#DATAOPTS = DATA=FAR SHORTINTEGERS DEF=_FAR_DATA
#SASLIB   = scsnb
#ASMOPTS  = -dINT16
#LSTARTUP = c.o

# Library to use with far data and 4-byte integers
# if everything else fails: try this
#DATAOPTS = DATA=FAR DEF=_FAR_DATA
#SASLIB   = scnb
#ASMOPTS  =
#LSTARTUP = c.o


#
# DEBUGGING
# ---------

# Default: No debugging information added.
# The three macros below will be overwritten if you choose to add
# debug info, therefore no need to comment.

CDBG = NODEBUG NOPROFILE NOCOVERAGE    # default: no debug info
ADBG =
LDBG = STRIPDEBUG                      # default: no debug info

# Compiler and loader debug flags.  Uncomment as needed.  Recomment when done.
# Optimization disabled for faster compilation (by using NOOPT)

#CDBG1 = DEF=DEBUG DEF=DEBUG_TIME     # enables Info-Zip's debug output

# Enable profiling and coverage when desired. Option COVERAGE commented
# seperately because running coverage may corrupt your drive in case of a
# system crash since a file 'cover.dat' is created in your working directory.
# Note that the use of COVERAGE forces the use of the c.o startup module.

#CDBG2 = PROFILE
#CDBG3 = COVERAGE        # must use c.o startup code:
#LSTARTUP = c.o          # Uncomment *only* when you use COVERAGE

# *Uncomment* here macros CDBG, ADBG and LDBG to include debugging information

#CDBG = $(CDBG1) $(CDBG2) $(CDBG3) ADDSYM DEBUG=FULLFLUSH STACKCHECK NOOPT
#ADBG = DEBUG
#LDBG = ADDSYM

# Optional use of memwatch.library which can be found in your
# sc:extras/memlib directory. Please read the short docs (memlib.doc).
# Note that memwatch.library has a small bug: MWTerm() displays always
# the first entry.
# Get the latest version from aminet (dev/debug/memlib.lha) or
# contact me to get the patch. Uncomment all macros to use.
#CMEMLIB  = DEFINE=MWDEBUG=1       # define to enable library
#LMEMLIB  = SC:LIB/memwatch.lib       # path to library
#LSTARTUP = c.o                    # must use c.o with memlib!


#
# MAPPING
# -------

# Map filenames used when mapping (no need to comment)
#
MAPFZ = zip.map                # Zip      map filename
MAPFN = zipnote.map            # ZipNote  map filename
MAPFC = zipcloak.map           # ZipCloak map filename
MAPFS = zipsplit.map           # ZipSplit map filename
MAPFL = ziplm.map              # Zip low memory version map filename

# Map file output: Uncomment to highlight and bold headings.
#
#MAPFSTYLE = FANCY

# Map flags for each EXECUTABLE. Uncomment to enable mapping.
# For map options please refer to:
# SAS/C v6 manual, volume 1: user's guide, chapter 8, page 136: map
# Default: all options enabled: f,h,l,o,s,x
#                                 |-> options start here
#LMAPZ = $(MAPFSTYLE) MAP $(MAPFZ) f,h,l,o,s,x   # Zip      maps
#LMAPN = $(MAPFSTYLE) MAP $(MAPFN) f,h,l,o,s,x   # ZipNote  maps
#LMAPC = $(MAPFSTYLE) MAP $(MAPFC) f,h,l,o,s,x   # ZipCloak maps
#LMAPS = $(MAPFSTYLE) MAP $(MAPFS) f,h,l,o,s,x   # ZipSplit maps
#LMAPL = $(MAPFSTYLE) MAP $(MAPFL) f,h,l,o,s,x   # Zip lowmem maps

#
# LISTINGS
# --------

# Listfile-extensions for each executable (enter *with* dot)
#
LISTEXTZ = .lst   # extension for Zip listfiles
LISTEXTU = .ulst  # extension for utility listfiles (ZipNote,ZipCloak,ZipSplit)
LISTEXTL = .llst  # extension for Zip low memory listfiles


# List files and cross references for each OBJECT.
# Add/remove flags as needed. Not all listed by default.
# Use LISTINCLUDES to determine the dependencies for smake
#
CLISTOPT = LISTHEADERS LISTMACROS # LISTSYSTEM LISTINCLUDES
CXREFOPT = XHEAD XSYS
#
# Uncomment to enable listing (default: commented)
# *** WARNING: List files require *lots* of disk space!
#
#CLIST = LIST $(CLISTOPT)
#CXREF = XREF $(CXREFOPT)


#
# SUPPRESSED COMPILER WARNINGS
# ----------------------------

# Compiler warnings to ignore
#
# Warning 105 : module does not define any externally-known symbols
# Warning 304 : Dead assignment eliminated...
# Note    306 : ...function inlined...
# Warning 317 : possibly uninitialized variable...
# Comment to enable.
#
CIGNORE = IGNORE=105,304,306,317


#
# OBJECT EXTENSIONS
#

# Extensions used for objects of each executeable.
# Transformation rules require unique extensions.
# Enter *with* dot.
#
O  = .o     # extension for Zip     objects
OU = .uo    # extension for utility objects (ZipNote, ZipSplit and ZipCloak)
OL = .lo    # extension for low memory Zip objects


# Filename used to store converted options from environment variable
# LOCAL_ZIP. Default: scoptions_local_zip
#
CWITHOPT = scoptions_local_zip


# Filenames to store compiler options to prevent command line overflow
#
# Common options file for Zip and other executables
CFILE = scoptions-zip


# Temp filenames for object lists to load using linker "WITH" command.
OBJLISTZ = zip_objlist.with            # Zip      object list
OBJLISTN = zipnote_objlist.with        # ZipNote  object list
OBJLISTC = zipcloak_objlist.with       # ZipCloak object list
OBJLISTS = zipsplit_objlist.with       # ZipSplit object list
OBJLISTL = ziplm_objlist.with          # Zip low-mem object list


# Filenames to store linker options
#
LWITHZ = zip.lnk                       # zip      linker options
LWITHN = zipnote.lnk                   # zipnote  linker options
LWITHC = zipcloak.lnk                  # zipcloak linker options
LWITHS = zipsplit.lnk                  # zipsplit linker options
LWITHL = ziplm.lnk                     # zip low-mem linker options


# Define AMIGA_BETA to print "Beta Notice" up front.  See tailor.h.
# Undefine AMIGA_BETA when building a released version.
#CDEFBETA = DEF=AMIGA_BETA

#####################################
# NOTHING TO CHANGE BEYOND HERE ... #
#####################################
# (except for C/asm dependencies)

# Define MEDIUM_MEM for production release (per Paul Kienitz).
# This reduces runtime memory requirement but not speed or compression.
# Note: Do *not* use BIG_MEM or MMAP since it isn't yet supported by the
        assembler version of deflate.c : amiga/deflate.a
CUSEMEM = DEF=MEDIUM_MEM
AUSEMEM = -DMEDIUM_MEM       # for asm deflate.o, must match above


# Defines for building low-memory use version of Zip
WSIZEL   = WSIZE=4096     # deflate.c window size for low-mem version
CLOWMEM = DEF=SMALL_MEM DEF=$(WSIZEL)
ALOWMEM = -DSMALL_MEM   -D$(WSIZEL)  # for asm deflate.o, must match above


# Compiler definitions
#
CC = sc
#
# Optimizer flags
#
OPTPASSES = 6     # set number of global optimizer passes
#
OPT1 = OPT OPTINL OPTINLOCAL OPTTIME OPTLOOP OPTSCHED
OPT2 = OPTCOMP=$(OPTPASSES) OPTDEP=$(OPTPASSES) OPTRDEP=$(OPTPASSES)
OPT  = $(OPT1) $(OPT2)


# Compiler flags
#
CDEFINES = $(CMEMLIB) $(CDEFBETA) DEF=AMIGA
COPTIONS = $(DATAOPTS) CODE=NEAR CPU=$(CUSECPU) VERBOSE PARAMETERS=BOTH NOMINC
COPTIONS = $(COPTIONS) ERRORREXX NOERRORCONSOLE MEMSIZE=HUGE $(CLIST) $(CXREF)
COPTIONS = $(COPTIONS) $(CSTACK) $(CUTIL) STRICT UNSCHAR NOICONS STRINGMERGE
CFLAGS = $(CDEFINES) $(COPTIONS) $(OPT) $(CDBG) $(CIGNORE)


# Linker definitions
#  See SASLIB definition above
#
LD = slink
# special linker flags for pure (i.e. resident) binary.
LDFLAGSS = FROM SC:LIB/$(LSTARTUP)
# common linker flags for all other executeables
LDFLAGSC = FROM SC:LIB/c.o
LDFLAGS2 = NOICONS $(LDBG)
LIBFLAGS = LIB $(LMEMLIB) SC:LIB/$(SASLIB).lib SC:LIB/amiga.lib


# Assembler definitions
#
ASM = asm
#
# Options used for assembling amiga/deflate.a
# Must match defines in C-Source.
#
AFLAGS0  = -d__SASC -dSASC -dAMIGA
AFLAGS1  = $(AUSE020) $(ASMOPTS) $(ADBG)
AFLAGS2  = -m$(AUSECPU) -jm -iINCLUDE:
AFLAGS   = $(AFLAGS0) $(AFLAGS1) $(AFLAGS2)
ASMOPTSZ = $(AFLAGS) $(AUSEMEM) -dDYN_ALLOC     # Zip asm flags
ASMOPTSL = $(AFLAGS) $(ALOWMEM)                 # Zip low-mem version asm flags


##################
# TARGET OBJECTS #
##################


# Zip objects
OBJZ1 = zip$(O) zipfile$(O) zipup$(O) fileio$(O) util$(O) globals$(O)
OBJZ2 = crc32$(O) crctab$(O) crypt$(O) ttyio$(O)
OBJZI = deflate$(O) trees$(O)
OBJZA = amiga$(O) amigazip$(O) time_lib$(O) stat$(O) filedate$(O)
OBJZ  = $(OBJZ1) $(OBJZ2) $(OBJZI) $(OBJZA)

# Shared utility objects for ZipNote, ZipCloak and ZipSplit
OBJU1 = globals$(O)
OBJUU = zipfile$(OU) fileio$(OU) util$(OU)
OBJUA = amigazip$(OU) amiga$(O) time_lib$(O) stat$(O) filedate$(O)
OBJU  = $(OBJU1) $(OBJUU) $(OBJUA)

# ZipNote objects
OBJN1 = zipnote$(O)
OBJN  = $(OBJN1) $(OBJU)

# ZipCloak objects
OBJC1 = zipcloak$(O)
OBJCU = $(OBJU) crypt$(OU)
OBJCS = crctab$(O) ttyio$(O)
OBJC  = $(OBJC1) $(OBJCU) $(OBJCS)

#ZipSplit objects
OBJS1 = zipsplit$(O)
OBJS  = $(OBJS1) $(OBJU)

# ZipLM objects
OBJL1 = zip$(OL) zipfile$(OL) zipup$(OL) fileio$(OL) util$(OL) globals$(OL)
OBJL2 = crc32$(OL) crctab$(OL) crypt$(OL) ttyio$(OL)
OBJLI = deflate$(OL) trees$(OL)
OBJLA = amiga$(OL) amigazip$(OL) time_lib$(O) stat$(O) filedate$(O)
OBJL  = $(OBJL1) $(OBJL2) $(OBJLI) $(OBJLA)

# Common header files
ZIP_H1 = zip.h ziperr.h tailor.h
ZIP_HA = amiga/osdep.h amiga/z-stat.h amiga/z-time.h
ZIP_H  = $(ZIP_H1) $(ZIP_HA)

# Output targets
ZIPS  = Zip ZipNote ZipCloak ZipSplit ZipLM


# Temp filenames for object lists to load using linker "WITH" command.
OBJLISTZ = zip_objlist.with            # Zip      object list
OBJLISTN = zipnote_objlist.with        # ZipNote  object list
OBJLISTC = zipcloak_objlist.with       # ZipCloak object list
OBJLISTS = zipsplit_objlist.with       # ZipSplit object list
OBJLISTL = ziplm_objlist.with          # Zip low-mem object list

#######################################
# DEFAULT TARGET AND PROCESSING RULES #
#######################################

all: request flush $(ZIPS)

# Zip transformation rules
#
.c$(O):
      $(CC) WITH=$(CFILE) $(CUSEMEM) LISTFILE=$>$(LISTEXTZ) OBJNAME=$@ $*.c

# Zip low-memory version transformation rules
#
.c$(OL):
      $(CC) WITH=$(CFILE) $(CLOWMEM) LISTFILE=$>$(LISTEXTL) OBJNAME=$@ $*.c

# Utilities (ZipNote, ZipCloak and ZipSplit) transformation rules
#
.c$(OU):
      $(CC) WITH=$(CFILE) $(CUSEMEM) DEF=UTIL LISTFILE=$>$(LISTEXTU) OBJNAME=$@ $*.c


########################
# Special target rules #
########################

# Special rule to build time_lib.o for Zip (requires NO_MKTIME define)
time_lib$(O):
      $(CC) WITH=$(CFILE) $(CUSEMEM) DEF=ZIP LISTFILE=$>$(LISTEXTZ) OBJNAME=$@ $*.c

#########################
# Final output targets. #
#########################


zip:      local_zip CommonFlags $(OBJZ)
          @Echo "$(OBJZ)" > $(OBJLISTZ)
          Type $(OBJLISTZ)
          @Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTZ) $(LIBFLAGS)" \
                "$(LDFLAGS2) $(LMAPZ)" >$(LWITHZ)
          Type $(LWITHZ)
          $(LD) TO Zip      WITH $(LWITHZ)

zipnote:  local_zip CommonFlags $(OBJN)
          @Echo "$(OBJN)" > $(OBJLISTN)
          Type $(OBJLISTN)
          @Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTN) $(LIBFLAGS) " \
                "$(LDFLAGS2) $(LMAPN)" >$(LWITHN)
          Type $(LWITHN)
          $(LD) TO ZipNote  WITH $(LWITHN)

zipcloak: local_zip CommonFlags $(OBJC)
          @Echo "$(OBJC)" > $(OBJLISTC)
          Type $(OBJLISTC)
          @Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTC) $(LIBFLAGS) " \
                "$(LDFLAGS2) $(LMAPC)" >$(LWITHC)
          Type $(LWITHC)
          $(LD) TO ZipCloak WITH $(LWITHC)

zipsplit: local_zip CommonFlags $(OBJS)
          @Echo "$(OBJS)" > $(OBJLISTS)
          Type $(OBJLISTS)
          @Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTS) $(LIBFLAGS) " \
                "$(LDFLAGS2) $(LMAPS)" >$(LWITHS)
          Type $(LWITHS)
          $(LD) TO ZipSplit WITH $(LWITHS)

ziplm:    local_zip CommonFlags $(OBJL)
          @Echo "$(OBJL)" > $(OBJLISTL)
          Type $(OBJLISTL)
          @Echo "$(LDFLAGSS) $(LUTIL) WITH $(OBJLISTL) $(LIBFLAGS) " \
                "$(LDFLAGS2) $(LMAPL)" >$(LWITHL)
          Type $(LWITHL)
          $(LD) TO ZipLM    WITH $(LWITHL)


clean:
        -Delete >nil: $(OBJZ) quiet
        -Delete >nil: $(OBJN) quiet
        -Delete >nil: $(OBJC) quiet
        -Delete >nil: $(OBJS) quiet
        -Delete >nil: $(OBJL) quiet
        -Delete >nil: $(OBJLISTZ) $(OBJLISTL) $(OBJLISTN) $(OBJLISTS) $(OBJLISTC) quiet
        -Delete >nil: $(MAPFZ) $(MAPFN) $(MAPFC) $(MAPFS) $(MAPFL) quiet
        -Delete >nil: \#?$(LISTEXTZ) \#?$(LISTEXTU) \#?$(LISTEXTL) quiet
        -Delete >nil: $(CWITHOPT) $(CFILE) quiet
        -Delete >nil: $(LWITHZ) $(LWITHN) $(LWITHC) $(LWITHS) $(LWITHL) quiet
        -Delete >nil: env:VersionDate quiet
        -Delete >nil: \#?.q.?? \#?.tmp \#?.cov quiet

spotless: clean
        -Delete >nil: $(ZIPS) quiet


################
# DEPENDENCIES #
################

# To change between the assembler and C sources, you have to comment/uncomment
# the approprite lines. C sources are marked by #C-src and assembler sources
# #asm-src at the end.
# Zip dependencies:
#

zip$(O):        zip.c      $(ZIP_H) revision.h crypt.h ttyio.h
zipup$(O):      zipup.c    $(ZIP_H) revision.h crypt.h amiga/zipup.h
zipfile$(O):    zipfile.c  $(ZIP_H) revision.h
crypt$(O):      crypt.c    $(ZIP_H) crypt.h ttyio.h
ttyio$(O):      ttyio.c    $(ZIP_H) crypt.h ttyio.h
deflate$(O):    deflate.c  $(ZIP_H)                          #C-src
trees$(O):      trees.c    $(ZIP_H)
fileio$(O):     fileio.c   $(ZIP_H)
util$(O):       util.c     $(ZIP_H) mktime.c
crc32$(O):      crc32.c    $(ZIP_H)
crctab$(O):     crctab.c   $(ZIP_H)
globals$(O):    globals.c  $(ZIP_H)
# Amiga specific objects
stat$(O):       amiga/stat.c     amiga/z-stat.h amiga/z-time.h
filedate$(O):   amiga/filedate.c amiga/z-time.h crypt.h
time_lib$(O):   amiga/time_lib.c amiga/z-time.h
amiga$(O):      amiga/amiga.c    ziperr.h
amigazip$(O):   amiga/amigazip.c $(ZIP_H) amiga/amiga.h env:Workbench
# Substitute assembly version of deflate.c:
#deflate$(O):  amiga/deflate.a                               #asm-src
#        $(ASM) $(ASMOPTSZ) -o$@ $*.a                        #asm-src


# Utility (ZipNote, ZipCloak, ZipSplit) dependencies:
#
zipnote$(O):    zipnote.c  $(ZIP_H) revision.h
zipcloak$(O):   zipcloak.c $(ZIP_H) revision.h crypt.h ttyio.h
zipsplit$(O):   zipsplit.c $(ZIP_H) revision.h
zipfile$(OU):   zipfile.c  $(ZIP_H) revision.h
fileio$(OU):    fileio.c   $(ZIP_H)
util$(OU):      util.c     $(ZIP_H) mktime.c
crypt$(OU):     crypt.c    $(ZIP_H) crypt.h ttyio.h
# Amiga specific objects
amigazip$(OU):   amiga/amigazip.c $(ZIP_H) amiga/amiga.h env:Workbench

# ZipLM dependencies:
#
zip$(OL):       zip.c      $(ZIP_H) revision.h crypt.h ttyio.h
zipup$(OL):     zipup.c    $(ZIP_H) revision.h crypt.h amiga/zipup.h
zipfile$(OL):   zipfile.c  $(ZIP_H) revision.h
crypt$(OL):     crypt.c    $(ZIP_H) crypt.h ttyio.h
ttyio$(OL):     ttyio.c    $(ZIP_H) crypt.h ttyio.h
deflate$(OL):   deflate.c  $(ZIP_H)
trees$(OL):     trees.c    $(ZIP_H)
fileio$(OL):    fileio.c   $(ZIP_H)
util$(OL):      util.c     $(ZIP_H) mktime.c
crc32$(OL):     crc32.c    $(ZIP_H)
crctab$(OL):    crctab.c   $(ZIP_H)
globals$(OL):   globals.c  $(ZIP_H)
# Amiga specific objects
stat$(OL):      amiga/stat.c     amiga/z-stat.h amiga/z-time.h
filedate$(OL):  amiga/filedate.c amiga/z-time.h crypt.h
time_lib$(OL):  amiga/time_lib.c amiga/z-time.h
amiga$(OL):     amiga/amiga.c    ziperr.h
# Substitute assembly version of deflate.c:
#deflate$(OL): amiga/deflate.a
#        $(ASM) $(ASMOPTSL) -o$@ $*.a


########################
# DEPENDECIES END HERE #
########################

# flush all libraries to provide more mem for compilation
flush:
        @Avail flush >nil:

# write common compiler flags to file and echo to user
CommonFlags:
        @Echo "$(CFLAGS)"    >$(CFILE)
        @Type "$(CWITHOPT)" >>$(CFILE)
        -Type $(CFILE)


# special rules for adding Amiga internal version number to amiga/amiga.c
amiga$(O):
         rx > env:VersionDate "say '""'translate(date('E'),'.','/')'""'"
         $(CC) WITH=$(CFILE) $(CUSEMEM) LISTFILE=$>$(LISTEXTZ) OBJNAME=$@ $*.c
         -Delete env:VersionDate

amiga$(OL):
         rx > env:VersionDate "say '""'translate(date('E'),'.','/')'""'"
         $(CC) WITH=$(CFILE) $(CLOWMEM) LISTFILE=$>$(LISTEXTL) OBJNAME=$@ $*.c
         -Delete env:VersionDate


# needed in amiga/amigazip.c
# should be set in startup-sequence, but just in case:
# (only works with OS 2.0 and above)

env\:WorkBench:
        @Execute < < (Workbench_smk.tmp)
           FailAt 21
           If not exists ENV:Workbench
              Version >nil:
              SetEnv Workbench $$Workbench
           Endif
        <


# Read environment variable LOCAL_ZIP and convert options to SAS format
#
# e.g.: to define FOO_ONE and FOO_TWO enter:
#
# SetEnv LOCAL_ZIP "-DFOO_ONE -DFOO_TWO"
#
# Put the statement into your startup-sequence or (for AmigaDOS 2.0 or higher
# only) make sure LOCAL_ZIP is stored in the ENVARC: directory
# ( Copy ENV:LOCAL_ZIP ENVARC: )
#

local_zip:
        @Execute < < (Local_Zip_smk.tmp)
           Failat 21
           If exists ENV:LOCAL_ZIP
              Echo "Using environment variable LOCAL_ZIP !"
              Copy >NIL: ENV:LOCAL_ZIP SASCOPTS
           Else
              Echo "You could use envvar ZIP_OPT to set your special compilation options."
              Delete >nil: SASCOPTS quiet
           Endif
           ; Do not remove the lctosc command! If LOCAL_ZIP is unset, an
           ; empty file is created which needed by CommonFlags !
           lctosc >$(CWITHOPT)
        <



# Echo request to the user
#
request:
        @Echo ""
        @Echo " This makefile is for use with SAS/C version 6.58."
        @Echo " If you still have an older version, please upgrade!"
        @Echo " Patches are available on the Aminet under biz/patch/sc\#?."
        @Echo ""
        @Echo " Just a simple request..."
        @Echo " Please give me a mail that you compiled whether you encounter any errors"
        @Echo " or not. I'd just like to know how many Amiga users actually make use of"
        @Echo " this makefile."
        @Echo " If you mail me, I'll put you on my mailing-list and notify you whenever"
        @Echo " new versions of Info-Zip are released."
        @Echo " Have a look at the makefile for changes like CPU type, UtilLib, etc."
        @Echo " Feel free to mail comments, suggestions, etc."
        @Echo " Enjoy Info-Zip !"
        @Echo " Haidinger Walter, <walthaid@unix.ict.tuwien.ac.at>"
        @Echo ""


# Echo help in case of an error
#
.ONERROR:
        @Echo ""
        @Echo "[sigh] An error running this makefile was detected."
        @Echo "This message may also appear if you interrupted smake by pressing CTRL-C."
        @Echo "Contact Info-Zip authors at Zip-Bugs@lists.wku.edu or me for help."
        @Echo "Haidinger Walter, <walthaid@unix.ict.tuwien.ac.at>"

