zlib/win32/Makefile.msc

140 lines
3.4 KiB
Makefile
Raw Normal View History

2011-09-10 02:25:27 -04:00
# Makefile for zlib using Microsoft (Visual) C
# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler
2011-09-10 02:22:37 -04:00
#
# Usage:
# nmake -f win32/Makefile.msc (standard build)
# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build)
# nmake -f win32/Makefile.msc LOC=-DASMV OBJA=match.obj (use ASM code)
# optional build flags
LOC =
# variables
STATICLIB = zlib.lib
SHAREDLIB = zlib1.dll
IMPLIB = zdll.lib
CC = cl
AS = ml
LD = link
AR = lib
RC = rc
2011-09-10 02:32:36 -04:00
CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC)
2011-09-10 02:25:27 -04:00
WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE
2011-09-10 02:32:36 -04:00
ASFLAGS = -coff -Zi
LDFLAGS = -nologo -debug -incremental:no -opt:ref
2011-09-10 02:22:37 -04:00
ARFLAGS = -nologo
RCFLAGS = /dWIN32 /r
2011-09-10 02:27:26 -04:00
OBJS = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj \
2011-09-10 02:26:49 -04:00
gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
2011-09-10 02:22:37 -04: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)
$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlib1.res
$(LD) $(LDFLAGS) -def:win32/zlib.def -dll -implib:$(IMPLIB) \
2011-09-10 02:32:36 -04:00
-out:$@ -base:0x5A4C0000 $(OBJS) $(OBJA) zlib1.res
2011-09-10 02:25:27 -04:00
if exist $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;2
2011-09-10 02:22:37 -04:00
example.exe: example.obj $(STATICLIB)
$(LD) $(LDFLAGS) example.obj $(STATICLIB)
2011-09-10 02:25:27 -04:00
if exist $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;1
2011-09-10 02:22:37 -04:00
minigzip.exe: minigzip.obj $(STATICLIB)
$(LD) $(LDFLAGS) minigzip.obj $(STATICLIB)
2011-09-10 02:25:27 -04:00
if exist $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;1
2011-09-10 02:22:37 -04:00
example_d.exe: example.obj $(IMPLIB)
$(LD) $(LDFLAGS) -out:$@ example.obj $(IMPLIB)
2011-09-10 02:25:27 -04:00
if exist $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;1
2011-09-10 02:22:37 -04:00
minigzip_d.exe: minigzip.obj $(IMPLIB)
$(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB)
2011-09-10 02:25:27 -04:00
if exist $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;1
2011-09-10 02:22:37 -04:00
.c.obj:
2011-09-10 02:25:27 -04:00
$(CC) -c $(WFLAGS) $(CFLAGS) $<
2011-09-10 02:22:37 -04:00
.asm.obj:
$(AS) -c $(ASFLAGS) $<
adler32.obj: adler32.c zlib.h zconf.h
compress.obj: compress.c zlib.h zconf.h
crc32.obj: crc32.c zlib.h zconf.h crc32.h
deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
2011-09-10 02:26:49 -04:00
gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
gzread.obj: gzread.c zlib.h zconf.h gzguts.h
gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
2011-09-10 02:22:37 -04:00
infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
inffast.h inffixed.h
inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
inffast.h
inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
inffast.h inffixed.h
inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
uncompr.obj: uncompr.c zlib.h zconf.h
zutil.obj: zutil.c zutil.h zlib.h zconf.h
example.obj: example.c zlib.h zconf.h
minigzip.obj: minigzip.c zlib.h zconf.h
zlib1.res: win32/zlib1.rc
$(RC) $(RCFLAGS) /fo$@ win32/zlib1.rc
# 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
2011-09-10 02:25:27 -04:00
-del *.pdb
-del *.manifest
2011-09-10 02:22:37 -04:00
-del foo.gz