• 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
19
20CC = cl
21LD = link
22AR = lib
23RC = rc
24CP = copy /y
25CFLAGS  = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC)
26WFLAGS  = \
27	-D_CRT_SECURE_NO_DEPRECATE \
28	-D_CRT_NONSTDC_NO_DEPRECATE \
29	-DUNALIGNED_OK \
30	-DUNALIGNED64_OK \
31	-D_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 \
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 =
41SUFFIX =
42
43OBJS = \
44	adler32.obj \
45	armfeature.obj \
46	chunkset.obj \
47	compare258.obj \
48	compress.obj \
49	crc32.obj \
50	deflate.obj \
51	deflate_fast.obj \
52	deflate_slow.obj \
53	deflate_quick.obj \
54	deflate_medium.obj \
55	functable.obj \
56	infback.obj \
57	inflate.obj \
58	inftrees.obj \
59	inffast.obj \
60	insert_string.obj \
61	trees.obj \
62	uncompr.obj \
63	zutil.obj \
64	#
65!if "$(WITH_GZFILEOP)" != ""
66WFLAGS = $(WFLAGS) -DWITH_GZFILEOP
67OBJS = $(OBJS) gzclose.obj gzlib.obj gzread.obj gzwrite.obj
68DEFFILE = zlibcompat.def
69!else
70STATICLIB = zlib-ng.lib
71SHAREDLIB = zlib-ng1.dll
72IMPLIB = zngdll.lib
73DEFFILE = zlib-ng.def
74RCFILE = zlib-ng1.rc
75RESFILE = zlib-ng1.res
76SUFFIX = -ng
77!endif
78WFLAGS = $(WFLAGS) \
79	-DARM_ACLE_CRC_HASH \
80	-D__ARM_NEON__=1 \
81	-DARM_NEON_ADLER32 \
82	-DARM_NEON_CHUNKSET \
83	-DARM_NEON_SLIDEHASH \
84	-DARM_NOCHECK_NEON \
85	#
86OBJS = $(OBJS) crc32_acle.obj insert_string_acle.obj adler32_neon.obj chunkset_neon.obj slide_neon.obj
87
88# targets
89all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
90     example.exe minigzip.exe example_d.exe minigzip_d.exe
91
92zconf: $(TOP)/zconf$(SUFFIX).h.in
93     $(CP) $(TOP)\zconf$(SUFFIX).h.in $(TOP)\zconf$(SUFFIX).h
94
95$(STATICLIB): zconf $(OBJS)
96	$(AR) $(ARFLAGS) -out:$@ $(OBJS)
97
98$(IMPLIB): $(SHAREDLIB)
99
100$(SHAREDLIB): zconf $(TOP)/win32/$(DEFFILE) $(OBJS) $(RESFILE)
101	$(LD) $(LDFLAGS) -def:$(TOP)/win32/$(DEFFILE) -dll -implib:$(IMPLIB) \
102	  -out:$@ -base:0x55A4C0000 $(OBJS) $(RESFILE)
103	if exist $@.manifest \
104	  mt -nologo -manifest $@.manifest -outputresource:$@;2
105
106example.exe: example.obj gzclose2.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB)
107	$(LD) $(LDFLAGS) example.obj gzclose2.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB)
108	if exist $@.manifest \
109	  mt -nologo -manifest $@.manifest -outputresource:$@;1
110
111minigzip.exe: minigzip.obj gzclose2.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB)
112	$(LD) $(LDFLAGS) minigzip.obj  gzclose2.obj gzlib2.obj gzread2.obj gzwrite2.obj $(STATICLIB)
113	if exist $@.manifest \
114	  mt -nologo -manifest $@.manifest -outputresource:$@;1
115
116example_d.exe: example.obj gzclose2.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB)
117	$(LD) $(LDFLAGS) -out:$@ example.obj  gzclose2.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB)
118	if exist $@.manifest \
119	  mt -nologo -manifest $@.manifest -outputresource:$@;1
120
121minigzip_d.exe: minigzip.obj gzclose2.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB)
122	$(LD) $(LDFLAGS) -out:$@ minigzip.obj  gzclose2.obj gzlib2.obj gzread2.obj gzwrite2.obj $(IMPLIB)
123	if exist $@.manifest \
124	  mt -nologo -manifest $@.manifest -outputresource:$@;1
125
126{$(TOP)}.c.obj:
127	$(CC) -c $(WFLAGS) $(CFLAGS) $<
128
129gzclose2.obj: gzclose.c
130	$(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzclose2.obj gzclose.c
131
132gzlib2.obj: gzlib.c
133	$(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzlib2.obj gzlib.c
134
135gzread2.obj: gzread.c
136	$(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzread2.obj gzread.c
137
138gzwrite2.obj: gzwrite.c
139	$(CC) -c $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP -Fogzwrite2.obj gzwrite.c
140
141{$(TOP)/arch/arm}.c.obj:
142	$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $<
143
144{$(TOP)/test}.c.obj:
145	$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) -DWITH_GZFILEOP $<
146
147$(TOP)/zconf$(SUFFIX).h: zconf
148
149SRCDIR = $(TOP)
150# Keep the dependences in sync with top-level Makefile.in
151adler32.obj: $(SRCDIR)/adler32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/functable.h $(SRCDIR)/adler32_p.h
152chunkset.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h
153functable.obj: $(SRCDIR)/functable.c $(SRCDIR)/zbuild.h $(SRCDIR)/functable.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/zendian.h $(SRCDIR)/arch/x86/x86.h
154gzclose.obj: $(SRCDIR)/gzclose.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h
155gzlib.obj: $(SRCDIR)/gzlib.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h
156gzread.obj: $(SRCDIR)/gzread.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h
157gzwrite.obj: $(SRCDIR)/gzwrite.c $(SRCDIR)/zbuild.h $(SRCDIR)/gzguts.h
158compress.obj: $(SRCDIR)/compress.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h
159uncompr.obj: $(SRCDIR)/uncompr.c $(SRCDIR)/zbuild.h $(SRCDIR)/zlib$(SUFFIX).h
160crc32.obj: $(SRCDIR)/crc32.c $(SRCDIR)/zbuild.h $(SRCDIR)/zendian.h $(SRCDIR)/deflate.h $(SRCDIR)/functable.h $(SRCDIR)/crc32_tbl.h
161deflate.obj: $(SRCDIR)/deflate.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
162deflate_quick.obj: $(SRCDIR)/deflate_quick.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h $(SRCDIR)/trees_emit.h
163deflate_fast.obj: $(SRCDIR)/deflate_fast.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
164deflate_medium.obj: $(SRCDIR)/deflate_medium.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
165deflate_slow.obj: $(SRCDIR)/deflate_slow.c $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/deflate_p.h $(SRCDIR)/functable.h
166infback.obj: $(SRCDIR)/infback.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h
167inffast.obj: $(SRCDIR)/inffast.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h $(SRCDIR)/inflate.h $(SRCDIR)/inffast.h $(SRCDIR)/functable.h
168inflate.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
169inftrees.obj: $(SRCDIR)/inftrees.c $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/inftrees.h
170trees.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/deflate.h $(SRCDIR)/trees_tbl.h
171zutil.obj: $(SRCDIR)/zbuild.h $(SRCDIR)/zutil.h $(SRCDIR)/gzguts.h
172
173example.obj: $(TOP)/test/example.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h
174
175minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zbuild.h $(TOP)/zlib$(SUFFIX).h
176
177$(RESFILE): $(TOP)/win32/$(RCFILE)
178	$(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/$(RCFILE)
179
180# testing
181test: example.exe minigzip.exe
182	example
183	echo hello world | minigzip | minigzip -d
184
185testdll: example_d.exe minigzip_d.exe
186	example_d
187	echo hello world | minigzip_d | minigzip_d -d
188
189
190# cleanup
191clean:
192	-del $(STATICLIB)
193	-del $(SHAREDLIB)
194	-del $(IMPLIB)
195	-del *.obj
196	-del *.res
197	-del *.exp
198	-del *.exe
199	-del *.pdb
200	-del *.manifest
201
202distclean: clean
203	-del zconf$(SUFFIX).h
204