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