Commit | Line | Data |
---|---|---|
5ca28f79 L |
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.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) | |
11 | ||
da09a436 JB |
12 | # The toplevel directory of the source tree. |
13 | # | |
14 | TOP = . | |
15 | ||
5ca28f79 L |
16 | # optional build flags |
17 | LOC = | |
18 | ||
19 | # variables | |
20 | STATICLIB = zlib.lib | |
21 | SHAREDLIB = zlib1.dll | |
22 | IMPLIB = zdll.lib | |
23 | ||
24 | CC = cl | |
25 | AS = ml | |
26 | LD = link | |
27 | AR = lib | |
28 | RC = rc | |
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 | |
33 | ARFLAGS = -nologo | |
34 | RCFLAGS = /dWIN32 /r | |
35 | ||
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 | |
38 | OBJA = | |
39 | ||
40 | ||
41 | # targets | |
42 | all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \ | |
43 | example.exe minigzip.exe example_d.exe minigzip_d.exe | |
44 | ||
45 | $(STATICLIB): $(OBJS) $(OBJA) | |
46 | $(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA) | |
47 | ||
48 | $(IMPLIB): $(SHAREDLIB) | |
49 | ||
da09a436 JB |
50 | $(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) $(OBJA) zlib1.res |
51 | $(LD) $(LDFLAGS) -def:$(TOP)/win32/zlib.def -dll -implib:$(IMPLIB) \ | |
5ca28f79 L |
52 | -out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res |
53 | if exist $@.manifest \ | |
54 | mt -nologo -manifest $@.manifest -outputresource:$@;2 | |
55 | ||
56 | example.exe: example.obj $(STATICLIB) | |
57 | $(LD) $(LDFLAGS) example.obj $(STATICLIB) | |
58 | if exist $@.manifest \ | |
59 | mt -nologo -manifest $@.manifest -outputresource:$@;1 | |
60 | ||
61 | minigzip.exe: minigzip.obj $(STATICLIB) | |
62 | $(LD) $(LDFLAGS) minigzip.obj $(STATICLIB) | |
63 | if exist $@.manifest \ | |
64 | mt -nologo -manifest $@.manifest -outputresource:$@;1 | |
65 | ||
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 | |
70 | ||
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 | |
75 | ||
da09a436 | 76 | {$(TOP)}.c.obj: |
5ca28f79 L |
77 | $(CC) -c $(WFLAGS) $(CFLAGS) $< |
78 | ||
da09a436 JB |
79 | {$(TOP)/test}.c.obj: |
80 | $(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $< | |
5ca28f79 | 81 | |
da09a436 | 82 | {$(TOP)/contrib/masmx64}.c.obj: |
5ca28f79 L |
83 | $(CC) -c $(WFLAGS) $(CFLAGS) $< |
84 | ||
da09a436 | 85 | {$(TOP)/contrib/masmx64}.asm.obj: |
5ca28f79 L |
86 | $(AS) -c $(ASFLAGS) $< |
87 | ||
da09a436 | 88 | {$(TOP)/contrib/masmx86}.asm.obj: |
5ca28f79 L |
89 | $(AS) -c $(ASFLAGS) $< |
90 | ||
da09a436 | 91 | adler32.obj: $(TOP)/adler32.c $(TOP)/zlib.h $(TOP)/zconf.h |
5ca28f79 | 92 | |
da09a436 | 93 | compress.obj: $(TOP)/compress.c $(TOP)/zlib.h $(TOP)/zconf.h |
5ca28f79 | 94 | |
da09a436 | 95 | crc32.obj: $(TOP)/crc32.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/crc32.h |
5ca28f79 | 96 | |
da09a436 | 97 | deflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h |
5ca28f79 | 98 | |
da09a436 | 99 | gzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h |
5ca28f79 | 100 | |
da09a436 | 101 | gzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h |
5ca28f79 | 102 | |
da09a436 | 103 | gzread.obj: $(TOP)/gzread.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h |
5ca28f79 | 104 | |
da09a436 | 105 | gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h |
5ca28f79 | 106 | |
da09a436 JB |
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 | |
5ca28f79 | 109 | |
da09a436 JB |
110 | inffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \ |
111 | $(TOP)/inffast.h | |
5ca28f79 | 112 | |
da09a436 JB |
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 | |
5ca28f79 | 115 | |
da09a436 | 116 | inftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h |
5ca28f79 | 117 | |
da09a436 | 118 | trees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/deflate.h $(TOP)/trees.h |
5ca28f79 | 119 | |
da09a436 | 120 | uncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib.h $(TOP)/zconf.h |
5ca28f79 | 121 | |
da09a436 | 122 | zutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h |
5ca28f79 | 123 | |
da09a436 | 124 | gvmat64.obj: $(TOP)/contrib\masmx64\gvmat64.asm |
5ca28f79 | 125 | |
da09a436 | 126 | inffasx64.obj: $(TOP)/contrib\masmx64\inffasx64.asm |
5ca28f79 | 127 | |
da09a436 JB |
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 | |
5ca28f79 | 130 | |
da09a436 | 131 | inffas32.obj: $(TOP)/contrib\masmx86\inffas32.asm |
5ca28f79 | 132 | |
da09a436 | 133 | match686.obj: $(TOP)/contrib\masmx86\match686.asm |
5ca28f79 | 134 | |
da09a436 | 135 | example.obj: $(TOP)/test/example.c $(TOP)/zlib.h $(TOP)/zconf.h |
5ca28f79 | 136 | |
da09a436 | 137 | minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib.h $(TOP)/zconf.h |
5ca28f79 | 138 | |
da09a436 JB |
139 | zlib1.res: $(TOP)/win32/zlib1.rc |
140 | $(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/zlib1.rc | |
5ca28f79 L |
141 | |
142 | # testing | |
143 | test: example.exe minigzip.exe | |
144 | example | |
145 | echo hello world | minigzip | minigzip -d | |
146 | ||
147 | testdll: example_d.exe minigzip_d.exe | |
148 | example_d | |
149 | echo hello world | minigzip_d | minigzip_d -d | |
150 | ||
151 | ||
152 | # cleanup | |
153 | clean: | |
154 | -del $(STATICLIB) | |
155 | -del $(SHAREDLIB) | |
156 | -del $(IMPLIB) | |
157 | -del *.obj | |
158 | -del *.res | |
159 | -del *.exp | |
160 | -del *.exe | |
161 | -del *.pdb | |
162 | -del *.manifest | |
163 | -del foo.gz |