2011-09-10 06:07:35 +00:00
|
|
|
# Makefile for zlib
|
2011-09-10 06:26:58 +00:00
|
|
|
# Copyright (C) 1995-2010 Jean-loup Gailly.
|
2011-09-10 06:22:37 +00:00
|
|
|
# For conditions of distribution and use, see copyright notice in zlib.h
|
2011-09-10 06:07:35 +00:00
|
|
|
|
2011-09-10 06:14:39 +00:00
|
|
|
# To compile and test, type:
|
2011-09-10 06:22:37 +00:00
|
|
|
# ./configure; make test
|
2011-09-10 06:26:40 +00:00
|
|
|
# Normally configure builds both a static and a shared library.
|
|
|
|
# If you want to build just a static library, use: ./configure --static
|
2011-09-10 06:14:39 +00:00
|
|
|
|
2011-09-10 06:22:37 +00:00
|
|
|
# To use the asm code, type:
|
|
|
|
# cp contrib/asm?86/match.S ./match.S
|
|
|
|
# make LOC=-DASMV OBJA=match.o
|
|
|
|
|
2011-09-10 06:14:39 +00:00
|
|
|
# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
|
|
|
|
# make install
|
|
|
|
# To install in $HOME instead of /usr/local, use:
|
|
|
|
# make install prefix=$HOME
|
|
|
|
|
2011-09-10 05:36:31 +00:00
|
|
|
CC=cc
|
2011-09-10 06:14:39 +00:00
|
|
|
|
2011-09-10 05:36:31 +00:00
|
|
|
CFLAGS=-O
|
2011-09-10 06:14:39 +00:00
|
|
|
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
|
2011-09-10 05:36:31 +00:00
|
|
|
#CFLAGS=-g -DDEBUG
|
2011-09-10 06:14:39 +00:00
|
|
|
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
|
|
|
|
# -Wstrict-prototypes -Wmissing-prototypes
|
|
|
|
|
2011-09-10 06:25:38 +00:00
|
|
|
SFLAGS=-O
|
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
LDFLAGS=-L. libz.a
|
2011-09-10 06:14:39 +00:00
|
|
|
LDSHARED=$(CC)
|
2011-09-10 06:20:29 +00:00
|
|
|
CPP=$(CC) -E
|
2011-09-10 05:36:31 +00:00
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
STATICLIB=libz.a
|
2011-09-10 06:17:33 +00:00
|
|
|
SHAREDLIB=libz.so
|
2011-09-10 06:26:58 +00:00
|
|
|
SHAREDLIBV=libz.so.1.2.3.6
|
2011-09-10 06:23:01 +00:00
|
|
|
SHAREDLIBM=libz.so.1
|
2011-09-10 06:26:49 +00:00
|
|
|
LIBS=$(STATICLIB) $(SHAREDLIB) $(SHAREDLIBV)
|
2011-09-10 06:14:39 +00:00
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
AR=ar rc
|
2011-09-10 05:36:31 +00:00
|
|
|
RANLIB=ranlib
|
2011-09-10 06:14:39 +00:00
|
|
|
TAR=tar
|
2011-09-10 06:17:33 +00:00
|
|
|
SHELL=/bin/sh
|
2011-09-10 06:23:14 +00:00
|
|
|
EXE=
|
2011-09-10 05:36:31 +00:00
|
|
|
|
2011-09-10 06:20:15 +00:00
|
|
|
prefix = /usr/local
|
|
|
|
exec_prefix = ${prefix}
|
2011-09-10 06:20:29 +00:00
|
|
|
libdir = ${exec_prefix}/lib
|
|
|
|
includedir = ${prefix}/include
|
2011-09-10 06:22:37 +00:00
|
|
|
mandir = ${prefix}/share/man
|
|
|
|
man3dir = ${mandir}/man3
|
2011-09-10 06:25:27 +00:00
|
|
|
pkgconfigdir = ${libdir}/pkgconfig
|
2011-09-10 06:07:35 +00:00
|
|
|
|
2011-09-10 06:26:49 +00:00
|
|
|
OBJC = adler32.o compress.o crc32.o deflate.o gzclose.o gzio.o gzlib.o gzread.o \
|
|
|
|
gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
|
2011-09-10 05:36:31 +00:00
|
|
|
|
2011-09-10 06:26:49 +00:00
|
|
|
PIC_OBJC = adler32.lo compress.lo crc32.lo deflate.lo gzclose.lo gzio.lo gzlib.lo gzread.lo \
|
|
|
|
gzwrite.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo
|
2011-09-10 06:26:40 +00:00
|
|
|
|
|
|
|
# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
|
2011-09-10 06:20:29 +00:00
|
|
|
OBJA =
|
2011-09-10 06:26:40 +00:00
|
|
|
PIC_OBJA =
|
2011-09-10 06:20:29 +00:00
|
|
|
|
2011-09-10 06:25:38 +00:00
|
|
|
OBJS = $(OBJC) $(OBJA)
|
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
|
|
|
|
|
|
|
|
all: static shared
|
2011-09-10 06:25:38 +00:00
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
static: example$(EXE) minigzip$(EXE)
|
2011-09-10 05:36:31 +00:00
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
shared: examplesh$(EXE) minigzipsh$(EXE)
|
2011-09-10 05:36:31 +00:00
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
all64: example64$(EXE) minigzip64$(EXE)
|
|
|
|
|
|
|
|
check: test
|
2011-09-10 06:26:29 +00:00
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
test: all teststatic testshared
|
2011-09-10 06:26:29 +00:00
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
teststatic: static
|
2011-09-10 06:26:29 +00:00
|
|
|
@echo hello world | ./minigzip | ./minigzip -d || \
|
2011-09-10 06:18:57 +00:00
|
|
|
echo ' *** minigzip test FAILED ***' ; \
|
|
|
|
if ./example; then \
|
|
|
|
echo ' *** zlib test OK ***'; \
|
|
|
|
else \
|
|
|
|
echo ' *** zlib test FAILED ***'; \
|
|
|
|
fi
|
2011-09-10 05:36:31 +00:00
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
testshared: shared
|
2011-09-10 06:26:29 +00:00
|
|
|
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
|
2011-09-10 06:26:40 +00:00
|
|
|
LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
|
2011-09-10 06:26:29 +00:00
|
|
|
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
|
|
|
|
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
|
|
|
|
echo hello world | ./minigzipsh | ./minigzipsh -d || \
|
|
|
|
echo ' *** minigzip shared test FAILED ***' ; \
|
|
|
|
if ./examplesh; then \
|
|
|
|
echo ' *** zlib shared test OK ***'; \
|
|
|
|
else \
|
|
|
|
echo ' *** zlib shared test FAILED ***'; \
|
|
|
|
fi
|
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
test64: all64
|
|
|
|
@echo hello world | ./minigzip64 | ./minigzip64 -d || \
|
|
|
|
echo ' *** minigzip 64-bit test FAILED ***' ; \
|
|
|
|
if ./example64; then \
|
|
|
|
echo ' *** zlib 64-bit test OK ***'; \
|
|
|
|
else \
|
|
|
|
echo ' *** zlib 64-bit test FAILED ***'; \
|
|
|
|
fi
|
2011-09-10 06:26:29 +00:00
|
|
|
|
2011-09-10 06:25:38 +00:00
|
|
|
libz.a: $(OBJS)
|
|
|
|
$(AR) $@ $(OBJS)
|
2011-09-10 06:17:33 +00:00
|
|
|
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
|
2011-09-10 06:14:39 +00:00
|
|
|
|
2011-09-10 06:20:29 +00:00
|
|
|
match.o: match.S
|
|
|
|
$(CPP) match.S > _match.s
|
|
|
|
$(CC) -c _match.s
|
|
|
|
mv _match.o match.o
|
|
|
|
rm -f _match.s
|
|
|
|
|
2011-09-10 06:25:38 +00:00
|
|
|
match.lo: match.S
|
|
|
|
$(CPP) match.S > _match.s
|
|
|
|
$(CC) -c -fPIC _match.s
|
|
|
|
mv _match.o match.lo
|
|
|
|
rm -f _match.s
|
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
example64.o: example.c zlib.h zconf.h zlibdefs.h
|
2011-09-10 06:26:58 +00:00
|
|
|
$(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ example.c
|
2011-09-10 06:26:40 +00:00
|
|
|
|
|
|
|
minigzip64.o: minigzip.c zlib.h zconf.h zlibdefs.h
|
2011-09-10 06:26:58 +00:00
|
|
|
$(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ minigzip.c
|
2011-09-10 06:26:40 +00:00
|
|
|
|
|
|
|
.SUFFIXES: .lo
|
|
|
|
|
|
|
|
.c.lo:
|
|
|
|
-@if [ ! -d objs ]; then mkdir objs; fi
|
|
|
|
$(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
|
|
|
|
-@mv objs/$*.o $@
|
2011-09-10 06:25:38 +00:00
|
|
|
|
|
|
|
$(SHAREDLIBV): $(PIC_OBJS)
|
2011-09-10 06:26:40 +00:00
|
|
|
$(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) -lc
|
2011-09-10 06:23:01 +00:00
|
|
|
rm -f $(SHAREDLIB) $(SHAREDLIBM)
|
2011-09-10 06:17:33 +00:00
|
|
|
ln -s $@ $(SHAREDLIB)
|
2011-09-10 06:23:01 +00:00
|
|
|
ln -s $@ $(SHAREDLIBM)
|
2011-09-10 06:26:40 +00:00
|
|
|
-@rmdir objs
|
2011-09-10 06:11:37 +00:00
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
example$(EXE): example.o $(STATICLIB)
|
2011-09-10 05:36:31 +00:00
|
|
|
$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
|
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
minigzip$(EXE): minigzip.o $(STATICLIB)
|
2011-09-10 05:36:31 +00:00
|
|
|
$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
|
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
examplesh$(EXE): example.o $(SHAREDLIBV)
|
|
|
|
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
|
|
|
|
|
|
|
|
minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
|
|
|
|
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
|
|
|
|
|
|
|
|
example64$(EXE): example64.o $(STATICLIB)
|
|
|
|
$(CC) $(CFLAGS) -o $@ example64.o $(LDFLAGS)
|
2011-09-10 06:26:29 +00:00
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
minigzip64$(EXE): minigzip64.o $(STATICLIB)
|
|
|
|
$(CC) $(CFLAGS) -o $@ minigzip64.o $(LDFLAGS)
|
2011-09-10 06:26:29 +00:00
|
|
|
|
2011-09-10 06:25:38 +00:00
|
|
|
install-libs: $(LIBS)
|
2011-09-10 06:25:27 +00:00
|
|
|
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
|
|
|
|
-@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
|
|
|
|
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
|
|
|
|
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
|
|
|
|
cp $(LIBS) $(DESTDIR)$(libdir)
|
|
|
|
cd $(DESTDIR)$(libdir); chmod 755 $(LIBS)
|
|
|
|
-@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
|
|
|
|
cd $(DESTDIR)$(libdir); if test -f $(SHAREDLIBV); then \
|
2011-09-10 06:23:01 +00:00
|
|
|
rm -f $(SHAREDLIB) $(SHAREDLIBM); \
|
|
|
|
ln -s $(SHAREDLIBV) $(SHAREDLIB); \
|
|
|
|
ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
|
2011-09-10 06:17:33 +00:00
|
|
|
(ldconfig || true) >/dev/null 2>&1; \
|
2011-09-10 06:14:39 +00:00
|
|
|
fi
|
2011-09-10 06:25:27 +00:00
|
|
|
cp zlib.3 $(DESTDIR)$(man3dir)
|
|
|
|
chmod 644 $(DESTDIR)$(man3dir)/zlib.3
|
|
|
|
cp zlib.pc $(DESTDIR)$(pkgconfigdir)
|
|
|
|
chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
|
2011-09-10 06:14:39 +00:00
|
|
|
# The ranlib in install is needed on NeXTSTEP which checks file times
|
2011-09-10 06:17:33 +00:00
|
|
|
# ldconfig is for Linux
|
2011-09-10 06:14:39 +00:00
|
|
|
|
2011-09-10 06:25:38 +00:00
|
|
|
install: install-libs
|
|
|
|
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
|
|
|
|
cp zlib.h zconf.h zlibdefs.h $(DESTDIR)$(includedir)
|
|
|
|
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h $(DESTDIR)$(includedir)/zlibdefs.h
|
|
|
|
|
2011-09-10 06:14:39 +00:00
|
|
|
uninstall:
|
2011-09-10 06:25:38 +00:00
|
|
|
cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h zlibdefs.h
|
2011-09-10 06:25:27 +00:00
|
|
|
cd $(DESTDIR)$(libdir); rm -f libz.a; \
|
2011-09-10 06:23:01 +00:00
|
|
|
if test -f $(SHAREDLIBV); then \
|
|
|
|
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
|
2011-09-10 06:14:39 +00:00
|
|
|
fi
|
2011-09-10 06:25:27 +00:00
|
|
|
cd $(DESTDIR)$(man3dir); rm -f zlib.3
|
|
|
|
cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc
|
2011-09-10 06:14:39 +00:00
|
|
|
|
2011-09-10 06:21:57 +00:00
|
|
|
mostlyclean: clean
|
2011-09-10 05:36:31 +00:00
|
|
|
clean:
|
2011-09-10 06:26:29 +00:00
|
|
|
rm -f *.o *.lo *~ \
|
|
|
|
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
|
2011-09-10 06:26:40 +00:00
|
|
|
example64$(EXE) minigzip64$(EXE) \
|
2011-09-10 06:23:14 +00:00
|
|
|
libz.* foo.gz so_locations \
|
2011-09-10 06:22:48 +00:00
|
|
|
_match.s maketree contrib/infback9/*.o
|
2011-09-10 06:26:40 +00:00
|
|
|
rm -rf objs
|
2011-09-10 05:36:31 +00:00
|
|
|
|
2011-09-10 06:21:57 +00:00
|
|
|
maintainer-clean: distclean
|
2011-09-10 06:22:37 +00:00
|
|
|
distclean: clean
|
2011-09-10 06:21:47 +00:00
|
|
|
cp -p Makefile.in Makefile
|
2011-09-10 06:25:38 +00:00
|
|
|
rm zlibdefs.h
|
|
|
|
touch -r configure zlibdefs.h
|
2011-09-10 06:25:27 +00:00
|
|
|
rm -f zlib.pc .DS_Store
|
2011-09-10 06:17:33 +00:00
|
|
|
|
2011-09-10 06:22:37 +00:00
|
|
|
tags:
|
2011-09-10 06:13:27 +00:00
|
|
|
etags *.[ch]
|
2011-09-10 05:36:31 +00:00
|
|
|
|
2011-09-10 06:14:39 +00:00
|
|
|
depend:
|
|
|
|
makedepend -- $(CFLAGS) -- *.[ch]
|
|
|
|
|
2011-09-10 05:36:31 +00:00
|
|
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
adler32.o gzio.o zutil.o: zutil.h zlib.h zconf.h zlibdefs.h
|
2011-09-10 06:26:49 +00:00
|
|
|
gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h zlibdefs.h gzguts.h
|
2011-09-10 06:26:40 +00:00
|
|
|
compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h zlibdefs.h
|
|
|
|
crc32.o: zutil.h zlib.h zconf.h zlibdefs.h crc32.h
|
2011-09-10 06:25:38 +00:00
|
|
|
deflate.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h
|
2011-09-10 06:26:40 +00:00
|
|
|
infback.o inflate.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
|
2011-09-10 06:25:38 +00:00
|
|
|
inffast.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h
|
|
|
|
inftrees.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
|
|
|
|
trees.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h
|
|
|
|
|
2011-09-10 06:26:40 +00:00
|
|
|
adler32.lo gzio.lo zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h
|
2011-09-10 06:26:49 +00:00
|
|
|
gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h zlibdefs.h gzguts.h
|
2011-09-10 06:26:40 +00:00
|
|
|
compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h zlibdefs.h
|
|
|
|
crc32.lo: zutil.h zlib.h zconf.h zlibdefs.h crc32.h
|
2011-09-10 06:25:38 +00:00
|
|
|
deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h
|
2011-09-10 06:26:40 +00:00
|
|
|
infback.lo inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
|
2011-09-10 06:25:38 +00:00
|
|
|
inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h
|
|
|
|
inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
|
|
|
|
trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h
|