2012-03-02 18:15:20 +01:00
|
|
|
# Makefile for zlib using Microsoft (Visual) C
|
2017-01-22 19:07:04 +01:00
|
|
|
# zlib is copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
|
2004-10-11 19:44:11 +02:00
|
|
|
#
|
|
|
|
# Usage:
|
2012-03-02 18:15:20 +01:00
|
|
|
# nmake -f win32/Makefile.msc (standard build)
|
|
|
|
# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build)
|
|
|
|
# nmake -f win32/Makefile.msc LOC="-DASMV -DASMINF" \
|
|
|
|
# OBJA="inffas32.obj match686.obj" (use ASM code, x86)
|
2012-11-16 19:35:05 +01:00
|
|
|
# nmake -f win32/Makefile.msc AS=ml64 LOC="-DASMV -DASMINF -I." \
|
|
|
|
# OBJA="inffasx64.obj gvmat64.obj inffas8664.obj" (use ASM code, x64)
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
# The toplevel directory of the source tree.
|
|
|
|
#
|
|
|
|
TOP = .
|
|
|
|
|
2004-10-11 19:44:11 +02:00
|
|
|
# optional build flags
|
|
|
|
LOC =
|
|
|
|
|
|
|
|
# variables
|
|
|
|
STATICLIB = zlib.lib
|
|
|
|
SHAREDLIB = zlib1.dll
|
|
|
|
IMPLIB = zdll.lib
|
|
|
|
|
|
|
|
CC = cl
|
|
|
|
AS = ml
|
|
|
|
LD = link
|
|
|
|
AR = lib
|
|
|
|
RC = rc
|
2012-03-02 18:15:20 +01:00
|
|
|
CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC)
|
|
|
|
WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
|
|
|
|
ASFLAGS = -coff -Zi $(LOC)
|
|
|
|
LDFLAGS = -nologo -debug -incremental:no -opt:ref
|
2004-10-11 19:44:11 +02:00
|
|
|
ARFLAGS = -nologo
|
|
|
|
RCFLAGS = /dWIN32 /r
|
|
|
|
|
2012-03-02 18:15:20 +01:00
|
|
|
OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj \
|
2012-11-16 19:35:05 +01:00
|
|
|
gzwrite.obj infback.obj inflate.obj inftrees.obj inffast.obj trees.obj uncompr.obj zutil.obj
|
2004-10-11 19:44:11 +02:00
|
|
|
OBJA =
|
|
|
|
|
|
|
|
|
|
|
|
# targets
|
|
|
|
all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
|
|
|
|
example.exe minigzip.exe example_d.exe minigzip_d.exe
|
|
|
|
|
|
|
|
$(STATICLIB): $(OBJS) $(OBJA)
|
|
|
|
$(AR) $(ARFLAGS) -out:$@ $(OBJS) $(OBJA)
|
|
|
|
|
|
|
|
$(IMPLIB): $(SHAREDLIB)
|
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
$(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) $(OBJA) zlib1.res
|
|
|
|
$(LD) $(LDFLAGS) -def:$(TOP)/win32/zlib.def -dll -implib:$(IMPLIB) \
|
2012-03-02 18:15:20 +01:00
|
|
|
-out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res
|
|
|
|
if exist $@.manifest \
|
|
|
|
mt -nologo -manifest $@.manifest -outputresource:$@;2
|
2004-10-11 19:44:11 +02:00
|
|
|
|
|
|
|
example.exe: example.obj $(STATICLIB)
|
|
|
|
$(LD) $(LDFLAGS) example.obj $(STATICLIB)
|
2012-03-02 18:15:20 +01:00
|
|
|
if exist $@.manifest \
|
|
|
|
mt -nologo -manifest $@.manifest -outputresource:$@;1
|
2004-10-11 19:44:11 +02:00
|
|
|
|
|
|
|
minigzip.exe: minigzip.obj $(STATICLIB)
|
|
|
|
$(LD) $(LDFLAGS) minigzip.obj $(STATICLIB)
|
2012-03-02 18:15:20 +01:00
|
|
|
if exist $@.manifest \
|
|
|
|
mt -nologo -manifest $@.manifest -outputresource:$@;1
|
2004-10-11 19:44:11 +02:00
|
|
|
|
|
|
|
example_d.exe: example.obj $(IMPLIB)
|
|
|
|
$(LD) $(LDFLAGS) -out:$@ example.obj $(IMPLIB)
|
2012-03-02 18:15:20 +01:00
|
|
|
if exist $@.manifest \
|
|
|
|
mt -nologo -manifest $@.manifest -outputresource:$@;1
|
2004-10-11 19:44:11 +02:00
|
|
|
|
|
|
|
minigzip_d.exe: minigzip.obj $(IMPLIB)
|
|
|
|
$(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB)
|
2012-03-02 18:15:20 +01:00
|
|
|
if exist $@.manifest \
|
|
|
|
mt -nologo -manifest $@.manifest -outputresource:$@;1
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
{$(TOP)}.c.obj:
|
2012-03-02 18:15:20 +01:00
|
|
|
$(CC) -c $(WFLAGS) $(CFLAGS) $<
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
{$(TOP)/test}.c.obj:
|
|
|
|
$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $<
|
2012-11-16 19:35:05 +01:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
{$(TOP)/contrib/masmx64}.c.obj:
|
2012-03-02 18:15:20 +01:00
|
|
|
$(CC) -c $(WFLAGS) $(CFLAGS) $<
|
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
{$(TOP)/contrib/masmx64}.asm.obj:
|
2012-03-02 18:15:20 +01:00
|
|
|
$(AS) -c $(ASFLAGS) $<
|
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
{$(TOP)/contrib/masmx86}.asm.obj:
|
2004-10-11 19:44:11 +02:00
|
|
|
$(AS) -c $(ASFLAGS) $<
|
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
adler32.obj: $(TOP)/adler32.c $(TOP)/zlib.h $(TOP)/zconf.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
compress.obj: $(TOP)/compress.c $(TOP)/zlib.h $(TOP)/zconf.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
crc32.obj: $(TOP)/crc32.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/crc32.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
deflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h
|
2012-03-02 18:15:20 +01:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
gzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
|
2012-03-02 18:15:20 +01:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
gzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
|
2012-03-02 18:15:20 +01:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
gzread.obj: $(TOP)/gzread.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
infback.obj: $(TOP)/infback.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
|
|
|
|
$(TOP)/inffast.h $(TOP)/inffixed.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
inffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
|
|
|
|
$(TOP)/inffast.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
inflate.obj: $(TOP)/inflate.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
|
|
|
|
$(TOP)/inffast.h $(TOP)/inffixed.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
inftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
trees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/deflate.h $(TOP)/trees.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
uncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib.h $(TOP)/zconf.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
zutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h
|
2012-03-02 18:15:20 +01:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
gvmat64.obj: $(TOP)/contrib\masmx64\gvmat64.asm
|
2012-03-02 18:15:20 +01:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
inffasx64.obj: $(TOP)/contrib\masmx64\inffasx64.asm
|
2012-03-02 18:15:20 +01:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
inffas8664.obj: $(TOP)/contrib\masmx64\inffas8664.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h \
|
|
|
|
$(TOP)/inftrees.h $(TOP)/inflate.h $(TOP)/inffast.h
|
2012-03-02 18:15:20 +01:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
inffas32.obj: $(TOP)/contrib\masmx86\inffas32.asm
|
2012-03-02 18:15:20 +01:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
match686.obj: $(TOP)/contrib\masmx86\match686.asm
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
example.obj: $(TOP)/test/example.c $(TOP)/zlib.h $(TOP)/zconf.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib.h $(TOP)/zconf.h
|
2004-10-11 19:44:11 +02:00
|
|
|
|
2015-11-23 21:27:57 +01:00
|
|
|
zlib1.res: $(TOP)/win32/zlib1.rc
|
|
|
|
$(RC) $(RCFLAGS) /fo$@ $(TOP)/win32/zlib1.rc
|
2004-10-11 19:44:11 +02:00
|
|
|
|
|
|
|
# testing
|
|
|
|
test: example.exe minigzip.exe
|
|
|
|
example
|
|
|
|
echo hello world | minigzip | minigzip -d
|
|
|
|
|
|
|
|
testdll: example_d.exe minigzip_d.exe
|
|
|
|
example_d
|
|
|
|
echo hello world | minigzip_d | minigzip_d -d
|
|
|
|
|
|
|
|
|
|
|
|
# cleanup
|
|
|
|
clean:
|
|
|
|
-del $(STATICLIB)
|
|
|
|
-del $(SHAREDLIB)
|
|
|
|
-del $(IMPLIB)
|
|
|
|
-del *.obj
|
|
|
|
-del *.res
|
|
|
|
-del *.exp
|
|
|
|
-del *.exe
|
2012-03-02 18:15:20 +01:00
|
|
|
-del *.pdb
|
|
|
|
-del *.manifest
|
2004-10-11 19:44:11 +02:00
|
|
|
-del foo.gz
|