Chris@43: # Makefile for zlib Chris@43: # Microsoft C 5.1 or later Chris@43: # Last updated: 19-Mar-2003 Chris@43: Chris@43: # To use, do "make makefile.msc" Chris@43: # To compile in small model, set below: MODEL=S Chris@43: Chris@43: # If you wish to reduce the memory requirements (default 256K for big Chris@43: # objects plus a few K), you can add to the LOC macro below: Chris@43: # -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14 Chris@43: # See zconf.h for details about the memory requirements. Chris@43: Chris@43: # ------------- Microsoft C 5.1 and later ------------- Chris@43: Chris@43: # Optional nonstandard preprocessor flags (e.g. -DMAX_MEM_LEVEL=7) Chris@43: # should be added to the environment via "set LOCAL_ZLIB=-DFOO" or added Chris@43: # to the declaration of LOC here: Chris@43: LOC = $(LOCAL_ZLIB) Chris@43: Chris@43: # Type for CPU required: 0: 8086, 1: 80186, 2: 80286, 3: 80386, etc. Chris@43: CPU_TYP = 0 Chris@43: Chris@43: # Memory model: one of S, M, C, L (small, medium, compact, large) Chris@43: MODEL=L Chris@43: Chris@43: CC=cl Chris@43: CFLAGS=-nologo -A$(MODEL) -G$(CPU_TYP) -W3 -Oait -Gs $(LOC) Chris@43: #-Ox generates bad code with MSC 5.1 Chris@43: LIB_CFLAGS=-Zl $(CFLAGS) Chris@43: Chris@43: LD=link Chris@43: LDFLAGS=/noi/e/st:0x1500/noe/farcall/packcode Chris@43: # "/farcall/packcode" are only useful for `large code' memory models Chris@43: # but should be a "no-op" for small code models. Chris@43: Chris@43: Chris@43: # variables Chris@43: ZLIB_LIB = zlib_$(MODEL).lib Chris@43: Chris@43: OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj Chris@43: OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj Chris@43: Chris@43: Chris@43: # targets Chris@43: all: $(ZLIB_LIB) example.exe minigzip.exe Chris@43: Chris@43: .c.obj: Chris@43: $(CC) -c $(LIB_CFLAGS) $*.c Chris@43: Chris@43: adler32.obj: adler32.c zlib.h zconf.h Chris@43: Chris@43: compress.obj: compress.c zlib.h zconf.h Chris@43: Chris@43: crc32.obj: crc32.c zlib.h zconf.h crc32.h Chris@43: Chris@43: deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h Chris@43: Chris@43: gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h Chris@43: Chris@43: gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h Chris@43: Chris@43: gzread.obj: gzread.c zlib.h zconf.h gzguts.h Chris@43: Chris@43: gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h Chris@43: Chris@43: infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ Chris@43: inffast.h inffixed.h Chris@43: Chris@43: inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ Chris@43: inffast.h Chris@43: Chris@43: inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \ Chris@43: inffast.h inffixed.h Chris@43: Chris@43: inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h Chris@43: Chris@43: trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h Chris@43: Chris@43: uncompr.obj: uncompr.c zlib.h zconf.h Chris@43: Chris@43: zutil.obj: zutil.c zutil.h zlib.h zconf.h Chris@43: Chris@43: example.obj: test/example.c zlib.h zconf.h Chris@43: $(CC) -c $(CFLAGS) $*.c Chris@43: Chris@43: minigzip.obj: test/minigzip.c zlib.h zconf.h Chris@43: $(CC) -c $(CFLAGS) $*.c Chris@43: Chris@43: Chris@43: # the command line is cut to fit in the MS-DOS 128 byte limit: Chris@43: $(ZLIB_LIB): $(OBJ1) $(OBJ2) Chris@43: if exist $(ZLIB_LIB) del $(ZLIB_LIB) Chris@43: lib $(ZLIB_LIB) $(OBJ1); Chris@43: lib $(ZLIB_LIB) $(OBJ2); Chris@43: Chris@43: example.exe: example.obj $(ZLIB_LIB) Chris@43: $(LD) $(LDFLAGS) example.obj,,,$(ZLIB_LIB); Chris@43: Chris@43: minigzip.exe: minigzip.obj $(ZLIB_LIB) Chris@43: $(LD) $(LDFLAGS) minigzip.obj,,,$(ZLIB_LIB); Chris@43: Chris@43: test: example.exe minigzip.exe Chris@43: example Chris@43: echo hello world | minigzip | minigzip -d Chris@43: Chris@43: clean: Chris@43: -del *.obj Chris@43: -del *.lib Chris@43: -del *.exe Chris@43: -del *.map Chris@43: -del zlib_*.bak Chris@43: -del foo.gz