2 # Copyright (C) 1995-2003 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 # The call of configure is optional if you don't have special requirements
8 # If you wish to build zlib as a shared library, use: ./configure -s
10 # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
12 # To install in $HOME instead of /usr/local, use:
13 # make install prefix=$HOME
18 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
20 #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
21 # -Wstrict-prototypes -Wmissing-prototypes
37 exec_prefix = ${prefix}
38 libdir = ${exec_prefix}/lib
39 includedir = ${prefix}/include
41 OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
42 zutil.o inflate.o infback.o inftrees.o inffast.o
45 # to use the asm code: make OBJA=match.o
47 TEST_OBJS = example.o minigzip.o
49 # Note: this hasn't been updated for zlib 1.2.0
50 DISTFILES = README FAQ INDEX ChangeLog configure Make*[a-z0-9] *.[ch] *.mms \
51 algorithm.txt zlib.3 zlib.html \
52 msdos/Make*[a-z0-9] msdos/zlib.def msdos/zlib.rc \
53 nt/Make*[a-z0-9] nt/zlib.dnt amiga/Make*.??? os2/M*.os2 os2/zlib.def \
54 contrib/RE*.contrib contrib/*.txt contrib/asm386/*.asm contrib/asm386/*.c \
55 contrib/asm386/*.bat contrib/asm386/zlibvc.d?? contrib/asm[56]86/*.?86 \
56 contrib/asm[56]86/*.S contrib/iostream/*.cpp \
57 contrib/iostream/*.h contrib/iostream2/*.h contrib/iostream2/*.cpp \
58 contrib/untgz/Makefile contrib/untgz/*.c contrib/untgz/*.w32 \
59 contrib/minizip/[CM]*[pe] contrib/minizip/*.[ch] contrib/minizip/*.[td]?? \
66 @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
67 echo hello world | ./minigzip | ./minigzip -d || \
68 echo ' *** minigzip test FAILED ***' ; \
70 echo ' *** zlib test OK ***'; \
72 echo ' *** zlib test FAILED ***'; \
75 libz.a: $(OBJS) $(OBJA)
76 $(AR) $@ $(OBJS) $(OBJA)
77 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
80 $(CPP) match.S > _match.s
85 $(SHAREDLIB).$(VER): $(OBJS)
86 $(LDSHARED) -o $@ $(OBJS)
87 rm -f $(SHAREDLIB) $(SHAREDLIB).1
89 ln -s $@ $(SHAREDLIB).1
91 example: example.o $(LIBS)
92 $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
94 minigzip: minigzip.o $(LIBS)
95 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
98 -@if [ ! -d $(exec_prefix) ]; then mkdir $(exec_prefix); fi
99 -@if [ ! -d $(includedir) ]; then mkdir $(includedir); fi
100 -@if [ ! -d $(libdir) ]; then mkdir $(libdir); fi
101 cp zlib.h zconf.h $(includedir)
102 chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
104 cd $(libdir); chmod 755 $(LIBS)
105 -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
106 cd $(libdir); if test -f $(SHAREDLIB).$(VER); then \
107 rm -f $(SHAREDLIB) $(SHAREDLIB).1; \
108 ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB); \
109 ln -s $(SHAREDLIB).$(VER) $(SHAREDLIB).1; \
110 (ldconfig || true) >/dev/null 2>&1; \
112 # The ranlib in install is needed on NeXTSTEP which checks file times
113 # ldconfig is for Linux
118 if test -f zlib.h; then \
119 v=`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`; \
120 rm -f zlib.h zconf.h; \
122 cd $(libdir); rm -f libz.a; \
123 if test -f $(SHAREDLIB).$$v; then \
124 rm -f $(SHAREDLIB).$$v $(SHAREDLIB) $(SHAREDLIB).1; \
129 rm -f *.o *~ example minigzip libz.a libz.so* foo.gz so_locations \
132 maintainer-clean: distclean
134 cp -p Makefile.in Makefile
135 cp -p zconf.in.h zconf.h
138 mv Makefile Makefile~; cp -p Makefile.in Makefile
139 rm -f test.c ztest*.c contrib/minizip/test.zip
140 v=`sed -n -e 's/\.//g' -e '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
141 zip -ul9 zlib$$v $(DISTFILES)
142 mv Makefile~ Makefile
145 echo Warning: this hasn't been updated for zlib 1.2.0 -- don't use
146 mv Makefile Makefile~; cp -p Makefile.in Makefile
147 rm -f test.c ztest*.c contrib/minizip/test.zip
148 d=zlib-`sed -n '/VERSION "/s/.*"\(.*\)".*/\1/p' < zlib.h`;\
150 if test ! -d ../$$d; then rm -f ../$$d; ln -s `pwd` ../$$d; fi; \
152 for f in $(DISTFILES); do files="$$files $$d/$$f"; done; \
154 GZIP=-9 $(TAR) chofz $$d/$$d.tar.gz $$files; \
155 if test ! -d $$d; then rm -f $$d; fi
156 mv Makefile~ Makefile
162 makedepend -- $(CFLAGS) -- *.[ch]
164 # DO NOT DELETE THIS LINE -- make depend depends on it.
166 adler32.o: zlib.h zconf.h
167 compress.o: zlib.h zconf.h
168 crc32.o: crc32.h zlib.h zconf.h
169 deflate.o: deflate.h zutil.h zlib.h zconf.h
170 example.o: zlib.h zconf.h
171 gzio.o: zutil.h zlib.h zconf.h
172 inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
173 inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
174 infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
175 inftrees.o: zutil.h zlib.h zconf.h inftrees.h
176 minigzip.o: zlib.h zconf.h
177 trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
178 uncompr.o: zlib.h zconf.h
179 zutil.o: zutil.h zlib.h zconf.h