A massively spiffy yet delicately unobtrusive compression library. (grpc依赖)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

286 lines
8.7 KiB

13 years ago
# Makefile for zlib
13 years ago
# Copyright (C) 1995-2011 Jean-loup Gailly.
13 years ago
# For conditions of distribution and use, see copyright notice in zlib.h
13 years ago
# To compile and test, type:
13 years ago
# ./configure; make test
13 years ago
# Normally configure builds both a static and a shared library.
# If you want to build just a static library, use: ./configure --static
13 years ago
13 years ago
# To use the asm code, type:
# cp contrib/asm?86/match.S ./match.S
# make LOC=-DASMV OBJA=match.o
13 years ago
# 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
CC=cc
CFLAGS=-O
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DDEBUG
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
# -Wstrict-prototypes -Wmissing-prototypes
13 years ago
SFLAGS=-O
13 years ago
LDFLAGS=
13 years ago
TEST_LDFLAGS=-L. libz.a
13 years ago
LDSHARED=$(CC)
13 years ago
CPP=$(CC) -E
13 years ago
13 years ago
STATICLIB=libz.a
13 years ago
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.6.1
13 years ago
SHAREDLIBM=libz.so.1
13 years ago
LIBS=$(STATICLIB) $(SHAREDLIBV)
13 years ago
AR=ar
ARFLAGS=rc
13 years ago
RANLIB=ranlib
13 years ago
LDCONFIG=ldconfig
LDSHAREDLIBC=-lc
13 years ago
TAR=tar
13 years ago
SHELL=/bin/sh
13 years ago
EXE=
13 years ago
13 years ago
prefix = /usr/local
exec_prefix = ${prefix}
13 years ago
libdir = ${exec_prefix}/lib
13 years ago
sharedlibdir = ${libdir}
13 years ago
includedir = ${prefix}/include
13 years ago
mandir = ${prefix}/share/man
man3dir = ${mandir}/man3
13 years ago
pkgconfigdir = ${libdir}/pkgconfig
tempfile := $(shell mktemp -u __XXXXXX)
13 years ago
OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
OBJC = $(OBJZ) $(OBJG)
13 years ago
PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
13 years ago
13 years ago
# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
OBJA =
PIC_OBJA =
13 years ago
13 years ago
OBJS = $(OBJC) $(OBJA)
13 years ago
13 years ago
PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
13 years ago
all: static shared
13 years ago
13 years ago
static: example$(EXE) minigzip$(EXE)
13 years ago
13 years ago
shared: examplesh$(EXE) minigzipsh$(EXE)
13 years ago
13 years ago
all64: example64$(EXE) minigzip64$(EXE)
check: test
13 years ago
13 years ago
test: all teststatic testshared
13 years ago
13 years ago
teststatic: static
13 years ago
@if echo hello world | ./minigzip | ./minigzip -d && ./example; then \
13 years ago
echo ' *** zlib test OK ***'; \
else \
13 years ago
echo ' *** zlib test FAILED ***'; false; \
13 years ago
fi
13 years ago
-@rm -f foo.gz
13 years ago
13 years ago
testshared: shared
13 years ago
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
13 years ago
LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
13 years ago
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
13 years ago
if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh; then \
13 years ago
echo ' *** zlib shared test OK ***'; \
else \
13 years ago
echo ' *** zlib shared test FAILED ***'; false; \
13 years ago
fi
13 years ago
-@rm -f foo.gz
13 years ago
13 years ago
test64: all64
13 years ago
@if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64; then \
13 years ago
echo ' *** zlib 64-bit test OK ***'; \
else \
13 years ago
echo ' *** zlib 64-bit test FAILED ***'; false; \
13 years ago
fi
13 years ago
-@rm -f foo.gz
13 years ago
infcover.o: test/infcover.c zlib.h zconf.h
$(CC) $(CFLAGS) -I. -c -o $@ test/infcover.c
infcover: infcover.o libz.a
$(CC) $(CFLAGS) -o $@ infcover.o libz.a
cover: infcover
rm -f *.gcda
./infcover
gcov inf*.c
13 years ago
libz.a: $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
13 years ago
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
13 years ago
13 years ago
match.o: match.S
13 years ago
$(CPP) match.S > _match.s
13 years ago
$(CC) -c _match.s
mv _match.o match.o
13 years ago
rm -f _match.s
13 years ago
match.lo: match.S
13 years ago
$(CPP) match.S > _match.s
13 years ago
$(CC) -c -fPIC _match.s
mv _match.o match.lo
13 years ago
rm -f _match.s
example.o: test/example.c zlib.h zconf.h
$(CC) $(CFLAGS) -I. -c -o $@ test/example.c
13 years ago
minigzip.o: test/minigzip.c zlib.h zconf.h
$(CC) $(CFLAGS) -I. -c -o $@ test/minigzip.c
example64.o: test/example.c zlib.h zconf.h
$(CC) $(CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/example.c
minigzip64.o: test/minigzip.c zlib.h zconf.h
$(CC) $(CFLAGS) -I. -D_FILE_OFFSET_BITS=64 -c -o $@ test/minigzip.c
13 years ago
13 years ago
.SUFFIXES: .lo
13 years ago
13 years ago
.c.lo:
13 years ago
-@mkdir objs 2>/dev/null || test -d objs
13 years ago
$(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
-@mv objs/$*.o $@
13 years ago
13 years ago
placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
13 years ago
$(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
13 years ago
rm -f $(SHAREDLIB) $(SHAREDLIBM)
13 years ago
ln -s $@ $(SHAREDLIB)
13 years ago
ln -s $@ $(SHAREDLIBM)
13 years ago
-@rmdir objs
13 years ago
13 years ago
example$(EXE): example.o $(STATICLIB)
13 years ago
$(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
13 years ago
13 years ago
minigzip$(EXE): minigzip.o $(STATICLIB)
13 years ago
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
13 years ago
13 years ago
examplesh$(EXE): example.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
13 years ago
13 years ago
minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
13 years ago
13 years ago
example64$(EXE): example64.o $(STATICLIB)
13 years ago
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
13 years ago
13 years ago
minigzip64$(EXE): minigzip64.o $(STATICLIB)
13 years ago
$(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
13 years ago
13 years ago
install-libs: $(LIBS)
13 years ago
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
-@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
13 years ago
-@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
13 years ago
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
13 years ago
cp $(STATICLIB) $(DESTDIR)$(libdir)
13 years ago
chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
-@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
-@if test -n "$(SHAREDLIBV)"; then \
cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
13 years ago
($(LDCONFIG) || true) >/dev/null 2>&1; \
13 years ago
fi
13 years ago
cp zlib.3 $(DESTDIR)$(man3dir)
chmod 644 $(DESTDIR)$(man3dir)/zlib.3
cp zlib.pc $(DESTDIR)$(pkgconfigdir)
chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
13 years ago
# The ranlib in install is needed on NeXTSTEP which checks file times
13 years ago
# ldconfig is for Linux
13 years ago
13 years ago
install: install-libs
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
13 years ago
cp zlib.h zconf.h $(DESTDIR)$(includedir)
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
13 years ago
13 years ago
uninstall:
13 years ago
cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h
13 years ago
cd $(DESTDIR)$(libdir); rm -f libz.a; \
13 years ago
if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
13 years ago
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
13 years ago
fi
13 years ago
cd $(DESTDIR)$(man3dir); rm -f zlib.3
cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc
13 years ago
13 years ago
docs: zlib.3.pdf
zlib.3.pdf: zlib.3
groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf
zconf.h.cmakein: zconf.h.in
-@echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" > $(tempfile)
-@sed -f $(tempfile) zconf.h.in > zconf.h.cmakein
-@touch -r zconf.h.in zconf.h.cmakein
-@rm $(tempfile)
13 years ago
zconf: zconf.h.in
cp -p zconf.h.in zconf.h
13 years ago
mostlyclean: clean
13 years ago
clean:
13 years ago
rm -f *.o *.lo *~ \
13 years ago
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
13 years ago
example64$(EXE) minigzip64$(EXE) \
infcover \
13 years ago
libz.* foo.gz so_locations \
13 years ago
_match.s maketree contrib/infback9/*.o
13 years ago
rm -rf objs
rm -f *.gcda *.gcno *.gcov
rm -f contrib/infback9/*.gcda contrib/infback9/*.gcno contrib/infback9/*.gcov
13 years ago
13 years ago
maintainer-clean: distclean
distclean: clean zconf zconf.h.cmakein docs
rm -f Makefile zlib.pc configure.log
13 years ago
-@rm -f .DS_Store
13 years ago
-@printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile
13 years ago
-@printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile
13 years ago
-@touch -r Makefile.in Makefile
13 years ago
13 years ago
tags:
13 years ago
etags *.[ch]
depend:
makedepend -- $(CFLAGS) -- *.[ch]
# DO NOT DELETE THIS LINE -- make depend depends on it.
13 years ago
adler32.o zutil.o: zutil.h zlib.h zconf.h
13 years ago
gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h gzguts.h
compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h
crc32.o: zutil.h zlib.h zconf.h crc32.h
deflate.o: deflate.h zutil.h zlib.h zconf.h
infback.o inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
inffast.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
13 years ago
13 years ago
adler32.lo zutil.lo: zutil.h zlib.h zconf.h
13 years ago
gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h gzguts.h
compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h
crc32.lo: zutil.h zlib.h zconf.h crc32.h
deflate.lo: deflate.h zutil.h zlib.h zconf.h
infback.lo inflate.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
inffast.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
inftrees.lo: zutil.h zlib.h zconf.h inftrees.h
trees.lo: deflate.h zutil.h zlib.h zconf.h trees.h