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