• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Makefile for zlib using Microsoft (Visual) C
2# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler
3#
4# Usage:
5#   nmake -f win32/Makefile.a64                          (standard build)
6#   nmake -f win32/Makefile.a64 LOC=-DFOO                (nonstandard build)
7
8# The toplevel directory of the source tree.
9#
10TOP = .
11
12# optional build flags
13LOC =
14
15# variables
16STATICLIB = zlib.lib
17SHAREDLIB = zlib1.dll
18IMPLIB    = zdll.lib
19SYMBOL_PREFIX =
20
21CC = cl
22LD = link
23AR = lib
24RC = rc
25CP = copy /y
26CFLAGS  = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC)
27WFLAGS  = \
28	-D_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 \
29	-D_CRT_SECURE_NO_DEPRECATE \
30	-D_CRT_NONSTDC_NO_DEPRECATE \
31	-DARM_NEON_HASLD4 \
32	-DARM_FEATURES \
33	#
34LDFLAGS = -nologo -debug -incremental:no -opt:ref -manifest
35ARFLAGS = -nologo
36RCFLAGS = /dARM64 /r
37DEFFILE = zlib.def
38RCFILE = zlib1.rc
39RESFILE = zlib1.res
40WITH_GZFILEOP = yes
41ZLIB_COMPAT =
42SUFFIX =
43
44OBJS = \
45	adler32.obj \
46	adler32_fold.obj \
47	arm_features.obj \
48	chunkset.obj \
49	compare256.obj \
50	compress.obj \
51	cpu_features.obj \
52	crc32_braid.obj \
53	crc32_braid_comb.obj \
54	crc32_fold.obj \
55	deflate.obj \
56	deflate_fast.obj \
57	deflate_huff.obj \
58	deflate_quick.obj \
59	deflate_medium.obj \
60	deflate_rle.obj \
61	deflate_slow.obj \
62	deflate_stored.obj \
63	functable.obj \
64	infback.obj \
65	inflate.obj \
66	inftrees.obj \
67	inffast.obj \
68	insert_string.obj \
69	insert_string_roll.obj \
70	slide_hash.obj \
71	trees.obj \
72	uncompr.obj \
73	zutil.obj \
74	#
75!if "$(ZLIB_COMPAT)" != ""
76WITH_GZFILEOP = yes
77WFLAGS = $(WFLAGS) -DZLIB_COMPAT
78DEFFILE = zlibcompat.def
79!else
80STATICLIB = zlib-ng.lib
81SHAREDLIB = zlib-ng1.dll
82IMPLIB = zngdll.lib
83DEFFILE = zlib-ng.def
84RCFILE = zlib-ng1.rc
85RESFILE = zlib-ng1.res
86SUFFIX = -ng
87!endif
88
89!if "$(WITH_GZFILEOP)" != ""
90WFLAGS = $(WFLAGS) -DWITH_GZFILEOP
91OBJS = $(OBJS) gzlib.obj gzread.obj gzwrite.obj
92!endif
93
94WFLAGS = $(WFLAGS) \
95	-DARM_ACLE_CRC_HASH \
96	-D__ARM_NEON__=1 \
97	-DARM_NEON \
98	-DARM_NEON_ADLER32 \
99	-DARM_NEON_CHUNKSET \
100	-DARM_NEON_SLIDEHASH \
101	-DARM_NOCHECK_NEON \
102	#
103OBJS = $(OBJS) crc32_acle.obj insert_string_acle.obj adler32_neon.obj chunkset_neon.obj compare256_neon.obj slide_hash_neon.obj
104
105# targets
106all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
107     example.exe minigzip.exe example_d.exe minigzip_d.exe
108
109!if "$(SYMBOL_PREFIX)" != ""
110zlib_name_mangling$(SUFFIX).h: zlib_name_mangling$(SUFFIX).h.in
111	cscript $(TOP)\win32\replace.vbs $(TOP)\zlib_name_mangling$(SUFFIX).h.in zlib_name_mangling$(SUFFIX).h "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
112!else
113zlib_name_mangling$(SUFFIX).h: zlib_name_mangling.h.empty
114	$(CP) $(TOP)\zlib_name_mangling.h.empty zlib_name_mangling$(SUFFIX).h
115!endif
116
117zlib$(SUFFIX).h: zlib$(SUFFIX).h.in
118	cscript $(TOP)\win32\replace.vbs $(TOP)\zlib$(SUFFIX).h.in zlib$(SUFFIX).h "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
119
120gzread.c: gzread.c.in
121	cscript $(TOP)\win32\replace.vbs $(TOP)\gzread.c.in gzread.c "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
122
123zconf: $(TOP)/zconf$(SUFFIX).h.in $(TOP)/zlib$(SUFFIX).h $(TOP)/zlib_name_mangling$(SUFFIX).h
124	$(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h
125
126$(TOP)/win32/$(DEFFILE): $(TOP)/win32/$(DEFFILE).in
127	cscript $(TOP)\win32\replace.vbs $(TOP)/win32/$(DEFFILE).in $(TOP)/win32/$(DEFFILE) "@ZLIB_SYMBOL_PREFIX@" "$(SYMBOL_PREFIX)"
128
129$(STATICLIB): zconf $(OBJS)
130	$(AR) $(ARFLAGS) -out:$@ $(OBJS)
131
132$(IMPLIB): $(SHAREDLIB)
133
134$(SHAREDLIB): zconf $(TOP)/win32/$(DEFFILE) $(OBJS) $(RESFILE)
135	$(LD) $(LDFLAGS) -def:$(TOP)/win32/$(DEFFILE) -dll -implib:$(IMPLIB) \
136	  -out:$@ -base:0x55A4C0000 $(OBJS) $(RESFILE)
137	if exist $@.manifest \
138	  mt -nologo -manifest $@.manifest -outputresource:$@;2
139
140example.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB)
141	$(LD) $(LDFLAGS) example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB)
142	if exist $@.manifest \
143	  mt -nologo -manifest $@.manifest -outputresource:$@;1
144
145minigzip.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB)
146	$(LD) $(LDFLAGS) minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB)
147	if exist $@.manifest \
148	  mt -nologo -manifest $@.manifest -outputresource:$@;1
149
150example_d.exe: example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB)
151	$(LD) $(LDFLAGS) -out:$@ example.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB)
152	if exist $@.manifest \
153	  mt -nologo -manifest $@.manifest -outputresource:$@;1
154
155minigzip_d.exe: minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB)
156	$(LD) $(LDFLAGS) -out:$@ minigzip.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB)
157	if exist $@.manifest \
158	  mt -nologo -manifest $@.manifest -outputresource:$@;1
159
160{$(TOP)}.c.obj:
161	$(CC) -c $(WFLAGS) $(CFLAGS) $<
162
163gzlib2.obj: gzlib.c
164	$(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzlib2.obj gzlib.c
165
166gzread2.obj: gzread.c
167	$(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzread2.obj gzread.c
168
169gzwrite2.obj: gzwrite.c
170	$(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzwrite2.obj gzwrite.c
171
172{$(TOP)/arch/arm}.c.obj:
173	$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $<
174
175{$(TOP)/test}.c.obj:
176	$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP $<
177
178$(TOP)/zconf$(SUFFIX).h: zconf
179
180SRCDIR = $(TOP)
181# Keep the dependences in sync with top-level Makefile.in
182adler32.obj: $(SRCDIR)/adler32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/functable.h $(SRCDIR)/adler32_p.h
183adler32_fold.obj: $(SRCDIR)/adler32_fold.c $(SRCDIR)/zbuild.h $(SRCDIR)/adler32_fold.h $(SRCDIR)/functable.h
184chunkset.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h
185functable.obj: $(SRCDIR)/functable.c $(SRCDIR)/zbuild.h $(SRCDIR)/functable.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/zendian.h $(SRCDIR)/arch/x86/x86_features.h
186gzlib.obj: $(SRCDIR)/gzlib.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h
187gzread.obj: $(SRCDIR)/gzread.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h
188gzwrite.obj: $(SRCDIR)/gzwrite.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h $(SRCDIR)/zutil_p.h
189compress.obj: $(SRCDIR)/compress.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h
190uncompr.obj: $(SRCDIR)/uncompr.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h
191cpu_features.obj: $(SRCDIR)/cpu_features.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h
192crc32_braid.obj: $(SRCDIR)/crc32_braid.c $(SRCDIR)/zbuild.h $(SRCDIR)/zendian.h $(SRCDIR)/deflate.h $(SRCDIR)/functable.h $(SRCDIR)/crc32_braid_p.h $(SRCDIR)/crc32_braid_tbl.h
193crc32_braid_comb.obj: $(SRCDIR)/crc32_braid_comb.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/crc32_braid_p.h $(SRCDIR)/crc32_braid_tbl.h $(SRCDIR)/crc32_braid_comb_p.h
194crc32_fold.obj: $(SRCDIR)/crc32_fold.c $(SRCDIR)/zbuild.h
195deflate.obj: $(SRCDIR)/deflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
196deflate_fast.obj: $(SRCDIR)/deflate_fast.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
197deflate_huff.obj: $(SRCDIR)/deflate_huff.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
198deflate_quick.obj: $(SRCDIR)/deflate_quick.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/trees_emit.h
199deflate_medium.obj: $(SRCDIR)/deflate_medium.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
200deflate_rle.obj: $(SRCDIR)/deflate_rle.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
201deflate_slow.obj: $(SRCDIR)/deflate_slow.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
202deflate_stored.obj: $(SRCDIR)/deflate_stored.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
203infback.obj: $(SRCDIR)/infback.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h
204inffast.obj: $(SRCDIR)/inffast.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h
205inflate.obj: $(SRCDIR)/inflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h $(SRCDIR)/functable.h
206inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h
207slide_hash.obj: $(SRCDIR)/slide_hash.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h
208slide_hash_neon.obj: $(SRCDIR)/arch/arm/slide_hash_neon.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h
209trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h
210zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/zutil_p.h
211
212example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h
213
214minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h
215
216$(RESFILE): $(TOP)/win32/$(RCFILE)
217	$(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE)
218
219# testing
220test: example.exe minigzip.exe
221	example
222	echo hello world | minigzip | minigzip -d
223
224testdll: example_d.exe minigzip_d.exe
225	example_d
226	echo hello world | minigzip_d | minigzip_d -d
227
228
229# cleanup
230clean:
231	-del $(STATICLIB)
232	-del $(SHAREDLIB)
233	-del $(IMPLIB)
234	-del *.obj
235	-del *.res
236	-del *.exp
237	-del *.exe
238	-del *.pdb
239	-del *.manifest
240
241distclean: clean
242	-del zconf$(SUFFIX).h
243	-del zlib$(SUFFIX).h
244	-del zlib_name_mangling$(SUFFIX).h
245	-del $(TOP)\win32\zlib.def
246	-del $(TOP)\win32\zlibcompat.def
247	-del $(TOP)\win32\zlib-ng.def
248	-del gzread.c
249