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