1*44bedb31SLionel Sambuc# Makefile for zlib 2*44bedb31SLionel Sambuc# Microsoft C 5.1 or later 3*44bedb31SLionel Sambuc# Last updated: 19-Mar-2003 4*44bedb31SLionel Sambuc 5*44bedb31SLionel Sambuc# To use, do "make makefile.msc" 6*44bedb31SLionel Sambuc# To compile in small model, set below: MODEL=S 7*44bedb31SLionel Sambuc 8*44bedb31SLionel Sambuc# If you wish to reduce the memory requirements (default 256K for big 9*44bedb31SLionel Sambuc# objects plus a few K), you can add to the LOC macro below: 10*44bedb31SLionel Sambuc# -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 11*44bedb31SLionel Sambuc# See zconf.h for details about the memory requirements. 12*44bedb31SLionel Sambuc 13*44bedb31SLionel Sambuc# ------------- Microsoft C 5.1 and later ------------- 14*44bedb31SLionel Sambuc 15*44bedb31SLionel Sambuc# Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) 16*44bedb31SLionel Sambuc# should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added 17*44bedb31SLionel Sambuc# to the declaration of LOC here: 18*44bedb31SLionel SambucLOC = $(LOCAL_ZLIB) 19*44bedb31SLionel Sambuc 20*44bedb31SLionel Sambuc# Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. 21*44bedb31SLionel SambucCPU_TYP = 0 22*44bedb31SLionel Sambuc 23*44bedb31SLionel Sambuc# Memory model: one of S, M, C, L (small, medium, compact, large) 24*44bedb31SLionel SambucMODEL=L 25*44bedb31SLionel Sambuc 26*44bedb31SLionel SambucCC=cl 27*44bedb31SLionel SambucCFLAGS=-nologo -A$(MODEL) -G$(CPU_TYP) -W3 -Oait -Gs $(LOC) 28*44bedb31SLionel Sambuc#-Ox generates bad code with MSC 5.1 29*44bedb31SLionel SambucLIB_CFLAGS=-Zl $(CFLAGS) 30*44bedb31SLionel Sambuc 31*44bedb31SLionel SambucLD=link 32*44bedb31SLionel SambucLDFLAGS=/noi/e/st:0x1500/noe/farcall/packcode 33*44bedb31SLionel Sambuc# "/farcall/packcode" are only useful for `large code' memory models 34*44bedb31SLionel Sambuc# but should be a "no-op" for small code models. 35*44bedb31SLionel Sambuc 36*44bedb31SLionel Sambuc 37*44bedb31SLionel Sambuc# variables 38*44bedb31SLionel SambucZLIB_LIB = zlib_$(MODEL).lib 39*44bedb31SLionel Sambuc 40*44bedb31SLionel SambucOBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj 41*44bedb31SLionel SambucOBJ2 = inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj 42*44bedb31SLionel Sambuc 43*44bedb31SLionel Sambuc 44*44bedb31SLionel Sambuc# targets 45*44bedb31SLionel Sambucall: $(ZLIB_LIB) example.exe minigzip.exe 46*44bedb31SLionel Sambuc 47*44bedb31SLionel Sambuc.c.obj: 48*44bedb31SLionel Sambuc $(CC) -c $(LIB_CFLAGS) $*.c 49*44bedb31SLionel Sambuc 50*44bedb31SLionel Sambucadler32.obj: adler32.c zlib.h zconf.h 51*44bedb31SLionel Sambuc 52*44bedb31SLionel Sambuccompress.obj: compress.c zlib.h zconf.h 53*44bedb31SLionel Sambuc 54*44bedb31SLionel Sambuccrc32.obj: crc32.c zlib.h zconf.h crc32.h 55*44bedb31SLionel Sambuc 56*44bedb31SLionel Sambucdeflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h 57*44bedb31SLionel Sambuc 58*44bedb31SLionel Sambucgzio.obj: gzio.c zutil.h zlib.h zconf.h 59*44bedb31SLionel Sambuc 60*44bedb31SLionel Sambucinfback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 61*44bedb31SLionel Sambuc inffast.h inffixed.h 62*44bedb31SLionel Sambuc 63*44bedb31SLionel Sambucinffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 64*44bedb31SLionel Sambuc inffast.h 65*44bedb31SLionel Sambuc 66*44bedb31SLionel Sambucinflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ 67*44bedb31SLionel Sambuc inffast.h inffixed.h 68*44bedb31SLionel Sambuc 69*44bedb31SLionel Sambucinftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h 70*44bedb31SLionel Sambuc 71*44bedb31SLionel Sambuctrees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h 72*44bedb31SLionel Sambuc 73*44bedb31SLionel Sambucuncompr.obj: uncompr.c zlib.h zconf.h 74*44bedb31SLionel Sambuc 75*44bedb31SLionel Sambuczutil.obj: zutil.c zutil.h zlib.h zconf.h 76*44bedb31SLionel Sambuc 77*44bedb31SLionel Sambucexample.obj: example.c zlib.h zconf.h 78*44bedb31SLionel Sambuc $(CC) -c $(CFLAGS) $*.c 79*44bedb31SLionel Sambuc 80*44bedb31SLionel Sambucminigzip.obj: minigzip.c zlib.h zconf.h 81*44bedb31SLionel Sambuc $(CC) -c $(CFLAGS) $*.c 82*44bedb31SLionel Sambuc 83*44bedb31SLionel Sambuc 84*44bedb31SLionel Sambuc# the command line is cut to fit in the MS-DOS 128 byte limit: 85*44bedb31SLionel Sambuc$(ZLIB_LIB): $(OBJ1) $(OBJ2) 86*44bedb31SLionel Sambuc if exist $(ZLIB_LIB) del $(ZLIB_LIB) 87*44bedb31SLionel Sambuc lib $(ZLIB_LIB) $(OBJ1); 88*44bedb31SLionel Sambuc lib $(ZLIB_LIB) $(OBJ2); 89*44bedb31SLionel Sambuc 90*44bedb31SLionel Sambucexample.exe: example.obj $(ZLIB_LIB) 91*44bedb31SLionel Sambuc $(LD) $(LDFLAGS) example.obj,,,$(ZLIB_LIB); 92*44bedb31SLionel Sambuc 93*44bedb31SLionel Sambucminigzip.exe: minigzip.obj $(ZLIB_LIB) 94*44bedb31SLionel Sambuc $(LD) $(LDFLAGS) minigzip.obj,,,$(ZLIB_LIB); 95*44bedb31SLionel Sambuc 96*44bedb31SLionel Sambuctest: example.exe minigzip.exe 97*44bedb31SLionel Sambuc example 98*44bedb31SLionel Sambuc echo hello world | minigzip | minigzip -d 99*44bedb31SLionel Sambuc 100*44bedb31SLionel Sambucclean: 101*44bedb31SLionel Sambuc -del *.obj 102*44bedb31SLionel Sambuc -del *.lib 103*44bedb31SLionel Sambuc -del *.exe 104*44bedb31SLionel Sambuc -del *.map 105*44bedb31SLionel Sambuc -del zlib_*.bak 106*44bedb31SLionel Sambuc -del foo.gz 107