| 1 | # Makefile for zlib. Modified for djgpp v2.0 by F. J. Donahoe, 3/15/96. |
| 2 | # Copyright (C) 1995-1998 Jean-loup Gailly. |
| 3 | # For conditions of distribution and use, see copyright notice in zlib.h |
| 4 | |
| 5 | # To compile, or to compile and test, type: |
| 6 | # |
| 7 | # make -fmakefile.dj2; make test -fmakefile.dj2 |
| 8 | # |
| 9 | # To install libz.a, zconf.h and zlib.h in the djgpp directories, type: |
| 10 | # |
| 11 | # make install -fmakefile.dj2 |
| 12 | # |
| 13 | # after first defining LIBRARY_PATH and INCLUDE_PATH in djgpp.env as |
| 14 | # in the sample below if the pattern of the DJGPP distribution is to |
| 15 | # be followed. Remember that, while <sp>'es around <=> are ignored in |
| 16 | # makefiles, they are *not* in batch files or in djgpp.env. |
| 17 | # - - - - - |
| 18 | # [make] |
| 19 | # INCLUDE_PATH=%\>;INCLUDE_PATH%%\DJDIR%\include |
| 20 | # LIBRARY_PATH=%\>;LIBRARY_PATH%%\DJDIR%\lib |
| 21 | # BUTT=-m486 |
| 22 | # - - - - - |
| 23 | # Alternately, these variables may be defined below, overriding the values |
| 24 | # in djgpp.env, as |
| 25 | # INCLUDE_PATH=c:\usr\include |
| 26 | # LIBRARY_PATH=c:\usr\lib |
| 27 | |
| 28 | CC=gcc |
| 29 | |
| 30 | #CFLAGS=-MMD -O |
| 31 | #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7 |
| 32 | #CFLAGS=-MMD -g -DZLIB_DEBUG |
| 33 | CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \ |
| 34 | -Wstrict-prototypes -Wmissing-prototypes |
| 35 | |
| 36 | # If cp.exe is available, replace "copy /Y" with "cp -fp" . |
| 37 | CP=copy /Y |
| 38 | # If gnu install.exe is available, replace $(CP) with ginstall. |
| 39 | INSTALL=$(CP) |
| 40 | # The default value of RM is "rm -f." If "rm.exe" is found, comment out: |
| 41 | RM=del |
| 42 | LDLIBS=-L. -lz |
| 43 | LD=$(CC) -s -o |
| 44 | LDSHARED=$(CC) |
| 45 | |
| 46 | INCL=zlib.h zconf.h |
| 47 | LIBS=libz.a |
| 48 | |
| 49 | AR=ar rcs |
| 50 | |
| 51 | prefix=/usr/local |
| 52 | exec_prefix = $(prefix) |
| 53 | |
| 54 | OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \ |
| 55 | uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o |
| 56 | |
| 57 | OBJA = |
| 58 | # to use the asm code: make OBJA=match.o |
| 59 | |
| 60 | TEST_OBJS = example.o minigzip.o |
| 61 | |
| 62 | all: example.exe minigzip.exe |
| 63 | |
| 64 | check: test |
| 65 | test: all |
| 66 | ./example |
| 67 | echo hello world | .\minigzip | .\minigzip -d |
| 68 | |
| 69 | %.o : %.c |
| 70 | $(CC) $(CFLAGS) -c $< -o $@ |
| 71 | |
| 72 | libz.a: $(OBJS) $(OBJA) |
| 73 | $(AR) $@ $(OBJS) $(OBJA) |
| 74 | |
| 75 | %.exe : %.o $(LIBS) |
| 76 | $(LD) $@ $< $(LDLIBS) |
| 77 | |
| 78 | # INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env . |
| 79 | |
| 80 | .PHONY : uninstall clean |
| 81 | |
| 82 | install: $(INCL) $(LIBS) |
| 83 | -@if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH) |
| 84 | -@if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH) |
| 85 | $(INSTALL) zlib.h $(INCLUDE_PATH) |
| 86 | $(INSTALL) zconf.h $(INCLUDE_PATH) |
| 87 | $(INSTALL) libz.a $(LIBRARY_PATH) |
| 88 | |
| 89 | uninstall: |
| 90 | $(RM) $(INCLUDE_PATH)\zlib.h |
| 91 | $(RM) $(INCLUDE_PATH)\zconf.h |
| 92 | $(RM) $(LIBRARY_PATH)\libz.a |
| 93 | |
| 94 | clean: |
| 95 | $(RM) *.d |
| 96 | $(RM) *.o |
| 97 | $(RM) *.exe |
| 98 | $(RM) libz.a |
| 99 | $(RM) foo.gz |
| 100 | |
| 101 | DEPS := $(wildcard *.d) |
| 102 | ifneq ($(DEPS),) |
| 103 | include $(DEPS) |
| 104 | endif |