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