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