2
# Copyright (C) 1995-2006 Jean-loup Gailly.
3
# For conditions of distribution and use, see copyright notice in zlib.h
5
# To compile and test, type:
6
# ./configure; make test
7
# Normally configure builds both a static and a shared library.
8
# If you want to build just a static library, use: ./configure --static
10
# To use the asm code, type:
11
# cp contrib/asm?86/match.S ./match.S
12
# make LOC=-DASMV OBJA=match.o
14
# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
16
# To install in $HOME instead of /usr/local, use:
17
# make install prefix=$HOME
22
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
24
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
25
# -Wstrict-prototypes -Wmissing-prototypes
35
SHAREDLIBV=libz.so.1.2.3.4
37
LIBS=$(STATICLIB) $(SHAREDLIB)
46
exec_prefix = ${prefix}
47
libdir = ${exec_prefix}/lib
48
includedir = ${prefix}/include
49
mandir = ${prefix}/share/man
50
man3dir = ${mandir}/man3
51
pkgconfigdir = ${libdir}/pkgconfig
53
OBJC = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
54
zutil.o inflate.o infback.o inftrees.o inffast.o
56
PIC_OBJC = adler32.lo compress.lo crc32.lo gzio.lo uncompr.lo deflate.lo trees.lo \
57
zutil.lo inflate.lo infback.lo inftrees.lo inffast.lo
59
# to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
63
OBJS = $(OBJC) $(OBJA)
65
PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
69
static: example$(EXE) minigzip$(EXE)
71
shared: examplesh$(EXE) minigzipsh$(EXE)
73
all64: example64$(EXE) minigzip64$(EXE)
77
test: all teststatic testshared
80
@echo hello world | ./minigzip | ./minigzip -d || \
81
echo ' *** minigzip test FAILED ***' ; \
83
echo ' *** zlib test OK ***'; \
85
echo ' *** zlib test FAILED ***'; \
89
@LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
90
LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
91
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
92
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
93
echo hello world | ./minigzipsh | ./minigzipsh -d || \
94
echo ' *** minigzip shared test FAILED ***' ; \
95
if ./examplesh; then \
96
echo ' *** zlib shared test OK ***'; \
98
echo ' *** zlib shared test FAILED ***'; \
102
@echo hello world | ./minigzip64 | ./minigzip64 -d || \
103
echo ' *** minigzip 64-bit test FAILED ***' ; \
104
if ./example64; then \
105
echo ' *** zlib 64-bit test OK ***'; \
107
echo ' *** zlib 64-bit test FAILED ***'; \
112
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
115
$(CPP) match.S > _match.s
121
$(CPP) match.S > _match.s
122
$(CC) -c -fPIC _match.s
126
example64.o: example.c zlib.h zconf.h zlibdefs.h
127
$(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ $<
129
minigzip64.o: minigzip.c zlib.h zconf.h zlibdefs.h
130
$(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ $<
135
-@if [ ! -d objs ]; then mkdir objs; fi
136
$(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
139
$(SHAREDLIBV): $(PIC_OBJS)
140
$(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) -lc
141
rm -f $(SHAREDLIB) $(SHAREDLIBM)
142
ln -s $@ $(SHAREDLIB)
143
ln -s $@ $(SHAREDLIBM)
146
example$(EXE): example.o $(STATICLIB)
147
$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
149
minigzip$(EXE): minigzip.o $(STATICLIB)
150
$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
152
examplesh$(EXE): example.o $(SHAREDLIBV)
153
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
155
minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
156
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
158
example64$(EXE): example64.o $(STATICLIB)
159
$(CC) $(CFLAGS) -o $@ example64.o $(LDFLAGS)
161
minigzip64$(EXE): minigzip64.o $(STATICLIB)
162
$(CC) $(CFLAGS) -o $@ minigzip64.o $(LDFLAGS)
164
install-libs: $(LIBS)
165
-@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
166
-@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
167
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
168
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
169
cp $(LIBS) $(DESTDIR)$(libdir)
170
cd $(DESTDIR)$(libdir); chmod 755 $(LIBS)
171
-@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
172
cd $(DESTDIR)$(libdir); if test -f $(SHAREDLIBV); then \
173
rm -f $(SHAREDLIB) $(SHAREDLIBM); \
174
ln -s $(SHAREDLIBV) $(SHAREDLIB); \
175
ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
176
(ldconfig || true) >/dev/null 2>&1; \
178
cp zlib.3 $(DESTDIR)$(man3dir)
179
chmod 644 $(DESTDIR)$(man3dir)/zlib.3
180
cp zlib.pc $(DESTDIR)$(pkgconfigdir)
181
chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
182
# The ranlib in install is needed on NeXTSTEP which checks file times
183
# ldconfig is for Linux
185
install: install-libs
186
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
187
cp zlib.h zconf.h zlibdefs.h $(DESTDIR)$(includedir)
188
chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h $(DESTDIR)$(includedir)/zlibdefs.h
191
cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h zlibdefs.h
192
cd $(DESTDIR)$(libdir); rm -f libz.a; \
193
if test -f $(SHAREDLIBV); then \
194
rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
196
cd $(DESTDIR)$(man3dir); rm -f zlib.3
197
cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc
202
example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
203
example64$(EXE) minigzip64$(EXE) \
204
libz.* foo.gz so_locations \
205
_match.s maketree contrib/infback9/*.o
208
maintainer-clean: distclean
210
cp -p Makefile.in Makefile
212
touch -r configure zlibdefs.h
213
rm -f zlib.pc .DS_Store
219
makedepend -- $(CFLAGS) -- *.[ch]
221
# DO NOT DELETE THIS LINE -- make depend depends on it.
223
adler32.o gzio.o zutil.o: zutil.h zlib.h zconf.h zlibdefs.h
224
compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h zlibdefs.h
225
crc32.o: zutil.h zlib.h zconf.h zlibdefs.h crc32.h
226
deflate.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h
227
infback.o inflate.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
228
inffast.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h
229
inftrees.o: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
230
trees.o: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h
232
adler32.lo gzio.lo zutil.lo: zutil.h zlib.h zconf.h zlibdefs.h
233
compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h zlibdefs.h
234
crc32.lo: zutil.h zlib.h zconf.h zlibdefs.h crc32.h
235
deflate.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h
236
infback.lo inflate.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h inffixed.h
237
inffast.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h inflate.h inffast.h
238
inftrees.lo: zutil.h zlib.h zconf.h zlibdefs.h inftrees.h
239
trees.lo: deflate.h zutil.h zlib.h zconf.h zlibdefs.h trees.h