1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
# Makefile for zlib
# Microsoft C 5.1 or later
# To use, do "make makefile.msc"
# To compile in small model, set below: MODEL=S
# If you wish to reduce the memory requirements (default 256K for big
# objects plus a few K), you can add to the LOC macro below:
# -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
# See zconf.h for details about the memory requirements.
# ------------- Microsoft C 5.1 and later -------------
# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7)
# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added
# to the declaration of LOC here:
LOC = $(LOCAL_ZLIB)
# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc.
CPU_TYP = 0
# Memory model: one of S, M, C, L (small, medium, compact, large)
MODEL=L
CC=cl
CFLAGS=-nologo -A$(MODEL) -G$(CPU_TYP) -W3 -Oait -Gs $(LOC)
#-Ox generates bad code with MSC 5.1
LIB_CFLAGS=-Zl $(CFLAGS)
LD=link
LDFLAGS=/noi/e/st:0x1500/noe/farcall/packcode
# "/farcall/packcode" are only useful for `large code' memory models
# but should be a "no-op" for small code models.
O=.obj
# variables
OBJ1 = adler32$(O) compress$(O) crc32$(O) gzio$(O) uncompr$(O) deflate$(O) \
trees$(O)
OBJP1 = adler32$(O)+compress$(O)+crc32$(O)+gzio$(O)+uncompr$(O)+deflate$(O)+\
trees$(O)
OBJ2 = zutil$(O) inflate$(O) infblock$(O) inftrees$(O) infcodes$(O) \
infutil$(O) inffast$(O)
OBJP2 = zutil$(O)+inflate$(O)+infblock$(O)+inftrees$(O)+infcodes$(O)+\
infutil$(O)+inffast$(O)
ZLIB_H = zlib.h zconf.h
ZUTIL_H = zutil.h $(ZLIB_H)
ZLIB_LIB = zlib_$(MODEL).lib
all: $(ZLIB_LIB) example.exe minigzip.exe
# individual dependencies and action rules:
adler32.obj: adler32.c $(ZLIB_H)
$(CC) -c $(LIB_CFLAGS) $*.c
compress.obj: compress.c $(ZLIB_H)
$(CC) -c $(LIB_CFLAGS) $*.c
crc32.obj: crc32.c $(ZLIB_H)
$(CC) -c $(LIB_CFLAGS) $*.c
deflate.obj: deflate.c deflate.h $(ZUTIL_H)
$(CC) -c $(LIB_CFLAGS) $*.c
gzio.obj: gzio.c $(ZUTIL_H)
$(CC) -c $(LIB_CFLAGS) $*.c
infblock.obj: infblock.c $(ZUTIL_H) infblock.h inftrees.h infcodes.h infutil.h
$(CC) -c $(LIB_CFLAGS) $*.c
infcodes.obj: infcodes.c $(ZUTIL_H) inftrees.h infutil.h infcodes.h inffast.h
$(CC) -c $(LIB_CFLAGS) $*.c
inflate.obj: inflate.c $(ZUTIL_H) infblock.h
$(CC) -c $(LIB_CFLAGS) $*.c
inftrees.obj: inftrees.c $(ZUTIL_H) inftrees.h
$(CC) -c $(LIB_CFLAGS) $*.c
infutil.obj: infutil.c $(ZUTIL_H) inftrees.h infutil.h
$(CC) -c $(LIB_CFLAGS) $*.c
inffast.obj: inffast.c $(ZUTIL_H) inftrees.h infutil.h inffast.h
$(CC) -c $(LIB_CFLAGS) $*.c
trees.obj: trees.c deflate.h $(ZUTIL_H)
$(CC) -c $(LIB_CFLAGS) $*.c
uncompr.obj: uncompr.c $(ZLIB_H)
$(CC) -c $(LIB_CFLAGS) $*.c
zutil.obj: zutil.c $(ZUTIL_H)
$(CC) -c $(LIB_CFLAGS) $*.c
example.obj: example.c $(ZLIB_H)
$(CC) -c $(CFLAGS) $*.c
minigzip.obj: minigzip.c $(ZLIB_H)
$(CC) -c $(CFLAGS) $*.c
# we must cut the command line to fit in the MS/DOS 128 byte limit:
$(ZLIB_LIB): $(OBJ1) $(OBJ2)
if exist $(ZLIB_LIB) del $(ZLIB_LIB)
lib $(ZLIB_LIB) $(OBJ1);
lib $(ZLIB_LIB) $(OBJ2);
example.exe: example.obj $(ZLIB_LIB)
$(LD) $(LDFLAGS) example.obj,,,$(ZLIB_LIB);
minigzip.exe: minigzip.obj $(ZLIB_LIB)
$(LD) $(LDFLAGS) minigzip.obj,,,$(ZLIB_LIB);
test: example.exe minigzip.exe
example
echo hello world | minigzip | minigzip -d
#clean:
# del *.obj
# del *.exe
|