| 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 -DDEBUG | 
|---|
| 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 gzio.o uncompr.o deflate.o trees.o \ | 
|---|
| 55 | zutil.o inflate.o infblock.o inftrees.o infcodes.o infutil.o inffast.o | 
|---|
| 56 |  | 
|---|
| 57 | TEST_OBJS = example.o minigzip.o | 
|---|
| 58 |  | 
|---|
| 59 | all: example.exe minigzip.exe | 
|---|
| 60 |  | 
|---|
| 61 | test: all | 
|---|
| 62 | ./example | 
|---|
| 63 | echo hello world | .\minigzip | .\minigzip -d | 
|---|
| 64 |  | 
|---|
| 65 | %.o : %.c | 
|---|
| 66 | $(CC) $(CFLAGS) -c $< -o $@ | 
|---|
| 67 |  | 
|---|
| 68 | libz.a: $(OBJS) | 
|---|
| 69 | $(AR) $@ $(OBJS) | 
|---|
| 70 |  | 
|---|
| 71 | %.exe : %.o $(LIBS) | 
|---|
| 72 | $(LD) $@ $< $(LDLIBS) | 
|---|
| 73 |  | 
|---|
| 74 | # INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env . | 
|---|
| 75 |  | 
|---|
| 76 | .PHONY : uninstall clean | 
|---|
| 77 |  | 
|---|
| 78 | install: $(INCL) $(LIBS) | 
|---|
| 79 | -@if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH) | 
|---|
| 80 | -@if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH) | 
|---|
| 81 | $(INSTALL) zlib.h $(INCLUDE_PATH) | 
|---|
| 82 | $(INSTALL) zconf.h $(INCLUDE_PATH) | 
|---|
| 83 | $(INSTALL) libz.a $(LIBRARY_PATH) | 
|---|
| 84 |  | 
|---|
| 85 | uninstall: | 
|---|
| 86 | $(RM) $(INCLUDE_PATH)\zlib.h | 
|---|
| 87 | $(RM) $(INCLUDE_PATH)\zconf.h | 
|---|
| 88 | $(RM) $(LIBRARY_PATH)\libz.a | 
|---|
| 89 |  | 
|---|
| 90 | clean: | 
|---|
| 91 | $(RM) *.d | 
|---|
| 92 | $(RM) *.o | 
|---|
| 93 | $(RM) *.exe | 
|---|
| 94 | $(RM) libz.a | 
|---|
| 95 | $(RM) foo.gz | 
|---|
| 96 |  | 
|---|
| 97 | DEPS := $(wildcard *.d) | 
|---|
| 98 | ifneq ($(DEPS),) | 
|---|
| 99 | include $(DEPS) | 
|---|
| 100 | endif | 
|---|