|
1
|
# Makefile for zlib using Microsoft (Visual) C |
|
2
|
# zlib is copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler |
|
3
|
# |
|
4
|
# Usage: |
|
5
|
# nmake -f win32/Makefile.msc (standard build) |
|
6
|
# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build) |
|
7
|
|
|
8
|
# The toplevel directory of the source tree. |
|
9
|
# |
|
10
|
TOP = . |
|
11
|
|
|
12
|
# optional build flags |
|
13
|
LOC = |
|
14
|
|
|
15
|
# variables |
|
16
|
STATICLIB = zlib.lib |
|
17
|
SHAREDLIB = zlib1.dll |
|
18
|
IMPLIB = zdll.lib |
|
19
|
|
|
20
|
CC = cl |
|
21
|
AS = ml |
|
22
|
LD = link |
|
23
|
AR = lib |
|
24
|
RC = rc |
|
25
|
CFLAGS = -nologo -MT -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC) |
|
26
|
WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE |
|
27
|
ASFLAGS = -coff -Zi $(LOC) |
|
28
|
LDFLAGS = -nologo -debug -incremental:no -opt:ref |
|
29
|
ARFLAGS = -nologo |
|
30
|
RCFLAGS = /dWIN32 /r |
|
31
|
|
|
32
|
OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj \ |
|
33
|
gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj |
|
34
|
OBJA = |
|
35
|
|
|
36
|
|
|
37
|
# targets |
|
38
|
all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \ |
|
39
|
example.exe minigzip.exe example_d.exe minigzip_d.exe |
|
40
|
|
|
41
|
$(STATICLIB): $(OBJS) $(OBJA) |
|
42
|
$(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA) |
|
43
|
|
|
44
|
$(IMPLIB): $(SHAREDLIB) |
|
45
|
|
|
46
|
$(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) $(OBJA) zlib1.res |
|
47
|
$(LD) $(LDFLAGS) -def:$(TOP)/win32/zlib.def -dll -implib:$(IMPLIB) \ |
|
48
|
-out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res |
|
49
|
if exist [email protected] \ |
|
50
|
mt -nologo -manifest [email protected] -outputresource:$@;2 |
|
51
|
|
|
52
|
example.exe: example.obj $(STATICLIB) |
|
53
|
$(LD) $(LDFLAGS) example.obj $(STATICLIB) |
|
54
|
if exist [email protected] \ |
|
55
|
mt -nologo -manifest [email protected] -outputresource:$@;1 |
|
56
|
|
|
57
|
minigzip.exe: minigzip.obj $(STATICLIB) |
|
58
|
$(LD) $(LDFLAGS) minigzip.obj $(STATICLIB) |
|
59
|
if exist [email protected] \ |
|
60
|
mt -nologo -manifest [email protected] -outputresource:$@;1 |
|
61
|
|
|
62
|
example_d.exe: example.obj $(IMPLIB) |
|
63
|
$(LD) $(LDFLAGS) -out:$@ example.obj $(IMPLIB) |
|
64
|
if exist [email protected] \ |
|
65
|
mt -nologo -manifest [email protected] -outputresource:$@;1 |
|
66
|
|
|
67
|
minigzip_d.exe: minigzip.obj $(IMPLIB) |
|
68
|
$(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB) |
|
69
|
if exist [email protected] \ |
|
70
|
mt -nologo -manifest [email protected] -outputresource:$@;1 |
|
71
|
|
|
72
|
{$(TOP)}.c.obj: |
|
73
|
$(CC) -c $(WFLAGS) $(CFLAGS) $< |
|
74
|
|
|
75
|
{$(TOP)/test}.c.obj: |
|
76
|
$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< |
|
77
|
|
|
78
|
{$(TOP)/contrib/masmx64}.c.obj: |
|
79
|
$(CC) -c $(WFLAGS) $(CFLAGS) $< |
|
80
|
|
|
81
|
{$(TOP)/contrib/masmx64}.asm.obj: |
|
82
|
$(AS) -c $(ASFLAGS) $< |
|
83
|
|
|
84
|
{$(TOP)/contrib/masmx86}.asm.obj: |
|
85
|
$(AS) -c $(ASFLAGS) $< |
|
86
|
|
|
87
|
adler32.obj: $(TOP)/adler32.c $(TOP)/zlib.h $(TOP)/zconf.h |
|
88
|
|
|
89
|
compress.obj: $(TOP)/compress.c $(TOP)/zlib.h $(TOP)/zconf.h |
|
90
|
|
|
91
|
crc32.obj: $(TOP)/crc32.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/crc32.h |
|
92
|
|
|
93
|
deflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h |
|
94
|
|
|
95
|
gzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h |
|
96
|
|
|
97
|
gzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h |
|
98
|
|
|
99
|
gzread.obj: $(TOP)/gzread.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h |
|
100
|
|
|
101
|
gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h |
|
102
|
|
|
103
|
infback.obj: $(TOP)/infback.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ |
|
104
|
$(TOP)/inffast.h $(TOP)/inffixed.h |
|
105
|
|
|
106
|
inffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ |
|
107
|
$(TOP)/inffast.h |
|
108
|
|
|
109
|
inflate.obj: $(TOP)/inflate.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ |
|
110
|
$(TOP)/inffast.h $(TOP)/inffixed.h |
|
111
|
|
|
112
|
inftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h |
|
113
|
|
|
114
|
trees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/deflate.h $(TOP)/trees.h |
|
115
|
|
|
116
|
uncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib.h $(TOP)/zconf.h |
|
117
|
|
|
118
|
zutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h |
|
119
|
|
|
120
|
gvmat64.obj: $(TOP)/contrib\masmx64\gvmat64.asm |
|
121
|
|
|
122
|
inffasx64.obj: $(TOP)/contrib\masmx64\inffasx64.asm |
|
123
|
|
|
124
|
inffas8664.obj: $(TOP)/contrib\masmx64\inffas8664.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h \ |
|
125
|
$(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inffast.h |
|
126
|
|
|
127
|
inffas32.obj: $(TOP)/contrib\masmx86\inffas32.asm |
|
128
|
|
|
129
|
match686.obj: $(TOP)/contrib\masmx86\match686.asm |
|
130
|
|
|
131
|
example.obj: $(TOP)/test/example.c $(TOP)/zlib.h $(TOP)/zconf.h |
|
132
|
|
|
133
|
minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib.h $(TOP)/zconf.h |
|
134
|
|
|
135
|
zlib1.res: $(TOP)/win32/zlib1.rc |
|
136
|
$(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/zlib1.rc |
|
137
|
|
|
138
|
# testing |
|
139
|
test: example.exe minigzip.exe |
|
140
|
example |
|
141
|
echo hello world | minigzip | minigzip -d |
|
142
|
|
|
143
|
testdll: example_d.exe minigzip_d.exe |
|
144
|
example_d |
|
145
|
echo hello world | minigzip_d | minigzip_d -d |
|
146
|
|
|
147
|
|
|
148
|
# cleanup |
|
149
|
clean: |
|
150
|
-del $(STATICLIB) |
|
151
|
-del $(SHAREDLIB) |
|
152
|
-del $(IMPLIB) |
|
153
|
-del *.obj |
|
154
|
-del *.res |
|
155
|
-del *.exp |
|
156
|
-del *.exe |
|
157
|
-del *.pdb |
|
158
|
-del *.manifest |
|
159
|
-del foo.gz |
|
160
|
|