kusano fc6ab3
# Makefile for zlib.  Modified for djgpp v2.0 by F. J. Donahoe, 3/15/96.
kusano fc6ab3
# Copyright (C) 1995-1998 Jean-loup Gailly.
kusano fc6ab3
# For conditions of distribution and use, see copyright notice in zlib.h
kusano fc6ab3
kusano fc6ab3
# To compile, or to compile and test, type:
kusano fc6ab3
#
kusano fc6ab3
#   make -fmakefile.dj2;  make test -fmakefile.dj2
kusano fc6ab3
#
kusano fc6ab3
# To install libz.a, zconf.h and zlib.h in the djgpp directories, type:
kusano fc6ab3
#
kusano fc6ab3
#    make install -fmakefile.dj2
kusano fc6ab3
#
kusano fc6ab3
# after first defining LIBRARY_PATH and INCLUDE_PATH in djgpp.env as
kusano fc6ab3
# in the sample below if the pattern of the DJGPP distribution is to
kusano fc6ab3
# be followed.  Remember that, while <sp>'es around <=> are ignored in</sp>
kusano fc6ab3
# makefiles, they are *not* in batch files or in djgpp.env.
kusano fc6ab3
# - - - - -
kusano fc6ab3
# [make]
kusano fc6ab3
# INCLUDE_PATH=%\>;INCLUDE_PATH%%\DJDIR%\include
kusano fc6ab3
# LIBRARY_PATH=%\>;LIBRARY_PATH%%\DJDIR%\lib
kusano fc6ab3
# BUTT=-m486
kusano fc6ab3
# - - - - -
kusano fc6ab3
# Alternately, these variables may be defined below, overriding the values
kusano fc6ab3
# in djgpp.env, as
kusano fc6ab3
# INCLUDE_PATH=c:\usr\include
kusano fc6ab3
# LIBRARY_PATH=c:\usr\lib
kusano fc6ab3
kusano fc6ab3
CC=gcc
kusano fc6ab3
kusano fc6ab3
#CFLAGS=-MMD -O
kusano fc6ab3
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
kusano fc6ab3
#CFLAGS=-MMD -g -DDEBUG
kusano fc6ab3
CFLAGS=-MMD -O3 $(BUTT) -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
kusano fc6ab3
             -Wstrict-prototypes -Wmissing-prototypes
kusano fc6ab3
kusano fc6ab3
# If cp.exe is available, replace "copy /Y" with "cp -fp" .
kusano fc6ab3
CP=copy /Y
kusano fc6ab3
# If gnu install.exe is available, replace $(CP) with ginstall.
kusano fc6ab3
INSTALL=$(CP)
kusano fc6ab3
# The default value of RM is "rm -f."  If "rm.exe" is found, comment out:
kusano fc6ab3
RM=del
kusano fc6ab3
LDLIBS=-L. -lz
kusano fc6ab3
LD=$(CC) -s -o
kusano fc6ab3
LDSHARED=$(CC)
kusano fc6ab3
kusano fc6ab3
INCL=zlib.h zconf.h
kusano fc6ab3
LIBS=libz.a
kusano fc6ab3
kusano fc6ab3
AR=ar rcs
kusano fc6ab3
kusano fc6ab3
prefix=/usr/local
kusano fc6ab3
exec_prefix = $(prefix)
kusano fc6ab3
kusano fc6ab3
OBJS = adler32.o compress.o crc32.o gzclose.o gzlib.o gzread.o gzwrite.o \
kusano fc6ab3
       uncompr.o deflate.o trees.o zutil.o inflate.o infback.o inftrees.o inffast.o
kusano fc6ab3
kusano fc6ab3
OBJA =
kusano fc6ab3
# to use the asm code: make OBJA=match.o
kusano fc6ab3
kusano fc6ab3
TEST_OBJS = example.o minigzip.o
kusano fc6ab3
kusano fc6ab3
all: example.exe minigzip.exe
kusano fc6ab3
kusano fc6ab3
check: test
kusano fc6ab3
test: all
kusano fc6ab3
	./example
kusano fc6ab3
	echo hello world | .\minigzip | .\minigzip -d
kusano fc6ab3
kusano fc6ab3
%.o : %.c
kusano fc6ab3
	$(CC) $(CFLAGS) -c $< -o $@
kusano fc6ab3
kusano fc6ab3
libz.a: $(OBJS) $(OBJA)
kusano fc6ab3
	$(AR) $@ $(OBJS) $(OBJA)
kusano fc6ab3
kusano fc6ab3
%.exe : %.o $(LIBS)
kusano fc6ab3
	$(LD) $@ $< $(LDLIBS)
kusano fc6ab3
kusano fc6ab3
# INCLUDE_PATH and LIBRARY_PATH were set for [make] in djgpp.env .
kusano fc6ab3
kusano fc6ab3
.PHONY : uninstall clean
kusano fc6ab3
kusano fc6ab3
install: $(INCL) $(LIBS)
kusano fc6ab3
	-@if not exist $(INCLUDE_PATH)\nul mkdir $(INCLUDE_PATH)
kusano fc6ab3
	-@if not exist $(LIBRARY_PATH)\nul mkdir $(LIBRARY_PATH)
kusano fc6ab3
	$(INSTALL) zlib.h $(INCLUDE_PATH)
kusano fc6ab3
	$(INSTALL) zconf.h $(INCLUDE_PATH)
kusano fc6ab3
	$(INSTALL) libz.a $(LIBRARY_PATH)
kusano fc6ab3
kusano fc6ab3
uninstall:
kusano fc6ab3
	$(RM) $(INCLUDE_PATH)\zlib.h
kusano fc6ab3
	$(RM) $(INCLUDE_PATH)\zconf.h
kusano fc6ab3
	$(RM) $(LIBRARY_PATH)\libz.a
kusano fc6ab3
kusano fc6ab3
clean:
kusano fc6ab3
	$(RM) *.d
kusano fc6ab3
	$(RM) *.o
kusano fc6ab3
	$(RM) *.exe
kusano fc6ab3
	$(RM) libz.a
kusano fc6ab3
	$(RM) foo.gz
kusano fc6ab3
kusano fc6ab3
DEPS := $(wildcard *.d)
kusano fc6ab3
ifneq ($(DEPS),)
kusano fc6ab3
include $(DEPS)
kusano fc6ab3
endif