kusano fc6ab3
# Makefile for zlib
kusano fc6ab3
# Borland C++
kusano fc6ab3
# Last updated: 15-Mar-2003
kusano fc6ab3
kusano fc6ab3
# To use, do "make -fmakefile.bor"
kusano fc6ab3
# To compile in small model, set below: MODEL=s
kusano fc6ab3
kusano fc6ab3
# WARNING: the small model is supported but only for small values of
kusano fc6ab3
# MAX_WBITS and MAX_MEM_LEVEL. For example:
kusano fc6ab3
#    -DMAX_WBITS=11 -DDEF_WBITS=11 -DMAX_MEM_LEVEL=3
kusano fc6ab3
# If you wish to reduce the memory requirements (default 256K for big
kusano fc6ab3
# objects plus a few K), you can add to the LOC macro below:
kusano fc6ab3
#   -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
kusano fc6ab3
# See zconf.h for details about the memory requirements.
kusano fc6ab3
kusano fc6ab3
# ------------ Turbo C++, Borland C++ ------------
kusano fc6ab3
kusano fc6ab3
#    Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
kusano fc6ab3
#    should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added
kusano fc6ab3
#    to the declaration of LOC here:
kusano fc6ab3
LOC = $(LOCAL_ZLIB)
kusano fc6ab3
kusano fc6ab3
# type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
kusano fc6ab3
CPU_TYP = 0
kusano fc6ab3
kusano fc6ab3
# memory model: one of s, m, c, l (small, medium, compact, large)
kusano fc6ab3
MODEL=l
kusano fc6ab3
kusano fc6ab3
# replace bcc with tcc for Turbo C++ 1.0, with bcc32 for the 32 bit version
kusano fc6ab3
CC=bcc
kusano fc6ab3
LD=bcc
kusano fc6ab3
AR=tlib
kusano fc6ab3
kusano fc6ab3
# compiler flags
kusano fc6ab3
# replace "-O2" by "-O -G -a -d" for Turbo C++ 1.0
kusano fc6ab3
CFLAGS=-O2 -Z -m$(MODEL) $(LOC)
kusano fc6ab3
kusano fc6ab3
LDFLAGS=-m$(MODEL) -f-
kusano fc6ab3
kusano fc6ab3
kusano fc6ab3
# variables
kusano fc6ab3
ZLIB_LIB = zlib_$(MODEL).lib
kusano fc6ab3
kusano fc6ab3
OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
kusano fc6ab3
OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
kusano fc6ab3
OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
kusano fc6ab3
OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
kusano fc6ab3
kusano fc6ab3
kusano fc6ab3
# targets
kusano fc6ab3
all: $(ZLIB_LIB) example.exe minigzip.exe
kusano fc6ab3
kusano fc6ab3
.c.obj:
kusano fc6ab3
	$(CC) -c $(CFLAGS) $*.c
kusano fc6ab3
kusano fc6ab3
adler32.obj: adler32.c zlib.h zconf.h
kusano fc6ab3
kusano fc6ab3
compress.obj: compress.c zlib.h zconf.h
kusano fc6ab3
kusano fc6ab3
crc32.obj: crc32.c zlib.h zconf.h crc32.h
kusano fc6ab3
kusano fc6ab3
deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
kusano fc6ab3
kusano fc6ab3
gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
kusano fc6ab3
kusano fc6ab3
gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
kusano fc6ab3
kusano fc6ab3
gzread.obj: gzread.c zlib.h zconf.h gzguts.h
kusano fc6ab3
kusano fc6ab3
gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
kusano fc6ab3
kusano fc6ab3
infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
kusano fc6ab3
 inffast.h inffixed.h
kusano fc6ab3
kusano fc6ab3
inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
kusano fc6ab3
 inffast.h
kusano fc6ab3
kusano fc6ab3
inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
kusano fc6ab3
 inffast.h inffixed.h
kusano fc6ab3
kusano fc6ab3
inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
kusano fc6ab3
kusano fc6ab3
trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
kusano fc6ab3
kusano fc6ab3
uncompr.obj: uncompr.c zlib.h zconf.h
kusano fc6ab3
kusano fc6ab3
zutil.obj: zutil.c zutil.h zlib.h zconf.h
kusano fc6ab3
kusano fc6ab3
example.obj: test/example.c zlib.h zconf.h
kusano fc6ab3
kusano fc6ab3
minigzip.obj: test/minigzip.c zlib.h zconf.h
kusano fc6ab3
kusano fc6ab3
kusano fc6ab3
# the command line is cut to fit in the MS-DOS 128 byte limit:
kusano fc6ab3
$(ZLIB_LIB): $(OBJ1) $(OBJ2)
kusano fc6ab3
	-del $(ZLIB_LIB)
kusano fc6ab3
	$(AR) $(ZLIB_LIB) $(OBJP1)
kusano fc6ab3
	$(AR) $(ZLIB_LIB) $(OBJP2)
kusano fc6ab3
kusano fc6ab3
example.exe: example.obj $(ZLIB_LIB)
kusano fc6ab3
	$(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
kusano fc6ab3
kusano fc6ab3
minigzip.exe: minigzip.obj $(ZLIB_LIB)
kusano fc6ab3
	$(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
kusano fc6ab3
kusano fc6ab3
test: example.exe minigzip.exe
kusano fc6ab3
	example
kusano fc6ab3
	echo hello world | minigzip | minigzip -d
kusano fc6ab3
kusano fc6ab3
clean:
kusano fc6ab3
	-del *.obj
kusano fc6ab3
	-del *.lib
kusano fc6ab3
	-del *.exe
kusano fc6ab3
	-del zlib_*.bak
kusano fc6ab3
	-del foo.gz