1275793eaSopenharmony_ci# Makefile for zlib using Microsoft (Visual) C
2275793eaSopenharmony_ci# zlib is copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
3275793eaSopenharmony_ci#
4275793eaSopenharmony_ci# Usage:
5275793eaSopenharmony_ci#   nmake -f win32/Makefile.msc                          (standard build)
6275793eaSopenharmony_ci#   nmake -f win32/Makefile.msc LOC=-DFOO                (nonstandard build)
7275793eaSopenharmony_ci
8275793eaSopenharmony_ci# The toplevel directory of the source tree.
9275793eaSopenharmony_ci#
10275793eaSopenharmony_ciTOP = .
11275793eaSopenharmony_ci
12275793eaSopenharmony_ci# optional build flags
13275793eaSopenharmony_ciLOC =
14275793eaSopenharmony_ci
15275793eaSopenharmony_ci# variables
16275793eaSopenharmony_ciSTATICLIB = zlib.lib
17275793eaSopenharmony_ciSHAREDLIB = zlib1.dll
18275793eaSopenharmony_ciIMPLIB    = zdll.lib
19275793eaSopenharmony_ci
20275793eaSopenharmony_ciCC = cl
21275793eaSopenharmony_ciAS = ml
22275793eaSopenharmony_ciLD = link
23275793eaSopenharmony_ciAR = lib
24275793eaSopenharmony_ciRC = rc
25275793eaSopenharmony_ciCFLAGS  = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC)
26275793eaSopenharmony_ciWFLAGS  = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
27275793eaSopenharmony_ciASFLAGS = -coff -Zi $(LOC)
28275793eaSopenharmony_ciLDFLAGS = -nologo -debug -incremental:no -opt:ref
29275793eaSopenharmony_ciARFLAGS = -nologo
30275793eaSopenharmony_ciRCFLAGS = /dWIN32 /r
31275793eaSopenharmony_ci
32275793eaSopenharmony_ciOBJS = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj \
33275793eaSopenharmony_ci       gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj
34275793eaSopenharmony_ciOBJA =
35275793eaSopenharmony_ci
36275793eaSopenharmony_ci
37275793eaSopenharmony_ci# targets
38275793eaSopenharmony_ciall: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
39275793eaSopenharmony_ci     example.exe minigzip.exe example_d.exe minigzip_d.exe
40275793eaSopenharmony_ci
41275793eaSopenharmony_ci$(STATICLIB): $(OBJS) $(OBJA)
42275793eaSopenharmony_ci	$(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA)
43275793eaSopenharmony_ci
44275793eaSopenharmony_ci$(IMPLIB): $(SHAREDLIB)
45275793eaSopenharmony_ci
46275793eaSopenharmony_ci$(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) $(OBJA) zlib1.res
47275793eaSopenharmony_ci	$(LD) $(LDFLAGS) -def:$(TOP)/win32/zlib.def -dll -implib:$(IMPLIB) \
48275793eaSopenharmony_ci	  -out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res
49275793eaSopenharmony_ci	if exist $@.manifest \
50275793eaSopenharmony_ci	  mt -nologo -manifest $@.manifest -outputresource:$@;2
51275793eaSopenharmony_ci
52275793eaSopenharmony_ciexample.exe: example.obj $(STATICLIB)
53275793eaSopenharmony_ci	$(LD) $(LDFLAGS) example.obj $(STATICLIB)
54275793eaSopenharmony_ci	if exist $@.manifest \
55275793eaSopenharmony_ci	  mt -nologo -manifest $@.manifest -outputresource:$@;1
56275793eaSopenharmony_ci
57275793eaSopenharmony_ciminigzip.exe: minigzip.obj $(STATICLIB)
58275793eaSopenharmony_ci	$(LD) $(LDFLAGS) minigzip.obj $(STATICLIB)
59275793eaSopenharmony_ci	if exist $@.manifest \
60275793eaSopenharmony_ci	  mt -nologo -manifest $@.manifest -outputresource:$@;1
61275793eaSopenharmony_ci
62275793eaSopenharmony_ciexample_d.exe: example.obj $(IMPLIB)
63275793eaSopenharmony_ci	$(LD) $(LDFLAGS) -out:$@ example.obj $(IMPLIB)
64275793eaSopenharmony_ci	if exist $@.manifest \
65275793eaSopenharmony_ci	  mt -nologo -manifest $@.manifest -outputresource:$@;1
66275793eaSopenharmony_ci
67275793eaSopenharmony_ciminigzip_d.exe: minigzip.obj $(IMPLIB)
68275793eaSopenharmony_ci	$(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB)
69275793eaSopenharmony_ci	if exist $@.manifest \
70275793eaSopenharmony_ci	  mt -nologo -manifest $@.manifest -outputresource:$@;1
71275793eaSopenharmony_ci
72275793eaSopenharmony_ci{$(TOP)}.c.obj:
73275793eaSopenharmony_ci	$(CC) -c $(WFLAGS) $(CFLAGS) $<
74275793eaSopenharmony_ci
75275793eaSopenharmony_ci{$(TOP)/test}.c.obj:
76275793eaSopenharmony_ci	$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $<
77275793eaSopenharmony_ci
78275793eaSopenharmony_ci{$(TOP)/contrib/masmx64}.c.obj:
79275793eaSopenharmony_ci	$(CC) -c $(WFLAGS) $(CFLAGS) $<
80275793eaSopenharmony_ci
81275793eaSopenharmony_ci{$(TOP)/contrib/masmx64}.asm.obj:
82275793eaSopenharmony_ci	$(AS) -c $(ASFLAGS) $<
83275793eaSopenharmony_ci
84275793eaSopenharmony_ci{$(TOP)/contrib/masmx86}.asm.obj:
85275793eaSopenharmony_ci	$(AS) -c $(ASFLAGS) $<
86275793eaSopenharmony_ci
87275793eaSopenharmony_ciadler32.obj: $(TOP)/adler32.c $(TOP)/zlib.h $(TOP)/zconf.h
88275793eaSopenharmony_ci
89275793eaSopenharmony_cicompress.obj: $(TOP)/compress.c $(TOP)/zlib.h $(TOP)/zconf.h
90275793eaSopenharmony_ci
91275793eaSopenharmony_cicrc32.obj: $(TOP)/crc32.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/crc32.h
92275793eaSopenharmony_ci
93275793eaSopenharmony_cideflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h
94275793eaSopenharmony_ci
95275793eaSopenharmony_cigzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
96275793eaSopenharmony_ci
97275793eaSopenharmony_cigzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
98275793eaSopenharmony_ci
99275793eaSopenharmony_cigzread.obj: $(TOP)/gzread.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
100275793eaSopenharmony_ci
101275793eaSopenharmony_cigzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
102275793eaSopenharmony_ci
103275793eaSopenharmony_ciinfback.obj: $(TOP)/infback.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
104275793eaSopenharmony_ci             $(TOP)/inffast.h $(TOP)/inffixed.h
105275793eaSopenharmony_ci
106275793eaSopenharmony_ciinffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
107275793eaSopenharmony_ci             $(TOP)/inffast.h
108275793eaSopenharmony_ci
109275793eaSopenharmony_ciinflate.obj: $(TOP)/inflate.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
110275793eaSopenharmony_ci             $(TOP)/inffast.h $(TOP)/inffixed.h
111275793eaSopenharmony_ci
112275793eaSopenharmony_ciinftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h
113275793eaSopenharmony_ci
114275793eaSopenharmony_citrees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/deflate.h $(TOP)/trees.h
115275793eaSopenharmony_ci
116275793eaSopenharmony_ciuncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib.h $(TOP)/zconf.h
117275793eaSopenharmony_ci
118275793eaSopenharmony_cizutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h
119275793eaSopenharmony_ci
120275793eaSopenharmony_cigvmat64.obj: $(TOP)/contrib\masmx64\gvmat64.asm
121275793eaSopenharmony_ci
122275793eaSopenharmony_ciinffasx64.obj: $(TOP)/contrib\masmx64\inffasx64.asm
123275793eaSopenharmony_ci
124275793eaSopenharmony_ciinffas8664.obj: $(TOP)/contrib\masmx64\inffas8664.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h \
125275793eaSopenharmony_ci		$(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inffast.h
126275793eaSopenharmony_ci
127275793eaSopenharmony_ciinffas32.obj: $(TOP)/contrib\masmx86\inffas32.asm
128275793eaSopenharmony_ci
129275793eaSopenharmony_cimatch686.obj: $(TOP)/contrib\masmx86\match686.asm
130275793eaSopenharmony_ci
131275793eaSopenharmony_ciexample.obj: $(TOP)/test/example.c $(TOP)/zlib.h $(TOP)/zconf.h
132275793eaSopenharmony_ci
133275793eaSopenharmony_ciminigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib.h $(TOP)/zconf.h
134275793eaSopenharmony_ci
135275793eaSopenharmony_cizlib1.res: $(TOP)/win32/zlib1.rc
136275793eaSopenharmony_ci	$(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/zlib1.rc
137275793eaSopenharmony_ci
138275793eaSopenharmony_ci# testing
139275793eaSopenharmony_citest: example.exe minigzip.exe
140275793eaSopenharmony_ci	example
141275793eaSopenharmony_ci	echo hello world | minigzip | minigzip -d
142275793eaSopenharmony_ci
143275793eaSopenharmony_citestdll: example_d.exe minigzip_d.exe
144275793eaSopenharmony_ci	example_d
145275793eaSopenharmony_ci	echo hello world | minigzip_d | minigzip_d -d
146275793eaSopenharmony_ci
147275793eaSopenharmony_ci
148275793eaSopenharmony_ci# cleanup
149275793eaSopenharmony_ciclean:
150275793eaSopenharmony_ci	-del $(STATICLIB)
151275793eaSopenharmony_ci	-del $(SHAREDLIB)
152275793eaSopenharmony_ci	-del $(IMPLIB)
153275793eaSopenharmony_ci	-del *.obj
154275793eaSopenharmony_ci	-del *.res
155275793eaSopenharmony_ci	-del *.exp
156275793eaSopenharmony_ci	-del *.exe
157275793eaSopenharmony_ci	-del *.pdb
158275793eaSopenharmony_ci	-del *.manifest
159275793eaSopenharmony_ci	-del foo.gz
160