1# Makefile for zlib
2# Borland C++ for Win32
3#
4# Usage:
5#  make -f win32/Makefile.bor
6#  make -f win32/Makefile.bor LOCAL_ZLIB=-DASMV OBJA=match.obj OBJPA=+match.obj
7
8# ------------ Borland C++ ------------
9
10# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
11# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or
12# added to the declaration of LOC here:
13LOC = $(LOCAL_ZLIB)
14
15CC = bcc32
16AS = bcc32
17LD = bcc32
18AR = tlib
19CFLAGS  = -a -d -k- -O2 $(LOC)
20ASFLAGS = $(LOC)
21LDFLAGS = $(LOC)
22
23
24# variables
25ZLIB_LIB = zlib.lib
26
27OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
28OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
29#OBJA =
30OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
31OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
32#OBJPA=
33
34
35# targets
36all: $(ZLIB_LIB) example.exe minigzip.exe
37
38.c.obj:
39	$(CC) -c $(CFLAGS) $<
40
41.asm.obj:
42	$(AS) -c $(ASFLAGS) $<
43
44adler32.obj: adler32.c zlib.h zconf.h
45
46compress.obj: compress.c zlib.h zconf.h
47
48crc32.obj: crc32.c zlib.h zconf.h crc32.h
49
50deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
51
52gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
53
54gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
55
56gzread.obj: gzread.c zlib.h zconf.h gzguts.h
57
58gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
59
60infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
61 inffast.h inffixed.h
62
63inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
64 inffast.h
65
66inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
67 inffast.h inffixed.h
68
69inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
70
71trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
72
73uncompr.obj: uncompr.c zlib.h zconf.h
74
75zutil.obj: zutil.c zutil.h zlib.h zconf.h
76
77example.obj: test/example.c zlib.h zconf.h
78
79minigzip.obj: test/minigzip.c zlib.h zconf.h
80
81
82# For the sake of the old Borland make,
83# the command line is cut to fit in the MS-DOS 128 byte limit:
84$(ZLIB_LIB): $(OBJ1) $(OBJ2) $(OBJA)
85	-del $(ZLIB_LIB)
86	$(AR) $(ZLIB_LIB) $(OBJP1)
87	$(AR) $(ZLIB_LIB) $(OBJP2)
88	$(AR) $(ZLIB_LIB) $(OBJPA)
89
90
91# testing
92test: example.exe minigzip.exe
93	example
94	echo hello world | minigzip | minigzip -d
95
96example.exe: example.obj $(ZLIB_LIB)
97	$(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
98
99minigzip.exe: minigzip.obj $(ZLIB_LIB)
100	$(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
101
102
103# cleanup
104clean:
105	-del $(ZLIB_LIB)
106	-del *.obj
107	-del *.exe
108	-del *.tds
109	-del zlib.bak
110	-del foo.gz
111