]> git.lizzy.rs Git - zlib.git/blob - Makefile.in
zlib 1.2.4.3
[zlib.git] / Makefile.in
1 # Makefile for zlib
2 # Copyright (C) 1995-2010 Jean-loup Gailly.
3 # For conditions of distribution and use, see copyright notice in zlib.h
4
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
9
10 # To use the asm code, type:
11 #    cp contrib/asm?86/match.S ./match.S
12 #    make LOC=-DASMV OBJA=match.o
13
14 # To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
15 #    make install
16 # To install in $HOME instead of /usr/local, use:
17 #    make install prefix=$HOME
18
19 CC=cc
20
21 CFLAGS=-O
22 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
23 #CFLAGS=-g -DDEBUG
24 #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
25 #           -Wstrict-prototypes -Wmissing-prototypes
26
27 SFLAGS=-O
28
29 TEST_LDFLAGS=-L. libz.a
30 LDSHARED=$(CC)
31 CPP=$(CC) -E
32
33 STATICLIB=libz.a
34 SHAREDLIB=libz.so
35 SHAREDLIBV=libz.so.1.2.4.3
36 SHAREDLIBM=libz.so.1
37 LIBS=$(STATICLIB) $(SHAREDLIBV)
38
39 AR=ar rc
40 RANLIB=ranlib
41 LDCONFIG=ldconfig
42 LDSHAREDLIBC=-lc
43 TAR=tar
44 SHELL=/bin/sh
45 EXE=
46
47 prefix = /usr/local
48 exec_prefix = ${prefix}
49 libdir = ${exec_prefix}/lib
50 includedir = ${prefix}/include
51 mandir = ${prefix}/share/man
52 man3dir = ${mandir}/man3
53 pkgconfigdir = ${libdir}/pkgconfig
54
55 OBJC = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
56         gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
57
58 PIC_OBJC = adler32.lo compress.lo crc32.lo deflate.lo gzclose.lo gzlib.lo gzread.lo \
59         gzwrite.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo
60
61 # to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
62 OBJA =
63 PIC_OBJA =
64
65 OBJS = $(OBJC) $(OBJA)
66
67 PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
68
69 all: static shared
70
71 static: example$(EXE) minigzip$(EXE)
72
73 shared: examplesh$(EXE) minigzipsh$(EXE)
74
75 all64: example64$(EXE) minigzip64$(EXE)
76
77 check: test
78
79 test: all teststatic testshared
80
81 teststatic: static
82         @if echo hello world | ./minigzip | ./minigzip -d && ./example; then \
83           echo '                *** zlib test OK ***'; \
84         else \
85           echo '                *** zlib test FAILED ***'; false; \
86         fi
87         -@rm -f foo.gz
88
89 testshared: shared
90         @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
91         LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
92         DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
93         SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
94         if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh; then \
95           echo '                *** zlib shared test OK ***'; \
96         else \
97           echo '                *** zlib shared test FAILED ***'; false; \
98         fi
99         -@rm -f foo.gz
100
101 test64: all64
102         @if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64; then \
103           echo '                *** zlib 64-bit test OK ***'; \
104         else \
105           echo '                *** zlib 64-bit test FAILED ***'; false; \
106         fi
107         -@rm -f foo.gz
108
109 libz.a: $(OBJS)
110         $(AR) $@ $(OBJS)
111         -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
112
113 match.o: match.S
114         $(CPP) match.S > _match.s
115         $(CC) -c _match.s
116         mv _match.o match.o
117         rm -f _match.s
118
119 match.lo: match.S
120         $(CPP) match.S > _match.s
121         $(CC) -c -fPIC _match.s
122         mv _match.o match.lo
123         rm -f _match.s
124
125 example64.o: example.c zlib.h zconf.h
126         $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ example.c
127
128 minigzip64.o: minigzip.c zlib.h zconf.h
129         $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ minigzip.c
130
131 .SUFFIXES: .lo
132
133 .c.lo:
134         -@if [ ! -d objs ]; then mkdir objs; fi
135         $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
136         -@mv objs/$*.o $@
137
138 $(SHAREDLIBV): $(PIC_OBJS)
139         $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
140         rm -f $(SHAREDLIB) $(SHAREDLIBM)
141         ln -s $@ $(SHAREDLIB)
142         ln -s $@ $(SHAREDLIBM)
143         -@rmdir objs
144
145 example$(EXE): example.o $(STATICLIB)
146         $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
147
148 minigzip$(EXE): minigzip.o $(STATICLIB)
149         $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
150
151 examplesh$(EXE): example.o $(SHAREDLIBV)
152         $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
153
154 minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
155         $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
156
157 example64$(EXE): example64.o $(STATICLIB)
158         $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
159
160 minigzip64$(EXE): minigzip64.o $(STATICLIB)
161         $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
162
163 install-libs: $(LIBS)
164         -@if [ ! -d $(DESTDIR)$(exec_prefix)  ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
165         -@if [ ! -d $(DESTDIR)$(libdir)       ]; then mkdir -p $(DESTDIR)$(libdir); fi
166         -@if [ ! -d $(DESTDIR)$(man3dir)      ]; then mkdir -p $(DESTDIR)$(man3dir); fi
167         -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
168         cp $(LIBS) $(DESTDIR)$(libdir)
169         cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB)
170         -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
171         -@cd $(DESTDIR)$(libdir); if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
172           chmod 755 $(SHAREDLIBV); \
173           rm -f $(SHAREDLIB) $(SHAREDLIBM); \
174           ln -s $(SHAREDLIBV) $(SHAREDLIB); \
175           ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
176           ($(LDCONFIG) || true)  >/dev/null 2>&1; \
177         fi
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
184
185 install: install-libs
186         -@if [ ! -d $(DESTDIR)$(includedir)   ]; then mkdir -p $(DESTDIR)$(includedir); fi
187         cp zlib.h zconf.h $(DESTDIR)$(includedir)
188         chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
189
190 uninstall:
191         cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h
192         cd $(DESTDIR)$(libdir); rm -f libz.a; \
193         if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
194           rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
195         fi
196         cd $(DESTDIR)$(man3dir); rm -f zlib.3
197         cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc
198
199 docs: zlib.3.pdf
200
201 zlib.3.pdf: zlib.3
202         groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf
203
204 zconf.h.in: zconf.h.cmakein
205         sed "/^#cmakedefine/D" < zconf.h.cmakein > zconf.h.in
206         touch -r zconf.h.cmakein zconf.h.in
207
208 zconf: zconf.h.in
209         cp -p zconf.h.in zconf.h
210
211 mostlyclean: clean
212 clean:
213         rm -f *.o *.lo *~ \
214            example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
215            example64$(EXE) minigzip64$(EXE) \
216            libz.* foo.gz so_locations \
217            _match.s maketree contrib/infback9/*.o
218         rm -rf objs
219
220 maintainer-clean: distclean
221 distclean: clean zconf docs
222         rm -f Makefile zlib.pc
223         -@rm -f .DS_Store
224         -@printf 'all:\n\t-@echo "Please use ./configure first.  Thank you."\n' > Makefile
225         -@printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile
226         -@touch -r Makefile.in Makefile
227
228 tags:
229         etags *.[ch]
230
231 depend:
232         makedepend -- $(CFLAGS) -- *.[ch]
233
234 # DO NOT DELETE THIS LINE -- make depend depends on it.
235
236 adler32.o zutil.o: zutil.h zlib.h zconf.h
237 gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h gzguts.h
238 compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h
239 crc32.o: zutil.h zlib.h zconf.h crc32.h
240 deflate.o: deflate.h zutil.h zlib.h zconf.h
241 infback.o inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
242 inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
243 inftrees.o: zutil.h zlib.h zconf.h inftrees.h
244 trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
245
246 adler32.lo zutil.lo: zutil.h zlib.h zconf.h
247 gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h gzguts.h
248 compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h
249 crc32.lo: zutil.h zlib.h zconf.h crc32.h
250 deflate.lo: deflate.h zutil.h zlib.h zconf.h
251 infback.lo inflate.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
252 inffast.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
253 inftrees.lo: zutil.h zlib.h zconf.h inftrees.h
254 trees.lo: deflate.h zutil.h zlib.h zconf.h trees.h