ClickHouse/contrib/libzlib-ng/win32/Makefile.msc
2017-01-08 21:26:03 +03:00

155 lines
4.6 KiB
Makefile

# Makefile for zlib using Microsoft (Visual) C
# zlib is copyright (C) 1995-2006 Jean-loup Gailly and Mark Adler
#
# Usage:
# nmake -f win32/Makefile.msc (standard build)
# nmake -f win32/Makefile.msc LOC=-DFOO (nonstandard build)
# The toplevel directory of the source tree.
#
TOP = .
# optional build flags
LOC =
# variables
STATICLIB = zlib.lib
SHAREDLIB = zlib1.dll
IMPLIB = zdll.lib
CC = cl
LD = link
AR = lib
RC = rc
CP = copy /y
CFLAGS = -nologo -MD -W3 -O2 -Oy- -Zi -Fd"zlib" $(LOC)
WFLAGS = -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -DX86_PCLMULQDQ_CRC -DX86_SSE2_FILL_WINDOW -DX86_CPUID -DX86_SSE4_2_CRC_HASH -DUNALIGNED_OK -DUNROLL_LESS -DX86_QUICK_STRATEGY
LDFLAGS = -nologo -debug -incremental:no -opt:ref -manifest
ARFLAGS = -nologo
RCFLAGS = /dWIN32 /r
DEFFILE = zlib.def
WITH_GZFILEOP =
OBJS = adler32.obj compress.obj crc32.obj deflate.obj deflate_fast.obj deflate_quick.obj deflate_slow.obj \
infback.obj inflate.obj inftrees.obj inffast.obj match.obj trees.obj uncompr.obj zutil.obj x86.obj fill_window_sse.obj insert_string_sse.obj crc_folding.obj
!if "$(WITH_GZFILEOP)" != ""
WFLAGS = $(WFLAGS) -DWITH_GZFILEOP
OBJS = $(OBJS) gzclose.obj gzlib.obj gzread.obj gzwrite.obj
DEFFILE = zlibcompat.def
!endif
# targets
all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) \
example.exe minigzip.exe example_d.exe minigzip_d.exe
$(STATICLIB): $(OBJS)
$(AR) $(ARFLAGS) -out:$@ $(OBJS)
$(IMPLIB): $(SHAREDLIB)
$(SHAREDLIB): $(TOP)/win32/zlib.def $(OBJS) zlib1.res
$(LD) $(LDFLAGS) -def:$(TOP)/win32/$(DEFFILE) -dll -implib:$(IMPLIB) \
-out:$@ -base:0x5A4C0000 $(OBJS) zlib1.res
if exist $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;2
example.exe: example.obj $(STATICLIB)
$(LD) $(LDFLAGS) example.obj $(STATICLIB)
if exist $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;1
minigzip.exe: minigzip.obj $(STATICLIB)
$(LD) $(LDFLAGS) minigzip.obj $(STATICLIB)
if exist $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;1
example_d.exe: example.obj $(IMPLIB)
$(LD) $(LDFLAGS) -out:$@ example.obj $(IMPLIB)
if exist $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;1
minigzip_d.exe: minigzip.obj $(IMPLIB)
$(LD) $(LDFLAGS) -out:$@ minigzip.obj $(IMPLIB)
if exist $@.manifest \
mt -nologo -manifest $@.manifest -outputresource:$@;1
{$(TOP)}.c.obj:
$(CC) -c $(WFLAGS) $(CFLAGS) $<
{$(TOP)/arch/x86}.c.obj:
$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $<
{$(TOP)/test}.c.obj:
$(CC) -c -I$(TOP) $(WFLAGS) $(CFLAGS) $<
$(TOP)/zconf.h: $(TOP)/zconf.h.in
$(CP) $(TOP)\zconf.h.in $(TOP)\zconf.h
adler32.obj: $(TOP)/adler32.c $(TOP)/zlib.h $(TOP)/zconf.h
compress.obj: $(TOP)/compress.c $(TOP)/zlib.h $(TOP)/zconf.h
crc32.obj: $(TOP)/crc32.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/crc32.h
deflate.obj: $(TOP)/deflate.c $(TOP)/deflate.h $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h
gzclose.obj: $(TOP)/gzclose.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
gzlib.obj: $(TOP)/gzlib.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
gzread.obj: $(TOP)/gzread.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
gzwrite.obj: $(TOP)/gzwrite.c $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/gzguts.h
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
inffast.obj: $(TOP)/inffast.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h $(TOP)/inflate.h \
$(TOP)/inffast.h
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
inftrees.obj: $(TOP)/inftrees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/inftrees.h
match.obj: $(TOP)/match.c $(TOP)/deflate.h
trees.obj: $(TOP)/trees.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h $(TOP)/deflate.h $(TOP)/trees.h
uncompr.obj: $(TOP)/uncompr.c $(TOP)/zlib.h $(TOP)/zconf.h
zutil.obj: $(TOP)/zutil.c $(TOP)/zutil.h $(TOP)/zlib.h $(TOP)/zconf.h
example.obj: $(TOP)/test/example.c $(TOP)/zlib.h $(TOP)/zconf.h
minigzip.obj: $(TOP)/test/minigzip.c $(TOP)/zlib.h $(TOP)/zconf.h
zlib1.res: $(TOP)/win32/zlib1.rc
$(RC) $(RCFLAGS) /fo$@ $(TOP)/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
-del *.pdb
-del *.manifest
-del foo.gz
distclean: clean
-del zconf.h