1 # Makefile for zlib using Microsoft (Visual) C
2 # zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler
5 # nmake -f win32/Makefile.msc (standard build)
6 # nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build)
7 # nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" \
8 # OBJA="inffas32.obj match686.obj" (use ASM code, x86)
9 # nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF" \
10 # OBJA="inffasx64.obj gvmat64.obj inffas8664.c" (use ASM code, x64)
12 # optional build flags
25 CFLAGS = -nologo -MD -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
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 trees.obj uncompr.obj zutil.obj
38 all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
39 example.exe minigzip.exe example_d.exe minigzip_d.exe
41 $(STATICLIB): $(OBJS) $(OBJA)
42 $(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA)
44 $(IMPLIB): $(SHAREDLIB)
46 $(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlib1.res
47 $(LD) $(LDFLAGS) -def:win32/zlib.def -dll -implib:$(IMPLIB) \
48 -out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res
49 if exist $@.manifest \
50 mt -nologo -manifest $@.manifest -outputresource:$@;2
52 example.exe: example.obj $(STATICLIB)
53 $(LD) $(LDFLAGS) example.obj $(STATICLIB)
54 if exist $@.manifest \
55 mt -nologo -manifest $@.manifest -outputresource:$@;1
57 minigzip.exe: minigzip.obj $(STATICLIB)
58 $(LD) $(LDFLAGS) minigzip.obj $(STATICLIB)
59 if exist $@.manifest \
60 mt -nologo -manifest $@.manifest -outputresource:$@;1
62 example_d.exe: example.obj $(IMPLIB)
63 $(LD) $(LDFLAGS) -out:$@ example.obj $(IMPLIB)
64 if exist $@.manifest \
65 mt -nologo -manifest $@.manifest -outputresource:$@;1
67 minigzip_d.exe: minigzip.obj $(IMPLIB)
68 $(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB)
69 if exist $@.manifest \
70 mt -nologo -manifest $@.manifest -outputresource:$@;1
73 $(CC) -c $(WFLAGS) $(CFLAGS) $<
75 {contrib/masmx64}.c.obj:
76 $(CC) -c $(WFLAGS) $(CFLAGS) $<
78 {contrib/masmx64}.asm.obj:
79 $(AS) -c $(ASFLAGS) $<
81 {contrib/masmx86}.asm.obj:
82 $(AS) -c $(ASFLAGS) $<
84 adler32.obj: adler32.c zlib.h zconf.h
86 compress.obj: compress.c zlib.h zconf.h
88 crc32.obj: crc32.c zlib.h zconf.h crc32.h
90 deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
92 gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
94 gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
96 gzread.obj: gzread.c zlib.h zconf.h gzguts.h
98 gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
100 infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
103 inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
106 inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
109 inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
111 trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
113 uncompr.obj: uncompr.c zlib.h zconf.h
115 zutil.obj: zutil.c zutil.h zlib.h zconf.h
117 gvmat64.obj: contrib\masmx64\gvmat64.asm
119 inffasx64.obj: contrib\masmx64\inffasx64.asm
121 inffas8664.obj: contrib\masmx64\inffas8664.c zutil.h zlib.h zconf.h \
122 inftrees.h inflate.h inffast.h
124 inffas32.obj: contrib\masmx86\inffas32.asm
126 match686.obj: contrib\masmx86\match686.asm
128 example.obj: example.c zlib.h zconf.h
130 minigzip.obj: minigzip.c zlib.h zconf.h
132 zlib1.res: win32/zlib1.rc
133 $(RC) $(RCFLAGS) /fo$@ win32/zlib1.rc
137 test: example.exe minigzip.exe
139 echo hello world | minigzip | minigzip -d
141 testdll: example_d.exe minigzip_d.exe
143 echo hello world | minigzip_d | minigzip_d -d