1# Makefile for zlib
2# Borland C++
3# Last updated: 15-Mar-2003
4
5# To use, do "make -fmakefile.bor"
6# To compile in small model, set below: MODEL=s
7
8# WARNING: the small model is supported but only for small values of
9# MAX_WBITS and MAX_MEM_LEVEL. For example:
10#    -DMAX_WBITS=11 -DDEF_WBITS=11 -DMAX_MEM_LEVEL=3
11# If you wish to reduce the memory requirements (default 256K for big
12# objects plus a few K), you can add to the LOC macro below:
13#   -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
14# See zconf.h for details about the memory requirements.
15
16# ------------ Turbo C++, Borland C++ ------------
17
18#    Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
19#    should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added
20#    to the declaration of LOC here:
21LOC = $(LOCAL_ZLIB)
22
23# type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
24CPU_TYP = 0
25
26# memory model: one of s, m, c, l (small, medium, compact, large)
27MODEL=l
28
29# replace bcc with tcc for Turbo C++ 1.0, with bcc32 for the 32 bit version
30CC=bcc
31LD=bcc
32AR=tlib
33
34# compiler flags
35# replace "-O2" by "-O -G -a -d" for Turbo C++ 1.0
36CFLAGS=-O2 -Z -m$(MODEL) $(LOC)
37
38LDFLAGS=-m$(MODEL) -f-
39
40
41# variables
42ZLIB_LIB = zlib_$(MODEL).lib
43
44OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
45OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
46OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
47OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
48
49
50# targets
51all: $(ZLIB_LIB) example.exe minigzip.exe
52
53.c.obj:
54	$(CC) -c $(CFLAGS) $*.c
55
56adler32.obj: adler32.c zlib.h zconf.h
57
58compress.obj: compress.c zlib.h zconf.h
59
60crc32.obj: crc32.c zlib.h zconf.h crc32.h
61
62deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
63
64gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
65
66gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
67
68gzread.obj: gzread.c zlib.h zconf.h gzguts.h
69
70gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
71
72infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
73 inffast.h inffixed.h
74
75inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
76 inffast.h
77
78inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
79 inffast.h inffixed.h
80
81inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
82
83trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
84
85uncompr.obj: uncompr.c zlib.h zconf.h
86
87zutil.obj: zutil.c zutil.h zlib.h zconf.h
88
89example.obj: test/example.c zlib.h zconf.h
90
91minigzip.obj: test/minigzip.c zlib.h zconf.h
92
93
94# the command line is cut to fit in the MS-DOS 128 byte limit:
95$(ZLIB_LIB): $(OBJ1) $(OBJ2)
96	-del $(ZLIB_LIB)
97	$(AR) $(ZLIB_LIB) $(OBJP1)
98	$(AR) $(ZLIB_LIB) $(OBJP2)
99
100example.exe: example.obj $(ZLIB_LIB)
101	$(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
102
103minigzip.exe: minigzip.obj $(ZLIB_LIB)
104	$(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
105
106test: example.exe minigzip.exe
107	example
108	echo hello world | minigzip | minigzip -d
109
110clean:
111	-del *.obj
112	-del *.lib
113	-del *.exe
114	-del zlib_*.bak
115	-del foo.gz
116