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