1 # Makefile for zlib
   2 # Turbo C 2.01, Turbo C++ 1.01
   3 # Last updated: 15-Mar-2003
   4 
   5 # To use, do "make -fmakefile.tc"
   6 # To compile in small model, set below: MODEL=s
   7 
   8 # WARNING: the small model is supported but only for small values of
   9 # MAX_WBITS and MAX_MEM_LEVEL. For example:
  10 #    -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
  11 # If you wish to reduce the memory requirements (default 256K for big
  12 # objects plus a few K), you can add to CFLAGS below:
  13 #   -DMAX_MEM_LEVEL=7 -DMAX_WBITS=14
  14 # See zconf.h for details about the memory requirements.
  15 
  16 # ------------ Turbo C 2.01, Turbo C++ 1.01 ------------
  17 MODEL=l
  18 CC=tcc
  19 LD=tcc
  20 AR=tlib
  21 # CFLAGS=-O2 -G -Z -m$(MODEL) -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
  22 CFLAGS=-O2 -G -Z -m$(MODEL)
  23 LDFLAGS=-m$(MODEL) -f-
  24 
  25 
  26 # variables
  27 ZLIB_LIB = zlib_$(MODEL).lib
  28 
  29 OBJ1 = adler32.obj compress.obj crc32.obj deflate.obj gzclose.obj gzlib.obj gzread.obj
  30 OBJ2 = gzwrite.obj infback.obj inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj
  31 OBJP1 = +adler32.obj+compress.obj+crc32.obj+deflate.obj+gzclose.obj+gzlib.obj+gzread.obj
  32 OBJP2 = +gzwrite.obj+infback.obj+inffast.obj+inflate.obj+inftrees.obj+trees.obj+uncompr.obj+zutil.obj
  33 
  34 
  35 # targets
  36 all: $(ZLIB_LIB) example.exe minigzip.exe
  37 
  38 .c.obj:
  39         $(CC) -c $(CFLAGS) $*.c
  40 
  41 adler32.obj: adler32.c zlib.h zconf.h
  42 
  43 compress.obj: compress.c zlib.h zconf.h
  44 
  45 crc32.obj: crc32.c zlib.h zconf.h crc32.h
  46 
  47 deflate.obj: deflate.c deflate.h zutil.h zlib.h zconf.h
  48 
  49 gzclose.obj: gzclose.c zlib.h zconf.h gzguts.h
  50 
  51 gzlib.obj: gzlib.c zlib.h zconf.h gzguts.h
  52 
  53 gzread.obj: gzread.c zlib.h zconf.h gzguts.h
  54 
  55 gzwrite.obj: gzwrite.c zlib.h zconf.h gzguts.h
  56 
  57 infback.obj: infback.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
  58  inffast.h inffixed.h
  59 
  60 inffast.obj: inffast.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
  61  inffast.h
  62 
  63 inflate.obj: inflate.c zutil.h zlib.h zconf.h inftrees.h inflate.h \
  64  inffast.h inffixed.h
  65 
  66 inftrees.obj: inftrees.c zutil.h zlib.h zconf.h inftrees.h
  67 
  68 trees.obj: trees.c zutil.h zlib.h zconf.h deflate.h trees.h
  69 
  70 uncompr.obj: uncompr.c zlib.h zconf.h
  71 
  72 zutil.obj: zutil.c zutil.h zlib.h zconf.h
  73 
  74 example.obj: test/example.c zlib.h zconf.h
  75 
  76 minigzip.obj: test/minigzip.c zlib.h zconf.h
  77 
  78 
  79 # the command line is cut to fit in the MS-DOS 128 byte limit:
  80 $(ZLIB_LIB): $(OBJ1) $(OBJ2)
  81         -del $(ZLIB_LIB)
  82         $(AR) $(ZLIB_LIB) $(OBJP1)
  83         $(AR) $(ZLIB_LIB) $(OBJP2)
  84 
  85 example.exe: example.obj $(ZLIB_LIB)
  86         $(LD) $(LDFLAGS) example.obj $(ZLIB_LIB)
  87 
  88 minigzip.exe: minigzip.obj $(ZLIB_LIB)
  89         $(LD) $(LDFLAGS) minigzip.obj $(ZLIB_LIB)
  90 
  91 test: example.exe minigzip.exe
  92         example
  93         echo hello world | minigzip | minigzip -d
  94 
  95 clean:
  96         -del *.obj
  97         -del *.lib
  98         -del *.exe
  99         -del zlib_*.bak
 100         -del foo.gz