1# Makefile for zlib
2#   adapted from Makefile for libpng
3# 32-bit Borland C++ (Note: All modules are compiled in C mode)
4# To build the library, do:
5#       "make -fmakefile.bc32"
6#
7# -------------------- 32-bit Borland C++ --------------------
8
9### Absolutely necessary for this makefile to work
10.AUTODEPEND
11
12## Where zlib.h, zconf.h and zlib.lib are
13ZLIB_DIR=.
14
15
16## Compiler, linker and lib stuff
17CC=bcc32
18LD=bcc32
19LIB=tlib
20
21TARGET_CPU=3
22# 3 = 386, 4 = 486, 5 = Pentium etc.
23!ifndef TARGET_CPU
24TARGET_CPU=5
25!endif
26
27# Use this if you don't want Borland's fancy exception handling
28#NOEHLIB=noeh32.lib
29
30!ifdef DEBUG
31CDEBUG=-v
32LDEBUG=-v
33!else
34CDEBUG=
35LDEBUG=
36!endif
37
38# STACKOFLOW=1
39!ifdef STACKOFLOW
40CDEBUG=$(CDEBUG) -N
41LDEBUG=$(LDEBUG) -N
42!endif
43
44# -X- turn on dependency generation in the object file
45# -w  set all warnings on
46# -O2 optimize for speed
47# -Z  global optimization
48CFLAGS=-O2 -Z -X- -w -I$(ZLIB_DIR) -$(TARGET_CPU) $(CDEBUG)
49
50# -M  generate map file
51LDFLAGS=-M -L$(ZLIB_DIR) $(LDEBUG)
52
53
54## Variables
55OBJS = \
56   adler32.obj \
57   compress.obj \
58   crc32.obj \
59   gzio.obj \
60   uncompr.obj \
61   deflate.obj \
62   trees.obj \
63   zutil.obj \
64   inflate.obj \
65   infblock.obj \
66   inftrees.obj \
67   infcodes.obj \
68   infutil.obj \
69   inffast.obj
70
71LIBOBJS = \
72   +adler32.obj \
73   +compress.obj \
74   +crc32.obj \
75   +gzio.obj \
76   +uncompr.obj \
77   +deflate.obj \
78   +trees.obj \
79   +zutil.obj \
80   +inflate.obj \
81   +infblock.obj \
82   +inftrees.obj \
83   +infcodes.obj \
84   +infutil.obj \
85   +inffast.obj
86
87
88LIBNAME=zlib.lib
89
90
91## Implicit rules
92# Braces let make "batch" calls to the compiler,
93# 2 calls instead of 12; space is important.
94.c.obj:
95	$(CC) $(CFLAGS) -c {$*.c }
96
97.c.exe:
98	$(CC) $(CFLAGS) $(LDFLAGS) $*.c $(LIBNAME) $(NOEHLIB)
99
100.obj.exe:
101	$(LD) $(LDFLAGS) $*.obj $(LIBNAME) $(NOEHLIB)
102
103
104## Major targets
105all: zlib.lib example.exe minigzip.exe
106
107zlib: $(LIBNAME)
108
109example: example.exe
110
111minigzip: minigzip.exe
112
113test: example.exe minigzip.exe
114   example
115	echo hello world | minigzip | minigzip -d
116
117
118## Minor Targets
119
120adler32.obj: adler32.c
121compress.obj: compress.c
122crc32.obj: crc32.c
123deflate.obj: deflate.c
124gzio.obj: gzio.c
125infblock.obj: infblock.c
126infcodes.obj: infcodes.c
127inflate.obj: inflate.c
128inftrees.obj: inftrees.c
129infutil.obj: infutil.c
130inffast.obj: inffast.c
131trees.obj: trees.c
132uncompr.obj: uncompr.c
133zutil.obj: zutil.c
134example.obj: example.c
135minigzip.obj: minigzip.c
136example.exe: example.obj zlib.lib
137minigzip.exe: minigzip.obj zlib.lib
138
139
140$(LIBNAME): $(OBJS)
141	-del $(LIBNAME)
142	$(LIB) $(LIBNAME) @&&|
143$(LIBOBJS), zlib
144|
145
146
147# Clean up anything else you want
148clean:
149	-del *.obj
150	-del *.exe
151	-del *.lib
152	-del *.lst
153	-del *.map
154	-del *.tds
155
156
157# End of makefile for zlib
158