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 -I." \
10 # OBJA="inffasx64.obj gvmat64.obj inffas8664.obj" (use ASM code, x64)
12 # The toplevel directory of the source tree.
16 # optional build flags
29 CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC)
30 WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
31 ASFLAGS = -coff -Zi $(LOC)
32 LDFLAGS = -nologo -debug -incremental:no -opt:ref
36 OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj \
37 gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj
42 all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
43 example.exe minigzip.exe example_d.exe minigzip_d.exe
45 $(STATICLIB): $(OBJS) $(OBJA)
46 $(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA)
48 $(IMPLIB): $(SHAREDLIB)
50 $(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) $(OBJA) zlib1.res
51 $(LD) $(LDFLAGS) -def:$(TOP)/win32/zlib.def -dll -implib:$(IMPLIB) \
52 -out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res
53 if exist $@.manifest \
54 mt -nologo -manifest $@.manifest -outputresource:$@;2
56 example.exe: example.obj $(STATICLIB)
57 $(LD) $(LDFLAGS) example.obj $(STATICLIB)
58 if exist $@.manifest \
59 mt -nologo -manifest $@.manifest -outputresource:$@;1
61 minigzip.exe: minigzip.obj $(STATICLIB)
62 $(LD) $(LDFLAGS) minigzip.obj $(STATICLIB)
63 if exist $@.manifest \
64 mt -nologo -manifest $@.manifest -outputresource:$@;1
66 example_d.exe: example.obj $(IMPLIB)
67 $(LD) $(LDFLAGS) -out:$@ example.obj $(IMPLIB)
68 if exist $@.manifest \
69 mt -nologo -manifest $@.manifest -outputresource:$@;1
71 minigzip_d.exe: minigzip.obj $(IMPLIB)
72 $(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB)
73 if exist $@.manifest \
74 mt -nologo -manifest $@.manifest -outputresource:$@;1
77 $(CC) -c $(WFLAGS) $(CFLAGS) $<
80 $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $<
82 {$(TOP)/contrib/masmx64}.c.obj:
83 $(CC) -c $(WFLAGS) $(CFLAGS) $<
85 {$(TOP)/contrib/masmx64}.asm.obj:
86 $(AS) -c $(ASFLAGS) $<
88 {$(TOP)/contrib/masmx86}.asm.obj:
89 $(AS) -c $(ASFLAGS) $<
91 adler32.obj: $(TOP)/adler32.c $(TOP)/zlib.h $(TOP)/zconf.h
93 compress.obj: $(TOP)/compress.c $(TOP)/zlib.h $(TOP)/zconf.h
95 crc32.obj: $(TOP)/crc32.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/crc32.h
97 deflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h
99 gzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
101 gzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
103 gzread.obj: $(TOP)/gzread.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
105 gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
107 infback.obj: $(TOP)/infback.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
108 $(TOP)/inffast.h $(TOP)/inffixed.h
110 inffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
113 inflate.obj: $(TOP)/inflate.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
114 $(TOP)/inffast.h $(TOP)/inffixed.h
116 inftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h
118 trees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/deflate.h $(TOP)/trees.h
120 uncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib.h $(TOP)/zconf.h
122 zutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h
124 gvmat64.obj: $(TOP)/contrib\masmx64\gvmat64.asm
126 inffasx64.obj: $(TOP)/contrib\masmx64\inffasx64.asm
128 inffas8664.obj: $(TOP)/contrib\masmx64\inffas8664.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h \
129 $(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inffast.h
131 inffas32.obj: $(TOP)/contrib\masmx86\inffas32.asm
133 match686.obj: $(TOP)/contrib\masmx86\match686.asm
135 example.obj: $(TOP)/test/example.c $(TOP)/zlib.h $(TOP)/zconf.h
137 minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib.h $(TOP)/zconf.h
139 zlib1.res: $(TOP)/win32/zlib1.rc
140 $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/zlib1.rc
143 test: example.exe minigzip.exe
145 echo hello world | minigzip | minigzip -d
147 testdll: example_d.exe minigzip_d.exe
149 echo hello world | minigzip_d | minigzip_d -d