# Makefile for the MVS (OS/390 Base) version of UNZIP 5.4
# Produced for C/C++ V3R2 in OS/390 1.2.0 by Ian E. Gorman, 2 Nov 1998
# Facilities for compiling and testing were made available by
#     OmniMark Technologies Corporation, Ottawa, Canada

# NOTES
#
# The only tabs in this file are in the first character of each recipe
# line, where they are required by make.
#
# Run this makefile in OpenMVS (OS/390 POSIX) using source files in the
# HFS file system.  You can write the load module to either HFS file
# system or to a PDS in the native MVS file system.  The PDS must have
# sufficient free space to hold the load module.
#
# To compile to a member of a PDS:
#   make
# or
#   make unzip.mvs
#
# To compile a test version into the HFS file system:
#   make hfs

# UNZIP options -- MVS, REENTRANT
ZIPOPTS=-DMVS

# directories

# generic source code
SRC=..
SRC_P=$(SRC)/

# source code for MVS
CMSMVS=../cmsmvs
CMSMVS_P=$(CMSMVS)/

# include files
INCLS=-I$(SRC) -I$(CMSMVS)

# object files and load modules
BLD_P=../mvs/

# Other options

# Suffixes (E and O must be different)
E=
O=.o

# Need EXTENDED features for global.c and vmvms.c, so not using c89
CC=cc
CFLAGS=-D_OPEN_SYS $(ZIPOPTS) $(INCLS)

LD=cc
LDFLAGS=

# Files

# object (TEXT) files
OBJECTS= $(BLD_P)unzip$(O) $(BLD_P)crc32$(O) $(BLD_P)crctab$(O) \
   $(BLD_P)crypt$(O)    $(BLD_P)envargs$(O)  $(BLD_P)explode$(O) \
   $(BLD_P)extract$(O)  $(BLD_P)fileio$(O)   $(BLD_P)globals$(O) \
   $(BLD_P)inflate$(O)  $(BLD_P)process$(O)  $(BLD_P)list$(O) \
   $(BLD_P)match$(O)    $(BLD_P)ttyio$(O)    $(BLD_P)unreduce$(O) \
   $(BLD_P)unshrink$(O) $(BLD_P)zipinfo$(O)  $(BLD_P)vmmvs$(O)

# Header files
HFILES= $(SRC_P)consts.h $(SRC_P)crypt.h $(SRC_P)ebcdic.h \
    $(SRC_P)globals.h $(SRC_P)inflate.h $(SRC_P)tables.h \
    $(SRC_P)ttyio.h $(SRC_P)unzip.h $(SRC_P)unzpriv.h \
    $(SRC_P)unzvers.h $(SRC_P)zip.h $(CMSMVS_P)vmmvs.h \
    $(CMSMVS_P)vmstat.h

# Rules

all:  $(BLD_P)unzip.mvs$(E)
hfs:  $(BLD_P)unzip$(E)

# link

$(BLD_P)unzip.mvs$(E):     $(OBJECTS)
	$(LD) -o "//INFOZIP.LOAD(UNZIP)" $(LDFLAGS) $^
	echo "tso call \"infozip(unzip)\" \"'\"\"""$$""@""\"\"'\"" > $%
	chmod a+x $%

$(BLD_P)unzip$(E):     $(OBJECTS)
	$(LD) -o $% $(LDFLAGS) $^

# compile

$(BLD_P)api$(O):        $(SRC_P)api.c           $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)api.c

$(BLD_P)apihelp$(O):    $(SRC_P)apihelp.c       $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)apihelp.c

$(BLD_P)crc32$(O):      $(SRC_P)crc32.c         $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)crc32.c

$(BLD_P)crctab$(O):     $(SRC_P)crctab.c        $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)crctab.c

$(BLD_P)crypt$(O):      $(SRC_P)crypt.c         $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)crypt.c

$(BLD_P)envargs$(O):    $(SRC_P)envargs.c       $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)envargs.c

$(BLD_P)explode$(O):    $(SRC_P)explode.c       $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)explode.c

$(BLD_P)extract$(O):    $(SRC_P)extract.c       $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)extract.c

$(BLD_P)fileio$(O):     $(SRC_P)fileio.c        $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)fileio.c

$(BLD_P)funzip$(O):     $(SRC_P)funzip.c        $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)funzip.c

$(BLD_P)globals$(O):    $(SRC_P)globals.c       $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)globals.c

$(BLD_P)inflate$(O):    $(SRC_P)inflate.c       $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)inflate.c

$(BLD_P)list$(O):       $(SRC_P)list.c          $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)list.c

$(BLD_P)match$(O):      $(SRC_P)match.c         $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)match.c

$(BLD_P)process$(O):    $(SRC_P)process.c       $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)process.c

$(BLD_P)ttyio$(O):      $(SRC_P)ttyio.c         $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)ttyio.c

$(BLD_P)unreduce$(O):   $(SRC_P)unreduce.c      $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)unreduce.c

$(BLD_P)unshrink$(O):   $(SRC_P)unshrink.c      $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)unshrink.c

$(BLD_P)unzip$(O):      $(SRC_P)unzip.c         $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)unzip.c

$(BLD_P)unzipstb$(O):   $(SRC_P)unzipstb.c      $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)unzipstb.c

$(BLD_P)zipinfo$(O):    $(SRC_P)zipinfo.c       $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(SRC_P)zipinfo.c

$(BLD_P)vmmvs$(O):      $(CMSMVS_P)vmmvs.c      $(HFILES)
	$(CC) -c -o $% $(CFLAGS) $(CMSMVS_P)vmmvs.c
