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
28CC=gcc
29
30#CFLAGS=-MMD -O
31#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
32#CFLAGS=-MMD -g -DDEBUG
33CFLAGS=-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" .
37CP=copy /Y
38# If gnu install.exe is available, replace $(CP) with ginstall.
39INSTALL=$(CP)
40# The default value of RM is "rm -f."  If "rm.exe" is found, comment out:
41RM=del
42LDLIBS=-L. -lz
43LD=$(CC) -s -o
44LDSHARED=$(CC)
45
46INCL=zlib.h zconf.h
47LIBS=libz.a
48
49AR=ar rcs
50
51prefix=/usr/local
52exec_prefix = $(prefix)
53
54OBJS = 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
57OBJA =
58# to use the asm code: make OBJA=match.o
59
60TEST_OBJS = example.o minigzip.o
61
62all: example.exe minigzip.exe
63
64check: test
65test: all
66	./example
67	echo hello world | .\minigzip | .\minigzip -d
68
69%.o : %.c
70	$(CC) $(CFLAGS) -c $< -o $@
71
72libz.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
82install: $(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
89uninstall:
90	$(RM) $(INCLUDE_PATH)\zlib.h
91	$(RM) $(INCLUDE_PATH)\zconf.h
92	$(RM) $(LIBRARY_PATH)\libz.a
93
94clean:
95	$(RM) *.d
96	$(RM) *.o
97	$(RM) *.exe
98	$(RM) libz.a
99	$(RM) foo.gz
100
101DEPS := $(wildcard *.d)
102ifneq ($(DEPS),)
103include $(DEPS)
104endif
105