# Makefile for Zip, ZipCloak, ZipNote and ZipSplit for
# 32-bit IBM Visual Age C++

# To use, do "nmake -f win32\makefile.ibm"

# Optional nonstandard preprocessor flags (as -DMEDIUM_MEM or -DNO_ASM)
# should be added to the environment via "set LOCAL_ZIP=-DFOO" or added
# to the declaration of LOC here:
LOC = $(LOCAL_ZIP)

# Uncomment the following macro to use the optimized assembler
# routines in Zip:
# ASMOBJS = match32.obj

# ------------- 32-bit IBM Visual Age C++ -------------
CC=icc -q -O
CFLAGS=-W0 -DWIN32 -Sm -DNO_ASM -DNO_MKTEMP $(LOC)
UTILFLAGS=$(CFLAGS) -DUTIL -Fo$@
LDFLAGS=
LIBS=advapi32.lib
AS=ml -nologo
ASFLAGS=-c -Cx

# variables
OBJZ = zip.obj crypt.obj ttyio.obj zipfile.obj zipup.obj fileio.obj util.obj \
	crc32.obj crctab.obj globals.obj

OBJI = deflate.obj trees.obj $(ASMOBJS) win32.obj win32zip.obj nt.obj

OBJU = zipfile_.obj fileio_.obj util_.obj globals.obj win32_.obj
OBJN = zipnote.obj $(OBJU)
OBJC = zipcloak.obj crctab.obj crypt_.obj ttyio.obj $(OBJU)
OBJS = zipsplit.obj $(OBJU)

ZIP_H = zip.h ziperr.h tailor.h win32/osdep.h

ZIPS = zip.exe zipnote.exe zipsplit.exe zipcloak.exe

zips:   $(ZIPS)

zip.obj:        zip.c $(ZIP_H) revision.h crypt.h ttyio.h
	$(CC) -c $(CFLAGS) $*.c

zipfile.obj:    zipfile.c $(ZIP_H)
	$(CC) -c $(CFLAGS) $*.c

zipup.obj:      zipup.c $(ZIP_H) revision.h crypt.h win32/zipup.h
	$(CC) -c $(CFLAGS) $*.c

fileio.obj:     fileio.c $(ZIP_H)
	$(CC) -c $(CFLAGS) $*.c

util.obj:       util.c $(ZIP_H)
	$(CC) -c $(CFLAGS) $*.c

globals.obj:    globals.c $(ZIP_H)
	$(CC) -c $(CFLAGS) $*.c

deflate.obj:    deflate.c $(ZIP_H)
	$(CC) -c $(CFLAGS) $*.c

trees.obj:      trees.c $(ZIP_H)
	$(CC) -c $(CFLAGS) $*.c

crc32.obj:      crc32.c $(ZIP_H)
	$(CC) -c $(CFLAGS) $*.c

crctab.obj:     crctab.c $(ZIP_H)
	$(CC) -c $(CFLAGS) $*.c

crypt.obj:      crypt.c $(ZIP_H) crypt.h ttyio.h
	$(CC) -c $(CFLAGS) $*.c

ttyio.obj:      ttyio.c $(ZIP_H) crypt.h ttyio.h
	$(CC) -c $(CFLAGS) $*.c

win32zip.obj:   win32/win32zip.c $(ZIP_H) win32/win32zip.h win32/nt.h
	$(CC) -c $(CFLAGS) -I. win32/win32zip.c

win32.obj:      win32/win32.c $(ZIP_H) win32/win32zip.h
	$(CC) -c $(CFLAGS) -I. win32/win32.c

nt.obj:         win32/nt.c $(ZIP_H) win32/nt.h
	$(CC) -c $(CFLAGS) -I. win32/nt.c

zipcloak.obj:   zipcloak.c $(ZIP_H) revision.h crypt.h ttyio.h
	$(CC) -c $(CFLAGS) $*.c

zipnote.obj:    zipnote.c $(ZIP_H) revision.h
	$(CC) -c $(CFLAGS) $*.c

zipsplit.obj:   zipsplit.c $(ZIP_H) revision.h
	$(CC) -c $(CFLAGS) $*.c

zipfile_.obj:   zipfile.c $(ZIP_H)
	$(CC) -c $(UTILFLAGS) zipfile.c

fileio_.obj:    fileio.c $(ZIP_H)
	$(CC) -c $(UTILFLAGS) fileio.c

util_.obj:      util.c $(ZIP_H)
	$(CC) -c $(UTILFLAGS) util.c

crypt_.obj:     crypt.c $(ZIP_H) crypt.h ttyio.h
	$(CC) -c $(UTILFLAGS) crypt.c

win32_.obj:     win32/win32.c $(ZIP_H) win32/win32zip.h
	$(CC) -c $(UTILFLAGS) -I. win32/win32.c

match32.obj:    win32/match32.asm
	$(AS) $(ASFLAGS) win32\match32.asm

zip.exe: $(OBJZ) $(OBJI)
	$(CC) -Fe $@ $(LDFLAGS) $(OBJZ) $(OBJI) $(LIBS)

zipcloak.exe: $(OBJC)
	$(CC) -Fe $@ $(LDFLAGS) $(OBJC) $(LIBS)

zipnote.exe: $(OBJN)
	$(CC) -Fe $@ $(LDFLAGS) $(OBJN) $(LIBS)

zipsplit.exe: $(OBJS)
	$(CC) -Fe $@ $(LDFLAGS) $(OBJS) $(LIBS)
