# Makefile for UnZip, UnZipSFX and fUnZip                     20 April 1997
#
#  supported compilers:
#  - Microsoft C, version 6.00 or higher, for use under OS/2 1.x (16-bit)
#  - Watcom C/C++, version 9.0+, for use under OS/2 1.x or 2.x+ (16/32-bit)
#  - emx+gcc, version 0.9c or higher, for use under OS/2 2.x+ (32-bit)
#  - IBM C Set++, for use under OS/2 2.x+ (32-bit)
#  - Borland C++, for use under OS/2 2.x+ (32-bit)
#  - Metaware High C/C++, for use under OS/2 2.x+ (32-bit)
#
#  supported cross-compilers:
#  - Microsoft C, version 6.0 or 7.0, for use under DOS (16-bit)
#  - Watcom C/C++, version 9.0+, for use under DOS/Win95/NT (16/32-bit)
#  - GNU gcc (emx), version 0.9c or higher, for use under DOS/Win95/NT (32-bit)
#
#  supported assemblers:
#  - Microsoft MASM 6.00 with Microsoft C
#  - Watcom WASM with Watcom C/C++
#  - GNU as with GNU gcc

# To use MASM 5.x instead of MASM 6.00:
#  - set AS="masm -t -Ml"
#  - set ASEOL=";"

# To use, enter "{d,n}make -f os2/makefile.os2" (this makefile depends on its
# name being "makefile.os2", and it must be in the os2 subdirectory).

# Notes on Microsoft C 6.00 compilation for OS/2:
#
#   The resulting programs can be used under OS/2 protected mode only, not
#   under DOS.  A larger stack has to be used for OS/2 because system calls
#   use more stack than under DOS; 8k is recommended by Microsoft.

# Notes on IBM C Set++, Watcom C/C++, Borland C++ or emx+gcc compilation:
#
#   The resulting programs can be used under protected mode of OS/2 2.x or
#   higher only, not under OS/2 1.x and not under DOS.
#
#   The NFLAGS macro is used to work around an optimization bug in the IBM
#   C++ Set compiler; this is fixed by CSD #4, so NFLAGS="" can be used for
#   all targets below.  We'll leave it as is for this release...

# Notes on Watcom C/C++ compilation for DOS with the PMODE/W extender:
#
#   You need to add the following section to your \watcom\binb\wlsystem.lnk
#   file and also need to copy pmodew.exe to the same directory:
#
#   system begin pmodew
#       option osname='PMODE/W'
#       libpath %WATCOM%\lib386
#       libpath %WATCOM%\lib386\dos
#       op stub=pmodew.exe
#       format os2 le
#   end
#
#   PMODE/W 1.16 or higher is required.  See also msdos/README for important
#   notes about PMODE/W bugs.

default:
	@echo "Enter `$(MAKE) -f os2/makefile.os2 target' from the main"
	@echo "UnZip directory, where target is one of:"
	@echo "   msc mscdos ibm ibmdyn ibmdebug ibmprof ibmdll ibmdlldyn"
	@echo "   ibmdlldebug ibmdllprof ibmdlldynvalidate ibmdlldebugvalidate"
	@echo "   metaware borland gcc gccdyn gccdebug gccdos gccwin32 watcom"
	@echo "   watcom16 watcomdos watcom16dos pmodew watcomwin32"

# MS C 6.00 for OS/2, 16-bit (should figure out way to split unzip/funzip
# compiles so former is always large model and latter always small model...)
msc:
	$(MAKE) -f os2/makefile.os2 all \
	CC="cl -nologo -AL -Ocegit -Gs -I. $(FP)" \
	CFLAGS="-G2 -Zp1 -W3 -DOS2 -DMSC -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="ml -nologo -c -Zm -Cp" \
	ASFLAGS="-D__LARGE__ -D__286" \
	LDFLAGS="-F 2000 -Lp -Fe" \
	LDFLAGS2="-link /noe" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRC32="crc_i86" \
	CRC32F="crc_i86" \
	CRC32X="crc_i86" \
	DEF="os2\unzip.def"

# MS C 6.00 for OS/2, debug version
mscdebug:
	$(MAKE) -f os2/makefile.os2 all \
	CC="cl -nologo -AL -Zi -Od -I. $(FP)" \
	CFLAGS="-G2 -Zp1 -W3 -DOS2 -DMSC -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="ml -nologo -c -Zim -Cp" \
	ASFLAGS="-D__LARGE__ -D__286" \
	LDFLAGS="-F 2000 -Lp -Fe" \
	LDFLAGS2="-link /noe" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRC32="crc_i86" \
	CRC32F="crc_i86" \
	CRC32X="crc_i86" \
	DEF="os2\unzip.def"

# cross-compilation for MS-DOS with MS C 6.00 (same comment as above...formerly;
# now unzip is medium model again, with [almost] all strings in far memory)
mscdos:
	$(MAKE) -f os2/makefile.os2 all \
	CC="cl -nologo -AM -Oaict -Gs -I. $(FP)" \
	CFLAGS="-Zp1 -W3 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="ml -nologo -c -Zm -Cp" \
	ASFLAGS="-D__MEDIUM__" \
	LDFLAGS="-F 0C00 -Lr -Fe" \
	LDFLAGS2="-link /noe /exe" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRC32="crc_i86" \
	CRC32F="crc_i86" \
	CRC32X="crc_i86" \
	OBJU2="msdos.obj" \
	OBJX2="msdos_.obj" \
	OSDEP_H="msdos/doscfg.h"

# IBM C Set, statically linked runtime
ibm:
	$(MAKE) -f os2/makefile.os2 all \
	CC="icc -Q -O -Gs -I." \
	CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="-O-" \
	DLLFLAG="" \
	LDFLAGS="-B/ST:0x50000 -Fe" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	DEF="os2\unzip.def"

# IBM C Set, dynamically linked runtime
ibmdyn:
	$(MAKE) -f os2/makefile.os2 all \
	CC="icc -Q -O -Gs -Gd -I." \
	CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="-O-" \
	DLLFLAG="" \
	LDFLAGS="-B/ST:0x50000 -Fe" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	DEF="os2\unzip.def"

# IBM C Set, debug version
ibmdebug:
	$(MAKE) -f os2/makefile.os2 all \
	CC="icc -Q -Ti -I." \
	CFLAGS="-Sm -Sp1 -D__DEBUG_ALLOC__ -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="-O-" \
	DLLFLAG="" \
	LDFLAGS="-B/ST:0x50000 -Fe" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	DEF="os2\unzip.def"

# IBM C Set, profiling version for PROFIT
ibmprof:
	$(MAKE) -f os2/makefile.os2 all \
	CC="icc -Q -O -Gs -Gh -Ti -I." \
	CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="-O-" \
	DLLFLAG="" \
	LDFLAGS="-B/ST:0x50000 -Fe" \
	LDFLAGS2="cppopa3.obj" \
	OUT="-Fo" \
	OBJ=".obj" \
	DEF="os2\unzip.def"

# IBM C Set, statically linked runtime
ibmdll:
	$(MAKE) -f os2/makefile.os2 dll \
	CC="icc -Q -O -Gs -I." \
	CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="-O-" \
	DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \
	LDFLAGS="-Fe" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	DLLDEF="os2\rexxapi.def" \
	STUBDEF="os2\stub.def" \
	DEF="os2\unzip.def" \
	APILIB="REXX.lib"

# IBM C Set, dynamically linked runtime
ibmdyndll:
	$(MAKE) -f os2/makefile.os2 dll \
	CC="icc -Q -O -Gs -Gd -I." \
	CFLAGS="-Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="-O-" \
	DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \
	LDFLAGS="-Fe" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	DLLDEF="os2\rexxapi.def" \
	STUBDEF="os2\stub.def" \
	DEF="os2\unzip.def" \
	APILIB="REXX.lib"

# IBM C Set, debug version
ibmdebugdll:
	$(MAKE) -f os2/makefile.os2 dll \
	CC="icc -Q -Ti -I." \
	CFLAGS="-Sm -Sp1 -D__DEBUG_ALLOC__ -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="-O-" \
	DLLFLAG="-Gm -Ge- -DDLL -DOS2DLL -DAPI_DOC" \
	LDFLAGS="-Fe" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	DLLDEF="os2\rexxapi.def" \
	STUBDEF="os2\stub.def" \
	DEF="os2\unzip.def" \
	APILIB="REXX.lib"

# IBM C Set, profiling version for PROFIT
ibmprofdll:
	$(MAKE) -f os2/makefile.os2 dll \
	CC="icc -Q -O -Gs -Gh -Ti -I." \
	CFLAGS="-Gm -Sm -Sp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="-O-" \
	DLLFLAG="-Ge- -DDLL -DOS2DLL -DAPI_DOC" \
	LDFLAGS="-Fe" \
	LDFLAGS2="profit.obj" \
	OUT="-Fo" \
	OBJ=".obj" \
	DLLDEF="os2\rexxapi.def" \
	STUBDEF="os2\stub.def" \
	DEF="os2\unzip.def" \
	APILIB="REXX.lib"

# Watcom C/386 9.0 or higher
watcom:
	$(MAKE) -f os2/makefile.os2 all \
	CC="wcl386 -bt=os2v2 -zq -Ox -s -I." \
	CFLAGS="-Zp1 -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="wasm -bt=os2v2 -zq -3 -mf" \
	ASFLAGS="" \
	LDFLAGS="-k0x50000 -x -l=os2v2 -Fe=" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRC32="crc_i386" \
	CRC32F="crc_i386" \
	CRC32X="crc_i386" \
	DEF="" \
	DIRSEP="\\" \
	AS_DIRSEP="\\"

# Watcom C/286 9.0 or higher
watcom16:
	$(MAKE) -f os2/makefile.os2 all \
	CC="wcl -bt=os2 -zq -ml -Ox -s -I." \
	CFLAGS="-Zp1 -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="wasm -bt=os2 -zq -2 -ml" \
	ASFLAGS="" \
	LDFLAGS="-k0x2000 -x -l=os2 -Fe=" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRC32="crc_i86" \
	CRC32F="crc_i86" \
	CRC32X="crc_i86" \
	DIRSEP="\\" \
	AS_DIRSEP="\\"

# Watcom C/386 9.0 or higher, crosscompilation for DOS, DOS4GW extender
watcomdos:
	$(MAKE) -f os2/makefile.os2 all \
	CC="wcl386 -bt=dos4g -zq -Ox -s -I." \
	CFLAGS="-Zp1 -DMSDOS -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="wasm -bt=dos4g -zq -3 -mf" \
	ASFLAGS="" \
	LDFLAGS="-k0x50000 -x -l=dos4g -Fe=" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRC32="crc_i386" \
	CRC32F="crc_i386" \
	CRC32X="crc_i386" \
	OBJU2="msdos.obj" \
	OBJX2="msdos_.obj" \
	OSDEP_H="msdos/doscfg.h" \
	DIRSEP="\\" \
	AS_DIRSEP="\\"

# Watcom C/386 9.0 or higher, crosscompilation for DOS, PMODE/W extender
pmodew:
	$(MAKE) -f os2/makefile.os2 all \
	CC="wcl386 -bt=dos4g -zq -Ox -s -I." \
	CFLAGS="-Zp1 -DMSDOS -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="wasm -bt=dos4g -zq -3 -mf" \
	ASFLAGS="" \
	LDFLAGS="-k0x50000 -x -l=pmodew -Fe=" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	CRC32="crc_i386" \
	CRC32F="crc_i386" \
	CRC32X="crc_i386" \
	OBJU2="msdos.obj" \
	OBJX2="msdos_.obj" \
	OSDEP_H="msdos/doscfg.h" \
	DIRSEP="\\" \
	AS_DIRSEP="\\"

# Watcom C/286 9.0 or higher, crosscompilation for DOS
watcom16dos:
	$(MAKE) -f os2/makefile.os2 all \
	CC="wcl -bt=dos -zq -mm -Ox -s -I." \
	CFLAGS="-Zp1 -DMSDOS $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="wasm -bt=dos -0 -mm" \
	ASFLAGS="-D__MEDIUM__" \
	LDFLAGS="-k0xC00 -x -l=dos -Fe=" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	OBJU2="msdos.obj" \
	OBJX2="msdos_.obj" \
	OSDEP_H="msdos/doscfg.h" \
	DIRSEP="\\" \
	AS_DIRSEP="\\"

# Watcom C/386 9.0 or higher, crosscompilation for Win95/NT
watcomwin32:
	$(MAKE) -f os2/makefile.os2 all \
	CC="wcl386 -bt=NT -zq -Ox -s -I." \
	CFLAGS="-Zp1 -DWIN32 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="wasm -bt=NT -zq -3 -mf" \
	ASFLAGS="" \
	LDFLAGS="-k0x50000 -x -l=NT -Fe=" \
	LDFLAGS2="" \
	OUT="-Fo" \
	OBJ=".obj" \
	OBJU2="win32.obj nt.obj" \
	OBJX2="win32_.obj nt_.obj" \
	CRC32="crc_i386" \
	CRC32F="crc_i386" \
	CRC32X="crc_i386" \
	DEF="" \
	DIRSEP="\\" \
	AS_DIRSEP="\\"

# MetaWare High C/C++ 3.2
metaware:
	$(MAKE) -f os2/makefile.os2 all \
	CC="hc -O2 -I." \
	CFLAGS="-D__32BIT__ -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	LDFLAGS="-o " \
	LDFLAGS2="" \
	OUT="-o ./" \
	OBJ=".obj" \
	DEF="-Hdef=os2\unzip.def"

# Borland C++
borland:
	$(MAKE) -f os2/makefile.os2 all \
	CC="bcc -O -I. -Ios2" \
	CFLAGS="-w- -D__cdecl -D__32BIT__ -DOS2 $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	LDFLAGS="-e" \
	LDFLAGS2="" \
	OUT="-o" \
	OBJ=".obj" \
	DEF="-sDos2\unzip.def"

# emx, gcc, OMF format, statically linked C runtime
gcc:
	$(MAKE) -f os2/makefile.os2 all \
	CC="gcc -Zomf -O -I." \
	CFLAGS="-Wall -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="gcc -Zomf" \
	ASFLAGS="-Di386" \
	LDFLAGS="-o ./" \
	LDFLAGS2="-Zsmall-conv -Zstack 320 -Zsys -s" \
	OUT="-o" \
	OBJ=".obj" \
	CRC32="crc_gcc" \
	CRC32F="crc_gcc" \
	CRC32X="crc_gcc" \
	DEF="os2/unzip.def"

# emx, gcc, OMF format, dynamically linked C runtime
gccdyn:
	$(MAKE) -f os2/makefile.os2 all \
	CC="gcc -Zomf -O -I." \
	CFLAGS="-Wall -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="gcc -Zomf" \
	ASFLAGS="-Di386" \
	LDFLAGS="-o ./" \
	LDFLAGS2="-Zstack 320 -Zcrtdll -s" \
	OUT="-o" \
	OBJ=".obj" \
	CRC32="crc_gcc" \
	CRC32F="crc_gcc" \
	CRC32X="crc_gcc" \
	DEF="os2/unzip.def"

# emx, gcc, a.out format, with debug info for gdb
gccdebug:
	$(MAKE) -f os2/makefile.os2 all \
	CC="gcc -g -I." \
	CFLAGS="-Wall -DOS2 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="gcc -g" \
	ASFLAGS="-Di386" \
	LDFLAGS="-o ./" \
	LDFLAGS2="-Zsmall-conv" \
	OUT="-o" \
	OBJ=".o" \
	CRC32="crc_gcc" \
	CRC32F="crc_gcc" \
	CRC32X="crc_gcc"

# emx, gcc, a.out format, cross-compilation for MS-DOS
gccdos:
	$(MAKE) -f os2/makefile.os2 all \
	CC="gcc -O -I." \
	CFLAGS="-Wall -DMSDOS -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="gcc" \
	ASFLAGS="-Di386" \
	LDFLAGS="-o ./" \
	LDFLAGS2="-Zsmall-conv -s" \
	OUT="-o" \
	OBJ=".o" \
	CRC32="crc_gcc" \
	CRC32F="crc_gcc" \
	CRC32X="crc_gcc" \
	OBJU2="msdos.o" \
	OBJX2="msdos_.o" \
	OSDEP_H="msdos/doscfg.h"

# emx, gcc, RSXNT, cross-compilation for Win32
gccwin32:
	$(MAKE) -f os2/makefile.os2 all \
	CC="gcc -Zwin32 -O -I." \
	CFLAGS="-Wall -DWIN32 -DASM_CRC $(LOCAL_UNZIP)" \
	NFLAGS="" \
	DLLFLAG="" \
	AS="gcc" \
	ASFLAGS="-Di386" \
	LDFLAGS="-o ./" \
	LDFLAGS2="-Zsmall-conv -s" \
	OUT="-o" \
	OBJ=".o" \
	CRC32="crc_gcc" \
	CRC32F="crc_gcc" \
	CRC32X="crc_gcc" \
	OBJU2="win32.o nt.o" \
	OBJX2="win32_.o nt_.o" \
	OSDEP_H="win32/w32cfg.h"

# variables

# LOCAL_UNZIP = -DREENTRANT

# default settings for target dependent macros:
DIRSEP = /
AS_DIRSEP = /

OSDEP_H = os2/os2data.h os2/os2cfg.h
CRC32   = crc32
CRC32F  = crc32f
CRC32X  = crc32_

OBJU  = unzip$(OBJ) $(CRC32)$(OBJ) crctab$(OBJ) crypt$(OBJ) envargs$(OBJ) \
	explode$(OBJ) extract$(OBJ) fileio$(OBJ) globals$(OBJ) \
	inflate$(OBJ) list$(OBJ) match$(OBJ) process$(OBJ) ttyio$(OBJ) \
	unreduce$(OBJ) unshrink$(OBJ) zipinfo$(OBJ)
OBJU2 = os2$(OBJ) os2acl$(OBJ)
OBJX  = unzipsf_$(OBJ) $(CRC32X)$(OBJ) crctab_$(OBJ) crypt_$(OBJ) \
        extract_$(OBJ) fileio_$(OBJ) globals_$(OBJ) inflate_$(OBJ) \
	match_$(OBJ) process_$(OBJ) ttyio_$(OBJ)
OBJX2 = os2_$(OBJ) os2acl$(OBJ)
OBJDLL= api$(OBJ) apihelp$(OBJ) rexxhelp$(OBJ) rexxapi$(OBJ)
OBJF  = funzip$(OBJ) $(CRC32F)$(OBJ) cryptf$(OBJ) inflatef$(OBJ) \
	globalsf$(OBJ) ttyiof$(OBJ)

UNZIP_H = unzip.h unzpriv.h globals.h $(OSDEP_H)

# rules

.SUFFIXES:	.c .asm $(OBJ)

.c$(OBJ):
	$(CC) -c $(CFLAGS) $(DLLFLAG) $<

.asm$(OBJ):
	$(AS) $(ASFLAGS) $< $(ASEOL)

# targets

all:	unzip.exe funzip.exe unzipsfx.exe
dll:	unzip32.dll unzip.stb funzip.exe unzipsfx.exe

unzip.exe: $(OBJU) $(OBJU2)
	$(CC) $(LDFLAGS)$@ $(DEF) $(OBJU) $(OBJU2) $(LDFLAGS2)

funzip.exe: $(OBJF)
	$(CC) $(LDFLAGS)$@ $(DEF) $(OBJF) $(LDFLAGS2)

unzipsfx.exe:	$(OBJX) $(OBJX2)
	$(CC) $(LDFLAGS)$@ $(DEF) $(OBJX) $(OBJX2) $(LDFLAGS2)

unzip32.dll: $(DLLDEF) $(OBJU) $(OBJU2) $(OBJDLL)
	$(CC) $(LDFLAGS)$@ $(DLLDEF) $(OBJU) $(OBJDLL) $(OBJU2) $(APILIB) $(LDFLAGS2)

unzip.stb: unzipstb$(OBJ) $(STUBDEF)
	$(CC) $(LDFLAGS)$@ $(STUBDEF) unzipstb$(OBJ) $(LDFLAGS2)
	copy unzip.stb unzip.exe

# dependencies

apihelp$(OBJ):	apihelp.c $(UNZIP_H) version.h
crc32$(OBJ):	crc32.c $(UNZIP_H) zip.h
crctab$(OBJ):	crctab.c $(UNZIP_H) zip.h
envargs$(OBJ):	envargs.c $(UNZIP_H)
explode$(OBJ):	explode.c $(UNZIP_H)
extract$(OBJ):	extract.c $(UNZIP_H) crypt.h
fileio$(OBJ):	fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h
globals$(OBJ):	globals.c $(UNZIP_H)
inflate$(OBJ):	inflate.c $(UNZIP_H)
list$(OBJ):	list.c $(UNZIP_H)
match$(OBJ):	match.c $(UNZIP_H)
process$(OBJ):	process.c $(UNZIP_H)
ttyio$(OBJ):	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h
unreduce$(OBJ):	unreduce.c $(UNZIP_H)
unshrink$(OBJ):	unshrink.c $(UNZIP_H)
unzip$(OBJ):	unzip.c $(UNZIP_H) crypt.h version.h consts.h
api$(OBJ):	api.c $(UNZIP_H) version.h
zipinfo$(OBJ):	zipinfo.c $(UNZIP_H)

funzip$(OBJ):	funzip.c $(UNZIP_H) crypt.h ttyio.h tables.h	# funzip only
	$(CC) -c $(CFLAGS) funzip.c

unzipstb$(OBJ):	unzipstb.c					# DLL version
	$(CC) -c $(CFLAGS) unzipstb.c

msdos$(OBJ):	msdos/msdos.c $(UNZIP_H) version.h		# DOS only
	$(CC) -c $(CFLAGS) msdos$(DIRSEP)msdos.c

msdos_$(OBJ):	msdos/msdos.c $(UNZIP_H)			# DOS unzipsfx
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ msdos$(DIRSEP)msdos.c

win32$(OBJ):	win32/win32.c $(UNZIP_H) win32/nt.h version.h	# Win32 only
	$(CC) -c $(CFLAGS) win32$(DIRSEP)win32.c

nt$(OBJ):	win32/nt.c $(UNZIP_H) win32/nt.h		# Win32 only
	$(CC) -c $(CFLAGS) win32$(DIRSEP)nt.c

win32_$(OBJ):	win32/win32.c $(UNZIP_H) win32/nt.h		# Win32 unzipsfx
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ win32$(DIRSEP)win32.c

nt_$(OBJ):	win32/nt.c $(UNZIP_H) win32/nt.h		# Win32 unzipsfx
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ win32$(DIRSEP)nt.c

os2$(OBJ):	os2/os2.c $(UNZIP_H) version.h			# OS/2 only
	$(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)os2.c

os2_$(OBJ):	os2/os2.c $(UNZIP_H)				# OS/2 unzipsfx
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ os2$(DIRSEP)os2.c

os2acl$(OBJ):	os2/os2acl.c $(UNZIP_H) version.h		# OS/2 only
	$(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)os2acl.c

rexxhelp$(OBJ):	os2/rexxhelp.c					# OS/2 DLL only
	$(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)rexxhelp.c

rexxapi$(OBJ):	os2/rexxapi.c					# OS/2 DLL only
	$(CC) -c $(CFLAGS) $(DLLFLAG) os2$(DIRSEP)rexxapi.c

crc_i86$(OBJ):	msdos/crc_i86.asm				# 16bit only
	$(AS) $(ASFLAGS) msdos$(AS_DIRSEP)crc_i86.asm $(ASEOL)

crc_i386$(OBJ):	win32/crc_i386.asm				# 32bit, MASM
	$(AS) $(ASFLAGS) win32$(AS_DIRSEP)crc_i386.asm $(ASEOL)

crc_gcc$(OBJ):	crc_i386.S					# 32bit, GNU AS
	$(AS) $(ASFLAGS) -x assembler-with-cpp -c -o $@ crc_i386.S

# NFLAGS are solely used as work-around for optimization bug in IBM C++ Set
crypt$(OBJ):	crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h
	$(CC) -c $(CFLAGS) $(DLLFLAG) $(NFLAGS) crypt.c

cryptf$(OBJ):	crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h	# funzip only
	$(CC) -c $(CFLAGS) $(NFLAGS) -DFUNZIP $(OUT)$@ crypt.c

crc32f$(OBJ):	crc32.c $(UNZIP_H) zip.h			# funzip only
	$(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ crc32.c

globalsf$(OBJ):	globals.c $(UNZIP_H)				# funzip only
	$(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ globals.c

inflatef$(OBJ):	inflate.c inflate.h $(UNZIP_H) crypt.h		# funzip only
	$(CC) -c $(CFLAGS) -DFUNZIP $(OUT)$@ inflate.c

ttyiof$(OBJ):	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h	# funzip only
	$(CC) -c $(CFLAGS) $(NFLAGS) -DFUNZIP $(OUT)$@ ttyio.c

crc32_$(OBJ):	crc32.c $(UNZIP_H) zip.h			# unzipsfx only
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crc32.c

crctab_$(OBJ):	crctab.c $(UNZIP_H) zip.h			# unzipsfx only
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crctab.c

crypt_$(OBJ):	crypt.c $(UNZIP_H) zip.h crypt.h ttyio.h	# unzipsfx only
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ crypt.c

extract_$(OBJ):	extract.c $(UNZIP_H) crypt.h			# unzipsfx only
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ extract.c

fileio_$(OBJ):	fileio.c $(UNZIP_H) crypt.h ttyio.h ebcdic.h	# unzipsfx only
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ fileio.c

globals_$(OBJ):	globals.c $(UNZIP_H)				# unzipsfx only
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ globals.c

inflate_$(OBJ):	inflate.c inflate.h $(UNZIP_H) crypt.h		# unzipsfx only
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ inflate.c

match_$(OBJ):	match.c $(UNZIP_H)				# unzipsfx only
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ match.c

process_$(OBJ):	process.c $(UNZIP_H)				# unzipsfx only
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ process.c

ttyio_$(OBJ):	ttyio.c $(UNZIP_H) zip.h crypt.h ttyio.h	# unzipsfx only
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ ttyio.c

unzipsf_$(OBJ):	unzip.c $(UNZIP_H) crypt.h version.h consts.h	# unzipsfx only
	$(CC) -c $(CFLAGS) -DSFX $(OUT)$@ unzip.c
