2 # Copyright (C) 1995-2017 Jean-loup Gailly, Mark Adler
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
23 #CFLAGS=-g -DZLIB_DEBUG
24 #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
25 # -Wstrict-prototypes -Wmissing-prototypes
29 TEST_LDFLAGS
=-L. libz.a
35 SHAREDLIBV
=libz.so
.1.2.11
37 LIBS
=$(STATICLIB
) $(SHAREDLIBV
)
49 exec_prefix = ${prefix}
50 libdir = ${exec_prefix}/lib
51 sharedlibdir
= ${libdir}
52 includedir = ${prefix}/include
53 mandir = ${prefix}/share
/man
54 man3dir = ${mandir}/man3
55 pkgconfigdir
= ${libdir}/pkgconfig
60 OBJZ
= adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
61 OBJG
= compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
62 OBJC
= $(OBJZ
) $(OBJG
)
64 PIC_OBJZ
= adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
65 PIC_OBJG
= compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
66 PIC_OBJC
= $(PIC_OBJZ
) $(PIC_OBJG
)
68 # to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
72 OBJS
= $(OBJC
) $(OBJA
)
74 PIC_OBJS
= $(PIC_OBJC
) $(PIC_OBJA
)
78 static
: example
$(EXE
) minigzip
$(EXE
)
80 shared
: examplesh
$(EXE
) minigzipsh
$(EXE
)
82 all64
: example64
$(EXE
) minigzip64
$(EXE
)
86 test: all teststatic testshared
90 if echo hello world | .
/minigzip | .
/minigzip
-d
&& .
/example
$$TMPST ; then \
91 echo
' *** zlib test OK ***'; \
93 echo
' *** zlib test FAILED ***'; false
; \
98 @LD_LIBRARY_PATH
=`pwd`:$(LD_LIBRARY_PATH
) ; export LD_LIBRARY_PATH
; \
99 LD_LIBRARYN32_PATH
=`pwd`:$(LD_LIBRARYN32_PATH
) ; export LD_LIBRARYN32_PATH
; \
100 DYLD_LIBRARY_PATH
=`pwd`:$(DYLD_LIBRARY_PATH
) ; export DYLD_LIBRARY_PATH
; \
101 SHLIB_PATH
=`pwd`:$(SHLIB_PATH
) ; export SHLIB_PATH
; \
103 if echo hello world | .
/minigzipsh | .
/minigzipsh
-d
&& .
/examplesh
$$TMPSH; then \
104 echo
' *** zlib shared test OK ***'; \
106 echo
' *** zlib shared test FAILED ***'; false
; \
112 if echo hello world | .
/minigzip64 | .
/minigzip64
-d
&& .
/example64
$$TMP64; then \
113 echo
' *** zlib 64-bit test OK ***'; \
115 echo
' *** zlib 64-bit test FAILED ***'; false
; \
119 infcover.o
: $(SRCDIR
)test/infcover.c
$(SRCDIR
)zlib.h zconf.h
120 $(CC
) $(CFLAGS
) $(ZINCOUT
) -c
-o
$@
$(SRCDIR
)test/infcover.c
122 infcover
: infcover.o libz.a
123 $(CC
) $(CFLAGS
) -o
$@ infcover.o libz.a
131 $(AR
) $(ARFLAGS
) $@
$(OBJS
)
132 -@
($(RANLIB
) $@ || true
) >/dev
/null
2>&1
135 $(CPP
) match.S
> _match.s
141 $(CPP
) match.S
> _match.s
142 $(CC
) -c
-fPIC _match.s
146 example.o
: $(SRCDIR
)test/example.c
$(SRCDIR
)zlib.h zconf.h
147 $(CC
) $(CFLAGS
) $(ZINCOUT
) -c
-o
$@
$(SRCDIR
)test/example.c
149 minigzip.o
: $(SRCDIR
)test/minigzip.c
$(SRCDIR
)zlib.h zconf.h
150 $(CC
) $(CFLAGS
) $(ZINCOUT
) -c
-o
$@
$(SRCDIR
)test/minigzip.c
152 example64.o
: $(SRCDIR
)test/example.c
$(SRCDIR
)zlib.h zconf.h
153 $(CC
) $(CFLAGS
) $(ZINCOUT
) -D_FILE_OFFSET_BITS
=64 -c
-o
$@
$(SRCDIR
)test/example.c
155 minigzip64.o
: $(SRCDIR
)test/minigzip.c
$(SRCDIR
)zlib.h zconf.h
156 $(CC
) $(CFLAGS
) $(ZINCOUT
) -D_FILE_OFFSET_BITS
=64 -c
-o
$@
$(SRCDIR
)test/minigzip.c
159 adler32.o
: $(SRCDIR
)adler32.c
160 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)adler32.c
162 crc32.o
: $(SRCDIR
)crc32.c
163 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)crc32.c
165 deflate.o
: $(SRCDIR
)deflate.c
166 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)deflate.c
168 infback.o
: $(SRCDIR
)infback.c
169 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)infback.c
171 inffast.o
: $(SRCDIR
)inffast.c
172 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)inffast.c
174 inflate.o
: $(SRCDIR
)inflate.c
175 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)inflate.c
177 inftrees.o
: $(SRCDIR
)inftrees.c
178 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)inftrees.c
180 trees.o
: $(SRCDIR
)trees.c
181 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)trees.c
183 zutil.o
: $(SRCDIR
)zutil.c
184 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)zutil.c
186 compress.o
: $(SRCDIR
)compress.c
187 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)compress.c
189 uncompr.o
: $(SRCDIR
)uncompr.c
190 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)uncompr.c
192 gzclose.o
: $(SRCDIR
)gzclose.c
193 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)gzclose.c
195 gzlib.o
: $(SRCDIR
)gzlib.c
196 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)gzlib.c
198 gzread.o
: $(SRCDIR
)gzread.c
199 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)gzread.c
201 gzwrite.o
: $(SRCDIR
)gzwrite.c
202 $(CC
) $(CFLAGS
) $(ZINC
) -c
-o
$@
$(SRCDIR
)gzwrite.c
205 adler32.lo
: $(SRCDIR
)adler32.c
206 -@mkdir objs
2>/dev
/null ||
test -d objs
207 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/adler32.o
$(SRCDIR
)adler32.c
208 -@mv objs
/adler32.o
$@
210 crc32.lo
: $(SRCDIR
)crc32.c
211 -@mkdir objs
2>/dev
/null ||
test -d objs
212 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/crc32.o
$(SRCDIR
)crc32.c
215 deflate.lo
: $(SRCDIR
)deflate.c
216 -@mkdir objs
2>/dev
/null ||
test -d objs
217 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/deflate.o
$(SRCDIR
)deflate.c
218 -@mv objs
/deflate.o
$@
220 infback.lo
: $(SRCDIR
)infback.c
221 -@mkdir objs
2>/dev
/null ||
test -d objs
222 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/infback.o
$(SRCDIR
)infback.c
223 -@mv objs
/infback.o
$@
225 inffast.lo
: $(SRCDIR
)inffast.c
226 -@mkdir objs
2>/dev
/null ||
test -d objs
227 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/inffast.o
$(SRCDIR
)inffast.c
228 -@mv objs
/inffast.o
$@
230 inflate.lo
: $(SRCDIR
)inflate.c
231 -@mkdir objs
2>/dev
/null ||
test -d objs
232 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/inflate.o
$(SRCDIR
)inflate.c
233 -@mv objs
/inflate.o
$@
235 inftrees.lo
: $(SRCDIR
)inftrees.c
236 -@mkdir objs
2>/dev
/null ||
test -d objs
237 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/inftrees.o
$(SRCDIR
)inftrees.c
238 -@mv objs
/inftrees.o
$@
240 trees.lo
: $(SRCDIR
)trees.c
241 -@mkdir objs
2>/dev
/null ||
test -d objs
242 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/trees.o
$(SRCDIR
)trees.c
245 zutil.lo
: $(SRCDIR
)zutil.c
246 -@mkdir objs
2>/dev
/null ||
test -d objs
247 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/zutil.o
$(SRCDIR
)zutil.c
250 compress.lo
: $(SRCDIR
)compress.c
251 -@mkdir objs
2>/dev
/null ||
test -d objs
252 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/compress.o
$(SRCDIR
)compress.c
253 -@mv objs
/compress.o
$@
255 uncompr.lo
: $(SRCDIR
)uncompr.c
256 -@mkdir objs
2>/dev
/null ||
test -d objs
257 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/uncompr.o
$(SRCDIR
)uncompr.c
258 -@mv objs
/uncompr.o
$@
260 gzclose.lo
: $(SRCDIR
)gzclose.c
261 -@mkdir objs
2>/dev
/null ||
test -d objs
262 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/gzclose.o
$(SRCDIR
)gzclose.c
263 -@mv objs
/gzclose.o
$@
265 gzlib.lo
: $(SRCDIR
)gzlib.c
266 -@mkdir objs
2>/dev
/null ||
test -d objs
267 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/gzlib.o
$(SRCDIR
)gzlib.c
270 gzread.lo
: $(SRCDIR
)gzread.c
271 -@mkdir objs
2>/dev
/null ||
test -d objs
272 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/gzread.o
$(SRCDIR
)gzread.c
273 -@mv objs
/gzread.o
$@
275 gzwrite.lo
: $(SRCDIR
)gzwrite.c
276 -@mkdir objs
2>/dev
/null ||
test -d objs
277 $(CC
) $(SFLAGS
) $(ZINC
) -DPIC
-c
-o objs
/gzwrite.o
$(SRCDIR
)gzwrite.c
278 -@mv objs
/gzwrite.o
$@
281 placebo
$(SHAREDLIBV
): $(PIC_OBJS
) libz.a
282 $(LDSHARED
) $(SFLAGS
) -o
$@
$(PIC_OBJS
) $(LDSHAREDLIBC
) $(LDFLAGS
)
283 rm -f
$(SHAREDLIB
) $(SHAREDLIBM
)
284 ln
-s
$@
$(SHAREDLIB
)
285 ln
-s
$@
$(SHAREDLIBM
)
288 example
$(EXE
): example.o
$(STATICLIB
)
289 $(CC
) $(CFLAGS
) -o
$@ example.o
$(TEST_LDFLAGS
)
291 minigzip
$(EXE
): minigzip.o
$(STATICLIB
)
292 $(CC
) $(CFLAGS
) -o
$@ minigzip.o
$(TEST_LDFLAGS
)
294 examplesh
$(EXE
): example.o
$(SHAREDLIBV
)
295 $(CC
) $(CFLAGS
) -o
$@ example.o
-L.
$(SHAREDLIBV
)
297 minigzipsh
$(EXE
): minigzip.o
$(SHAREDLIBV
)
298 $(CC
) $(CFLAGS
) -o
$@ minigzip.o
-L.
$(SHAREDLIBV
)
300 example64
$(EXE
): example64.o
$(STATICLIB
)
301 $(CC
) $(CFLAGS
) -o
$@ example64.o
$(TEST_LDFLAGS
)
303 minigzip64
$(EXE
): minigzip64.o
$(STATICLIB
)
304 $(CC
) $(CFLAGS
) -o
$@ minigzip64.o
$(TEST_LDFLAGS
)
306 install-libs
: $(LIBS
)
307 -@if
[ ! -d
$(DESTDIR
)$(exec_prefix) ]; then mkdir
-p
$(DESTDIR
)$(exec_prefix); fi
308 -@if
[ ! -d
$(DESTDIR
)$(libdir) ]; then mkdir
-p
$(DESTDIR
)$(libdir); fi
309 -@if
[ ! -d
$(DESTDIR
)$(sharedlibdir
) ]; then mkdir
-p
$(DESTDIR
)$(sharedlibdir
); fi
310 -@if
[ ! -d
$(DESTDIR
)$(man3dir) ]; then mkdir
-p
$(DESTDIR
)$(man3dir); fi
311 -@if
[ ! -d
$(DESTDIR
)$(pkgconfigdir
) ]; then mkdir
-p
$(DESTDIR
)$(pkgconfigdir
); fi
312 rm -f
$(DESTDIR
)$(libdir)/$(STATICLIB
)
313 cp
$(STATICLIB
) $(DESTDIR
)$(libdir)
314 chmod
644 $(DESTDIR
)$(libdir)/$(STATICLIB
)
315 -@
($(RANLIB
) $(DESTDIR
)$(libdir)/libz.a || true
) >/dev
/null
2>&1
316 -@if
test -n
"$(SHAREDLIBV)"; then \
317 rm -f
$(DESTDIR
)$(sharedlibdir
)/$(SHAREDLIBV
); \
318 cp
$(SHAREDLIBV
) $(DESTDIR
)$(sharedlibdir
); \
319 echo
"cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
320 chmod
755 $(DESTDIR
)$(sharedlibdir
)/$(SHAREDLIBV
); \
321 echo
"chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
322 rm -f
$(DESTDIR
)$(sharedlibdir
)/$(SHAREDLIB
) $(DESTDIR
)$(sharedlibdir
)/$(SHAREDLIBM
); \
323 ln
-s
$(SHAREDLIBV
) $(DESTDIR
)$(sharedlibdir
)/$(SHAREDLIB
); \
324 ln
-s
$(SHAREDLIBV
) $(DESTDIR
)$(sharedlibdir
)/$(SHAREDLIBM
); \
325 ($(LDCONFIG
) || true
) >/dev
/null
2>&1; \
327 rm -f
$(DESTDIR
)$(man3dir)/zlib
.3
328 cp
$(SRCDIR
)zlib
.3 $(DESTDIR
)$(man3dir)
329 chmod
644 $(DESTDIR
)$(man3dir)/zlib
.3
330 rm -f
$(DESTDIR
)$(pkgconfigdir
)/zlib.
pc
331 cp zlib.
pc $(DESTDIR
)$(pkgconfigdir
)
332 chmod
644 $(DESTDIR
)$(pkgconfigdir
)/zlib.
pc
333 # The ranlib in install is needed on NeXTSTEP which checks file times
334 # ldconfig is for Linux
336 install: install-libs
337 -@if
[ ! -d
$(DESTDIR
)$(includedir) ]; then mkdir
-p
$(DESTDIR
)$(includedir); fi
338 rm -f
$(DESTDIR
)$(includedir)/zlib.h
$(DESTDIR
)$(includedir)/zconf.h
339 cp
$(SRCDIR
)zlib.h zconf.h
$(DESTDIR
)$(includedir)
340 chmod
644 $(DESTDIR
)$(includedir)/zlib.h
$(DESTDIR
)$(includedir)/zconf.h
343 cd
$(DESTDIR
)$(includedir) && rm -f zlib.h zconf.h
344 cd
$(DESTDIR
)$(libdir) && rm -f libz.a
; \
345 if
test -n
"$(SHAREDLIBV)" -a
-f
$(SHAREDLIBV
); then \
346 rm -f
$(SHAREDLIBV
) $(SHAREDLIB
) $(SHAREDLIBM
); \
348 cd
$(DESTDIR
)$(man3dir) && rm -f zlib
.3
349 cd
$(DESTDIR
)$(pkgconfigdir
) && rm -f zlib.
pc
353 zlib
.3.pdf
: $(SRCDIR
)zlib
.3
354 groff
-mandoc
-f H
-T ps
$(SRCDIR
)zlib
.3 | ps2pdf
- $@
356 zconf.h.cmakein
: $(SRCDIR
)zconf.h.in
357 -@ TEMPFILE
=zconfh_
$$; \
358 echo
"/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" >> $$TEMPFILE &&\
359 sed
-f
$$TEMPFILE $(SRCDIR
)zconf.h.in
> $@
&&\
360 touch
-r
$(SRCDIR
)zconf.h.in
$@
&&\
363 zconf
: $(SRCDIR
)zconf.h.in
364 cp
-p
$(SRCDIR
)zconf.h.in zconf.h
369 example
$(EXE
) minigzip
$(EXE
) examplesh
$(EXE
) minigzipsh
$(EXE
) \
370 example64
$(EXE
) minigzip64
$(EXE
) \
372 libz.
* foo.gz so_locations \
373 _match.s maketree contrib
/infback9
/*.o
375 rm -f
*.gcda
*.gcno
*.gcov
376 rm -f contrib
/infback9
/*.gcda contrib
/infback9
/*.gcno contrib
/infback9
/*.gcov
378 maintainer-clean
: distclean
379 distclean: clean zconf zconf.h.cmakein docs
380 rm -f Makefile zlib.
pc configure.log
382 @if
[ -f Makefile.in
]; then \
383 printf
'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile
; \
384 printf
'\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile
; \
385 touch
-r
$(SRCDIR
)Makefile.in Makefile
; fi
386 @if
[ ! -f zconf.h.in
]; then
rm -f zconf.h zconf.h.cmakein
; fi
387 @if
[ ! -f zlib
.3 ]; then
rm -f zlib
.3.pdf
; fi
390 etags
$(SRCDIR
)*.
[ch
]
392 adler32.o zutil.o
: $(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
393 gzclose.o gzlib.o gzread.o gzwrite.o
: $(SRCDIR
)zlib.h zconf.h
$(SRCDIR
)gzguts.h
394 compress.o example.o minigzip.o uncompr.o
: $(SRCDIR
)zlib.h zconf.h
395 crc32.o
: $(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
$(SRCDIR
)crc32.h
396 deflate.o
: $(SRCDIR
)deflate.h
$(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
397 infback.o inflate.o
: $(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
$(SRCDIR
)inftrees.h
$(SRCDIR
)inflate.h
$(SRCDIR
)inffast.h
$(SRCDIR
)inffixed.h
398 inffast.o
: $(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
$(SRCDIR
)inftrees.h
$(SRCDIR
)inflate.h
$(SRCDIR
)inffast.h
399 inftrees.o
: $(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
$(SRCDIR
)inftrees.h
400 trees.o
: $(SRCDIR
)deflate.h
$(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
$(SRCDIR
)trees.h
402 adler32.lo zutil.lo
: $(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
403 gzclose.lo gzlib.lo gzread.lo gzwrite.lo
: $(SRCDIR
)zlib.h zconf.h
$(SRCDIR
)gzguts.h
404 compress.lo example.lo minigzip.lo uncompr.lo
: $(SRCDIR
)zlib.h zconf.h
405 crc32.lo
: $(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
$(SRCDIR
)crc32.h
406 deflate.lo
: $(SRCDIR
)deflate.h
$(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
407 infback.lo inflate.lo
: $(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
$(SRCDIR
)inftrees.h
$(SRCDIR
)inflate.h
$(SRCDIR
)inffast.h
$(SRCDIR
)inffixed.h
408 inffast.lo
: $(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
$(SRCDIR
)inftrees.h
$(SRCDIR
)inflate.h
$(SRCDIR
)inffast.h
409 inftrees.lo
: $(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
$(SRCDIR
)inftrees.h
410 trees.lo
: $(SRCDIR
)deflate.h
$(SRCDIR
)zutil.h
$(SRCDIR
)zlib.h zconf.h
$(SRCDIR
)trees.h