]> git.lizzy.rs Git - zlib.git/blob - Makefile.in
Add a ./config --solo option to make zlib subset with no libary use
[zlib.git] / Makefile.in
1 # Makefile for zlib
2 # Copyright (C) 1995-2011 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 LDFLAGS=
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.5.2
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 sharedlibdir = ${libdir}
51 includedir = ${prefix}/include
52 mandir = ${prefix}/share/man
53 man3dir = ${mandir}/man3
54 pkgconfigdir = ${libdir}/pkgconfig
55 tempfile := $(shell mktemp -u __XXXXXX)
56
57 OBJZ = adler32.o crc32.o deflate.o infback.o inffast.o inflate.o inftrees.o trees.o zutil.o
58 OBJG = compress.o uncompr.o gzclose.o gzlib.o gzread.o gzwrite.o
59 OBJC = $(OBJZ) $(OBJG)
60
61 PIC_OBJZ = adler32.lo crc32.lo deflate.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo zutil.lo
62 PIC_OBJG = compress.lo uncompr.lo gzclose.lo gzlib.lo gzread.lo gzwrite.lo
63 PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
64
65 # to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
66 OBJA =
67 PIC_OBJA =
68
69 OBJS = $(OBJC) $(OBJA)
70
71 PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
72
73 all: static shared
74
75 static: example$(EXE) minigzip$(EXE)
76
77 shared: examplesh$(EXE) minigzipsh$(EXE)
78
79 all64: example64$(EXE) minigzip64$(EXE)
80
81 check: test
82
83 test: all teststatic testshared
84
85 teststatic: static
86         @if echo hello world | ./minigzip | ./minigzip -d && ./example; then \
87           echo '                *** zlib test OK ***'; \
88         else \
89           echo '                *** zlib test FAILED ***'; false; \
90         fi
91         -@rm -f foo.gz
92
93 testshared: shared
94         @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
95         LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
96         DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
97         SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
98         if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh; then \
99           echo '                *** zlib shared test OK ***'; \
100         else \
101           echo '                *** zlib shared test FAILED ***'; false; \
102         fi
103         -@rm -f foo.gz
104
105 test64: all64
106         @if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64; then \
107           echo '                *** zlib 64-bit test OK ***'; \
108         else \
109           echo '                *** zlib 64-bit test FAILED ***'; false; \
110         fi
111         -@rm -f foo.gz
112
113 libz.a: $(OBJS)
114         $(AR) $@ $(OBJS)
115         -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
116
117 match.o: match.S
118         $(CPP) match.S > _match.s
119         $(CC) -c _match.s
120         mv _match.o match.o
121         rm -f _match.s
122
123 match.lo: match.S
124         $(CPP) match.S > _match.s
125         $(CC) -c -fPIC _match.s
126         mv _match.o match.lo
127         rm -f _match.s
128
129 example64.o: example.c zlib.h zconf.h
130         $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ example.c
131
132 minigzip64.o: minigzip.c zlib.h zconf.h
133         $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ minigzip.c
134
135 .SUFFIXES: .lo
136
137 .c.lo:
138         -@mkdir objs 2>/dev/null || test -d objs
139         $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
140         -@mv objs/$*.o $@
141
142 placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a
143         $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
144         rm -f $(SHAREDLIB) $(SHAREDLIBM)
145         ln -s $@ $(SHAREDLIB)
146         ln -s $@ $(SHAREDLIBM)
147         -@rmdir objs
148
149 example$(EXE): example.o $(STATICLIB)
150         $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
151
152 minigzip$(EXE): minigzip.o $(STATICLIB)
153         $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
154
155 examplesh$(EXE): example.o $(SHAREDLIBV)
156         $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
157
158 minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
159         $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
160
161 example64$(EXE): example64.o $(STATICLIB)
162         $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
163
164 minigzip64$(EXE): minigzip64.o $(STATICLIB)
165         $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
166
167 install-libs: $(LIBS)
168         -@if [ ! -d $(DESTDIR)$(exec_prefix)  ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
169         -@if [ ! -d $(DESTDIR)$(libdir)       ]; then mkdir -p $(DESTDIR)$(libdir); fi
170         -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
171         -@if [ ! -d $(DESTDIR)$(man3dir)      ]; then mkdir -p $(DESTDIR)$(man3dir); fi
172         -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
173         cp $(STATICLIB) $(DESTDIR)$(libdir)
174         chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
175         -@($(RANLIB) $(DESTDIR)$(libdir)/libz.a || true) >/dev/null 2>&1
176         -@if test -n "$(SHAREDLIBV)"; then \
177           cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir); \
178           echo "cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)"; \
179           chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV); \
180           echo "chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBV)"; \
181           rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
182           ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB); \
183           ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM); \
184           ($(LDCONFIG) || true)  >/dev/null 2>&1; \
185         fi
186         cp zlib.3 $(DESTDIR)$(man3dir)
187         chmod 644 $(DESTDIR)$(man3dir)/zlib.3
188         cp zlib.pc $(DESTDIR)$(pkgconfigdir)
189         chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
190 # The ranlib in install is needed on NeXTSTEP which checks file times
191 # ldconfig is for Linux
192
193 install: install-libs
194         -@if [ ! -d $(DESTDIR)$(includedir)   ]; then mkdir -p $(DESTDIR)$(includedir); fi
195         cp zlib.h zconf.h $(DESTDIR)$(includedir)
196         chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
197
198 uninstall:
199         cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h
200         cd $(DESTDIR)$(libdir); rm -f libz.a; \
201         if test -n "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
202           rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
203         fi
204         cd $(DESTDIR)$(man3dir); rm -f zlib.3
205         cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc
206
207 docs: zlib.3.pdf
208
209 zlib.3.pdf: zlib.3
210         groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf
211
212 zconf.h.cmakein: zconf.h.in
213         -@echo "/#define ZCONF_H/ a\\\\\n#cmakedefine Z_PREFIX\\\\\n#cmakedefine Z_HAVE_UNISTD_H\n" > $(tempfile)
214         -@sed -f $(tempfile) zconf.h.in > zconf.h.cmakein
215         -@touch -r zconf.h.in zconf.h.cmakein
216         -@rm $(tempfile)
217
218 zconf: zconf.h.in
219         cp -p zconf.h.in zconf.h
220
221 mostlyclean: clean
222 clean:
223         rm -f *.o *.lo *~ \
224            example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
225            example64$(EXE) minigzip64$(EXE) \
226            libz.* foo.gz so_locations \
227            _match.s maketree contrib/infback9/*.o
228         rm -rf objs
229
230 maintainer-clean: distclean
231 distclean: clean zconf zconf.h.cmakein docs
232         rm -f Makefile zlib.pc
233         -@rm -f .DS_Store
234         -@printf 'all:\n\t-@echo "Please use ./configure first.  Thank you."\n' > Makefile
235         -@printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile
236         -@touch -r Makefile.in Makefile
237
238 tags:
239         etags *.[ch]
240
241 depend:
242         makedepend -- $(CFLAGS) -- *.[ch]
243
244 # DO NOT DELETE THIS LINE -- make depend depends on it.
245
246 adler32.o zutil.o: zutil.h zlib.h zconf.h
247 gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h gzguts.h
248 compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h
249 crc32.o: zutil.h zlib.h zconf.h crc32.h
250 deflate.o: deflate.h zutil.h zlib.h zconf.h
251 infback.o inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
252 inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
253 inftrees.o: zutil.h zlib.h zconf.h inftrees.h
254 trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
255
256 adler32.lo zutil.lo: zutil.h zlib.h zconf.h
257 gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h gzguts.h
258 compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h
259 crc32.lo: zutil.h zlib.h zconf.h crc32.h
260 deflate.lo: deflate.h zutil.h zlib.h zconf.h
261 infback.lo inflate.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
262 inffast.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
263 inftrees.lo: zutil.h zlib.h zconf.h inftrees.h
264 trees.lo: deflate.h zutil.h zlib.h zconf.h trees.h