1# Makefile for zlib
2# For use with Delphi and C++ Builder under Win32
3# Updated for zlib 1.2.x by Cosmin Truta
4
5# ------------ Borland C++ ------------
6
7# This project uses the Delphi (fastcall/register) calling convention:
8LOC = -DZEXPORT=__fastcall -DZEXPORTVA=__cdecl
9
10CC = bcc32
11LD = bcc32
12AR = tlib
13# do not use "-pr" in CFLAGS
14CFLAGS = -a -d -k- -O2 $(LOC)
15LDFLAGS =
16
17
18# variables
19ZLIB_LIB = zlib.lib
20
21OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
22OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
23OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
24OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
25
26
27# targets
28all: $(ZLIB_LIB) example.exe minigzip.exe
29
30.c.obj:
31	$(CC) -c $(CFLAGS) $*.c
32
33adler32.obj: adler32.c zlib.h zconf.h
34
35compress.obj: compress.c zlib.h zconf.h
36
37crc32.obj: crc32.c zlib.h zconf.h crc32.h
38
39deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
40
41gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
42
43gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
44
45gzread.obj: gzread.c zlib.h zconf.h gzguts.h
46
47gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
48
49infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
50 inffast.h inffixed.h
51
52inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
53 inffast.h
54
55inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
56 inffast.h inffixed.h
57
58inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
59
60trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
61
62uncompr.obj: uncompr.c zlib.h zconf.h
63
64zutil.obj: zutil.c zutil.h zlib.h zconf.h
65
66example.obj: test/example.c zlib.h zconf.h
67
68minigzip.obj: test/minigzip.c zlib.h zconf.h
69
70
71# For the sake of the old Borland make,
72# the command line is cut to fit in the MS-DOS 128 byte limit:
73$(ZLIB_LIB): $(OBJ1) $(OBJ2)
74	-del $(ZLIB_LIB)
75	$(AR) $(ZLIB_LIB) $(OBJP1)
76	$(AR) $(ZLIB_LIB) $(OBJP2)
77
78
79# testing
80test: example.exe minigzip.exe
81	example
82	echo hello world | minigzip | minigzip -d
83
84example.exe: example.obj $(ZLIB_LIB)
85	$(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
86
87minigzip.exe: minigzip.obj $(ZLIB_LIB)
88	$(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
89
90
91# cleanup
92clean:
93	-del *.obj
94	-del *.exe
95	-del *.lib
96	-del *.tds
97	-del zlib.bak
98	-del foo.gz
99
100