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 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
33 SHAREDLIBV=libz.so.1.2.1
43 exec_prefix = ${prefix}
44 libdir = ${exec_prefix}/lib
45 includedir = ${prefix}/include
46 mandir = ${prefix}/share/man
47 man3dir = ${mandir}/man3
49 OBJS = adler32.o compress.o crc32.o gzio.o uncompr.o deflate.o trees.o \
50 zutil.o inflate.o infback.o inftrees.o inffast.o
53 # to use the asm code: make OBJA=match.o
55 TEST_OBJS = example.o minigzip.o
57 all: example$(EXE) minigzip$(EXE)
61 @LD_LIBRARY_PATH=.:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
62 echo hello world | ./minigzip | ./minigzip -d || \
63 echo ' *** minigzip test FAILED ***' ; \
65 echo ' *** zlib test OK ***'; \
67 echo ' *** zlib test FAILED ***'; \
70 libz.a: $(OBJS) $(OBJA)
71 $(AR) $@ $(OBJS) $(OBJA)
72 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
75 $(CPP) match.S > _match.s
80 $(SHAREDLIBV): $(OBJS)
81 $(LDSHARED) -o $@ $(OBJS)
82 rm -f $(SHAREDLIB) $(SHAREDLIBM)
84 ln -s $@ $(SHAREDLIBM)
86 example$(EXE): example.o $(LIBS)
87 $(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS)
89 minigzip$(EXE): minigzip.o $(LIBS)
90 $(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS)
93 -@if [ ! -d $(exec_prefix) ]; then mkdir -p $(exec_prefix); fi
94 -@if [ ! -d $(includedir) ]; then mkdir -p $(includedir); fi
95 -@if [ ! -d $(libdir) ]; then mkdir -p $(libdir); fi
96 -@if [ ! -d $(man3dir) ]; then mkdir -p $(man3dir); fi
97 cp zlib.h zconf.h $(includedir)
98 chmod 644 $(includedir)/zlib.h $(includedir)/zconf.h
100 cd $(libdir); chmod 755 $(LIBS)
101 -@(cd $(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
102 cd $(libdir); if test -f $(SHAREDLIBV); then \
103 rm -f $(SHAREDLIB) $(SHAREDLIBM); \
104 ln -s $(SHAREDLIBV) $(SHAREDLIB); \
105 ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
106 (ldconfig || true) >/dev/null 2>&1; \
109 chmod 644 $(man3dir)/zlib.3
110 # The ranlib in install is needed on NeXTSTEP which checks file times
111 # ldconfig is for Linux
115 cd $(libdir); rm -f libz.a; \
116 if test -f $(SHAREDLIBV); then \
117 rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
119 cd $(man3dir); rm -f zlib.3
123 rm -f *.o *~ example$(EXE) minigzip$(EXE) \
124 libz.* foo.gz so_locations \
125 _match.s maketree contrib/infback9/*.o
127 maintainer-clean: distclean
129 cp -p Makefile.in Makefile
130 cp -p zconf.in.h zconf.h
137 makedepend -- $(CFLAGS) -- *.[ch]
139 # DO NOT DELETE THIS LINE -- make depend depends on it.
141 adler32.o: zlib.h zconf.h
142 compress.o: zlib.h zconf.h
143 crc32.o: crc32.h zlib.h zconf.h
144 deflate.o: deflate.h zutil.h zlib.h zconf.h
145 example.o: zlib.h zconf.h
146 gzio.o: zutil.h zlib.h zconf.h
147 inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
148 inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
149 infback.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
150 inftrees.o: zutil.h zlib.h zconf.h inftrees.h
151 minigzip.o: zlib.h zconf.h
152 trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
153 uncompr.o: zlib.h zconf.h
154 zutil.o: zutil.h zlib.h zconf.h