kusano 7d535a
# Makefile for zlib, derived from Makefile.dj2.
kusano 7d535a
# Modified for mingw32 by C. Spieler, 6/16/98.
kusano 7d535a
# Updated for zlib 1.2.x by Christian Spieler and Cosmin Truta, Mar-2003.
kusano 7d535a
# Last updated: Mar 2012.
kusano 7d535a
# Tested under Cygwin and MinGW.
kusano 7d535a
kusano 7d535a
# Copyright (C) 1995-2003 Jean-loup Gailly.
kusano 7d535a
# For conditions of distribution and use, see copyright notice in zlib.h
kusano 7d535a
kusano 7d535a
# To compile, or to compile and test, type from the top level zlib directory:
kusano 7d535a
#
kusano 7d535a
#   make -fwin32/Makefile.gcc;  make test testdll -fwin32/Makefile.gcc
kusano 7d535a
#
kusano 7d535a
# To use the asm code, type:
kusano 7d535a
#   cp contrib/asm?86/match.S ./match.S
kusano 7d535a
#   make LOC=-DASMV OBJA=match.o -fwin32/Makefile.gcc
kusano 7d535a
#
kusano 7d535a
# To install libz.a, zconf.h and zlib.h in the system directories, type:
kusano 7d535a
#
kusano 7d535a
#   make install -fwin32/Makefile.gcc
kusano 7d535a
#
kusano 7d535a
# BINARY_PATH, INCLUDE_PATH and LIBRARY_PATH must be set.
kusano 7d535a
#
kusano 7d535a
# To install the shared lib, append SHARED_MODE=1 to the make command :
kusano 7d535a
#
kusano 7d535a
#   make install -fwin32/Makefile.gcc SHARED_MODE=1
kusano 7d535a
kusano 7d535a
# Note:
kusano 7d535a
# If the platform is *not* MinGW (e.g. it is Cygwin or UWIN),
kusano 7d535a
# the DLL name should be changed from "zlib1.dll".
kusano 7d535a
kusano 7d535a
STATICLIB = libz.a
kusano 7d535a
SHAREDLIB = zlib1.dll
kusano 7d535a
IMPLIB    = libz.dll.a
kusano 7d535a
kusano 7d535a
#
kusano 7d535a
# Set to 1 if shared object needs to be installed
kusano 7d535a
#
kusano 7d535a
SHARED_MODE=0
kusano 7d535a
kusano 7d535a
#LOC = -DASMV
kusano 7d535a
#LOC = -DDEBUG -g
kusano 7d535a
kusano 7d535a
PREFIX =
kusano 7d535a
CC = $(PREFIX)gcc
kusano 7d535a
CFLAGS = $(LOC) -O3 -Wall
kusano 7d535a
kusano 7d535a
AS = $(CC)
kusano 7d535a
ASFLAGS = $(LOC) -Wall
kusano 7d535a
kusano 7d535a
LD = $(CC)
kusano 7d535a
LDFLAGS = $(LOC)
kusano 7d535a
kusano 7d535a
AR = $(PREFIX)ar
kusano 7d535a
ARFLAGS = rcs
kusano 7d535a
kusano 7d535a
RC = $(PREFIX)windres
kusano 7d535a
RCFLAGS = --define GCC_WINDRES
kusano 7d535a
kusano 7d535a
STRIP = $(PREFIX)strip
kusano 7d535a
kusano 7d535a
CP = cp -fp
kusano 7d535a
# If GNU install is available, replace $(CP) with install.
kusano 7d535a
INSTALL = $(CP)
kusano 7d535a
RM = rm -f
kusano 7d535a
kusano 7d535a
prefix ?= /usr/local
kusano 7d535a
exec_prefix = $(prefix)
kusano 7d535a
kusano 7d535a
OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
kusano 7d535a
       gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
kusano 7d535a
OBJA =
kusano 7d535a
kusano 7d535a
all: $(STATICLIB) $(SHAREDLIB) $(IMPLIB) example.exe minigzip.exe example_d.exe minigzip_d.exe
kusano 7d535a
kusano 7d535a
test: example.exe minigzip.exe
kusano 7d535a
	./example
kusano 7d535a
	echo hello world | ./minigzip | ./minigzip -d
kusano 7d535a
kusano 7d535a
testdll: example_d.exe minigzip_d.exe
kusano 7d535a
	./example_d
kusano 7d535a
	echo hello world | ./minigzip_d | ./minigzip_d -d
kusano 7d535a
kusano 7d535a
.c.o:
kusano 7d535a
	$(CC) $(CFLAGS) -c -o $@ $<
kusano 7d535a
kusano 7d535a
.S.o:
kusano 7d535a
	$(AS) $(ASFLAGS) -c -o $@ $<
kusano 7d535a
kusano 7d535a
$(STATICLIB): $(OBJS) $(OBJA)
kusano 7d535a
	$(AR) $(ARFLAGS) $@ $(OBJS) $(OBJA)
kusano 7d535a
kusano 7d535a
$(IMPLIB): $(SHAREDLIB)
kusano 7d535a
kusano 7d535a
$(SHAREDLIB): win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
kusano 7d535a
	$(CC) -shared -Wl,--out-implib,$(IMPLIB) $(LDFLAGS) \
kusano 7d535a
	-o $@ win32/zlib.def $(OBJS) $(OBJA) zlibrc.o
kusano 7d535a
	$(STRIP) $@
kusano 7d535a
kusano 7d535a
example.exe: example.o $(STATICLIB)
kusano 7d535a
	$(LD) $(LDFLAGS) -o $@ example.o $(STATICLIB)
kusano 7d535a
	$(STRIP) $@
kusano 7d535a
kusano 7d535a
minigzip.exe: minigzip.o $(STATICLIB)
kusano 7d535a
	$(LD) $(LDFLAGS) -o $@ minigzip.o $(STATICLIB)
kusano 7d535a
	$(STRIP) $@
kusano 7d535a
kusano 7d535a
example_d.exe: example.o $(IMPLIB)
kusano 7d535a
	$(LD) $(LDFLAGS) -o $@ example.o $(IMPLIB)
kusano 7d535a
	$(STRIP) $@
kusano 7d535a
kusano 7d535a
minigzip_d.exe: minigzip.o $(IMPLIB)
kusano 7d535a
	$(LD) $(LDFLAGS) -o $@ minigzip.o $(IMPLIB)
kusano 7d535a
	$(STRIP) $@
kusano 7d535a
kusano 7d535a
example.o: test/example.c zlib.h zconf.h
kusano 7d535a
	$(CC) $(CFLAGS) -I. -c -o $@ test/example.c
kusano 7d535a
kusano 7d535a
minigzip.o: test/minigzip.c zlib.h zconf.h
kusano 7d535a
	$(CC) $(CFLAGS) -I. -c -o $@ test/minigzip.c
kusano 7d535a
kusano 7d535a
zlibrc.o: win32/zlib1.rc
kusano 7d535a
	$(RC) $(RCFLAGS) -o $@ win32/zlib1.rc
kusano 7d535a
kusano 7d535a
.PHONY: install uninstall clean
kusano 7d535a
kusano 7d535a
install: zlib.h zconf.h $(STATICLIB) $(IMPLIB)
kusano 7d535a
	@if test -z "$(DESTDIR)$(INCLUDE_PATH)" -o -z "$(DESTDIR)$(LIBRARY_PATH)" -o -z "$(DESTDIR)$(BINARY_PATH)"; then \
kusano 7d535a
		echo INCLUDE_PATH, LIBRARY_PATH, and BINARY_PATH must be specified; \
kusano 7d535a
		exit 1; \
kusano 7d535a
	fi
kusano 7d535a
	-@mkdir -p '$(DESTDIR)$(INCLUDE_PATH)'
kusano 7d535a
	-@mkdir -p '$(DESTDIR)$(LIBRARY_PATH)' '$(DESTDIR)$(LIBRARY_PATH)'/pkgconfig
kusano 7d535a
	-if [ "$(SHARED_MODE)" = "1" ]; then \
kusano 7d535a
		mkdir -p '$(DESTDIR)$(BINARY_PATH)'; \
kusano 7d535a
		$(INSTALL) $(SHAREDLIB) '$(DESTDIR)$(BINARY_PATH)'; \
kusano 7d535a
		$(INSTALL) $(IMPLIB) '$(DESTDIR)$(LIBRARY_PATH)'; \
kusano 7d535a
	fi
kusano 7d535a
	-$(INSTALL) zlib.h '$(DESTDIR)$(INCLUDE_PATH)'
kusano 7d535a
	-$(INSTALL) zconf.h '$(DESTDIR)$(INCLUDE_PATH)'
kusano 7d535a
	-$(INSTALL) $(STATICLIB) '$(DESTDIR)$(LIBRARY_PATH)'
kusano 7d535a
	sed \
kusano 7d535a
		-e 's|@prefix@|${prefix}|g' \
kusano 7d535a
		-e 's|@exec_prefix@|${exec_prefix}|g' \
kusano 7d535a
		-e 's|@libdir@|$(LIBRARY_PATH)|g' \
kusano 7d535a
		-e 's|@sharedlibdir@|$(LIBRARY_PATH)|g' \
kusano 7d535a
		-e 's|@includedir@|$(INCLUDE_PATH)|g' \
kusano 7d535a
		-e 's|@VERSION@|'`sed -n -e '/VERSION "/s/.*"\(.*\)".*/\1/p' zlib.h`'|g' \
kusano 7d535a
		zlib.pc.in > '$(DESTDIR)$(LIBRARY_PATH)'/pkgconfig/zlib.pc
kusano 7d535a
kusano 7d535a
uninstall:
kusano 7d535a
	-if [ "$(SHARED_MODE)" = "1" ]; then \
kusano 7d535a
		$(RM) '$(DESTDIR)$(BINARY_PATH)'/$(SHAREDLIB); \
kusano 7d535a
		$(RM) '$(DESTDIR)$(LIBRARY_PATH)'/$(IMPLIB); \
kusano 7d535a
	fi
kusano 7d535a
	-$(RM) '$(DESTDIR)$(INCLUDE_PATH)'/zlib.h
kusano 7d535a
	-$(RM) '$(DESTDIR)$(INCLUDE_PATH)'/zconf.h
kusano 7d535a
	-$(RM) '$(DESTDIR)$(LIBRARY_PATH)'/$(STATICLIB)
kusano 7d535a
kusano 7d535a
clean:
kusano 7d535a
	-$(RM) $(STATICLIB)
kusano 7d535a
	-$(RM) $(SHAREDLIB)
kusano 7d535a
	-$(RM) $(IMPLIB)
kusano 7d535a
	-$(RM) *.o
kusano 7d535a
	-$(RM) *.exe
kusano 7d535a
	-$(RM) foo.gz
kusano 7d535a
kusano 7d535a
adler32.o: zlib.h zconf.h
kusano 7d535a
compress.o: zlib.h zconf.h
kusano 7d535a
crc32.o: crc32.h zlib.h zconf.h
kusano 7d535a
deflate.o: deflate.h zutil.h zlib.h zconf.h
kusano 7d535a
gzclose.o: zlib.h zconf.h gzguts.h
kusano 7d535a
gzlib.o: zlib.h zconf.h gzguts.h
kusano 7d535a
gzread.o: zlib.h zconf.h gzguts.h
kusano 7d535a
gzwrite.o: zlib.h zconf.h gzguts.h
kusano 7d535a
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
kusano 7d535a
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
kusano 7d535a
infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
kusano 7d535a
inftrees.o: zutil.h zlib.h zconf.h inftrees.h
kusano 7d535a
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
kusano 7d535a
uncompr.o: zlib.h zconf.h
kusano 7d535a
zutil.o: zutil.h zlib.h zconf.h