Debian Codegraph @

ext/zlib-ng/Makefile.in

raw
1 # Makefile for zlib
2 # Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
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 install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
11 # make install
12 # To install in $HOME instead of /usr/local, use:
13 # make install prefix=$HOME
14
15 CC=cc
16
17 CFLAGS=-O
18 #CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
19 #CFLAGS=-g -DZLIB_DEBUG
20 #CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
21 # -Wstrict-prototypes -Wmissing-prototypes
22
23 SFLAGS=-O
24 LDFLAGS=-L.
25 LIBNAME1=libz-ng
26 LIBNAME2=zlib-ng
27 SUFFIX=-ng
28 TEST_LIBS=$(LIBNAME1).a
29 LDSHARED=$(CC)
30 LDSHAREDFLAGS=-shared
31
32 VER=2.1.0.devel
33 VER1=2
34
35 STATICLIB=$(LIBNAME1).a
36 SHAREDLIB=$(LIBNAME1).so
37 SHAREDLIBV=$(LIBNAME1).so.$(VER)
38 SHAREDLIBM=$(LIBNAME1).so.$(VER1)
39 IMPORTLIB=
40 SHAREDTARGET=$(LIBNAME1).so.$(VER)
41 PKGFILE=$(LIBNAME2).pc
42
43 LIBS=$(STATICLIB) $(SHAREDTARGET)
44
45 AR=ar
46 ARFLAGS=rc
47 DEFFILE=
48 RC=
49 RCFLAGS=
50 RCOBJS=
51 STRIP=
52 RANLIB=ranlib
53 LDCONFIG=ldconfig
54 LDSHAREDLIBC=
55 EXE=
56
57 SRCDIR=.
58 INCLUDES=-I$(SRCDIR)
59
60 BUILDDIR=.
61
62 ARCHDIR=arch/generic
63 ARCH_STATIC_OBJS=
64 ARCH_SHARED_OBJS=
65
66 prefix = /usr/local
67 exec_prefix = ${prefix}
68 bindir = ${exec_prefix}/bin
69 libdir = ${exec_prefix}/lib
70 sharedlibdir = ${libdir}
71 includedir = ${prefix}/include
72 mandir = ${prefix}/share/man
73 man3dir = ${mandir}/man3
74 pkgconfigdir = ${libdir}/pkgconfig
75
76 OBJZ = \
77 adler32.o \
78 adler32_fold.o \
79 chunkset.o \
80 compare256.o \
81 compress.o \
82 cpu_features.o \
83 crc32_braid.o \
84 crc32_braid_comb.o \
85 crc32_fold.o \
86 deflate.o \
87 deflate_fast.o \
88 deflate_huff.o \
89 deflate_medium.o \
90 deflate_quick.o \
91 deflate_rle.o \
92 deflate_slow.o \
93 deflate_stored.o \
94 functable.o \
95 infback.o \
96 inffast.o \
97 inflate.o \
98 inftrees.o \
99 insert_string.o \
100 insert_string_roll.o \
101 slide_hash.o \
102 trees.o \
103 uncompr.o \
104 zutil.o \
105 $(ARCH_STATIC_OBJS)
106
107 OBJG = \
108 gzlib.o \
109 gzread.o \
110 gzwrite.o
111
112 OBJC = $(OBJZ) $(OBJG)
113
114 PIC_OBJZ = \
115 adler32.lo \
116 adler32_fold.lo \
117 chunkset.lo \
118 compare256.lo \
119 compress.lo \
120 cpu_features.lo \
121 crc32_braid.lo \
122 crc32_braid_comb.lo \
123 crc32_fold.lo \
124 deflate.lo \
125 deflate_fast.lo \
126 deflate_huff.lo \
127 deflate_medium.lo \
128 deflate_quick.lo \
129 deflate_rle.lo \
130 deflate_slow.lo \
131 deflate_stored.lo \
132 functable.lo \
133 infback.lo \
134 inffast.lo \
135 inflate.lo \
136 inftrees.lo \
137 insert_string.lo \
138 insert_string_roll.lo \
139 slide_hash.lo \
140 trees.lo \
141 uncompr.lo \
142 zutil.lo \
143 $(ARCH_SHARED_OBJS)
144
145 PIC_OBJG = \
146 gzlib.lo \
147 gzread.lo \
148 gzwrite.lo
149
150 PIC_TESTOBJG =
151 PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
152
153 OBJS = $(OBJC)
154
155 PIC_OBJS = $(PIC_OBJC)
156
157 all: static shared
158
159 static: example$(EXE) minigzip$(EXE) makefixed$(EXE) maketrees$(EXE) makecrct$(EXE)
160
161 shared: examplesh$(EXE) minigzipsh$(EXE)
162
163 check: test
164
165 .SECONDARY:
166
167 $(ARCHDIR)/%.o: $(SRCDIR)/$(ARCHDIR)/%.c
168 $(MAKE) -C $(ARCHDIR) $(notdir $@)
169
170 $(ARCHDIR)/%.lo: $(SRCDIR)/$(ARCHDIR)/%.c
171 $(MAKE) -C $(ARCHDIR) $(notdir $@)
172
173 %.o: $(ARCHDIR)/%.o
174 -cp $< $@
175
176 %.lo: $(ARCHDIR)/%.lo
177 -cp $< $@
178
179 test: all
180 $(MAKE) -C test
181
182 infcover.o: $(SRCDIR)/test/infcover.c zlib$(SUFFIX).h zconf$(SUFFIX).h zlib_name_mangling$(SUFFIX).h
183 $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/infcover.c
184
185 infcover$(EXE): infcover.o $(STATICLIB)
186 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ infcover.o $(STATICLIB)
187 ifneq ($(STRIP),)
188 $(STRIP) $@
189 endif
190
191 cover: infcover$(EXE)
192 rm -f *.gcda
193 ./infcover
194 gcov inf*.c
195
196 $(STATICLIB): $(OBJS)
197 $(AR) $(ARFLAGS) $@ $(OBJS)
198 -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
199
200 example.o:
201 $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $(SRCDIR)/test/example.c
202
203 minigzip.o:
204 $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $(SRCDIR)/test/minigzip.c
205
206 makefixed.o:
207 $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/makefixed.c
208
209 maketrees.o:
210 $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/maketrees.c
211
212 makecrct.o:
213 $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/makecrct.c
214
215 zlibrc.o: win32/zlib$(SUFFIX)1.rc
216 $(RC) $(RCFLAGS) -o $@ win32/zlib$(SUFFIX)1.rc
217
218 .SUFFIXES: .lo
219
220 %.o: $(SRCDIR)/%.c
221 $(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
222
223 %.lo: $(SRCDIR)/%.c
224 $(CC) $(SFLAGS) -DPIC $(INCLUDES) -c -o $@ $<
225
226 gzlib.o: $(SRCDIR)/gzlib.c
227 $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
228
229 gzlib.lo: $(SRCDIR)/gzlib.c
230 $(CC) $(SFLAGS) -DPIC -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
231
232 gzread.o: gzread.c
233 $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
234
235 gzread.lo: gzread.c
236 $(CC) $(SFLAGS) -DPIC -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
237
238 gzwrite.o: $(SRCDIR)/gzwrite.c
239 $(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
240
241 gzwrite.lo: $(SRCDIR)/gzwrite.c
242 $(CC) $(SFLAGS) -DPIC -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
243
244 $(SHAREDTARGET): $(PIC_OBJS) $(DEFFILE) $(RCOBJS)
245 ifneq ($(SHAREDTARGET),)
246 $(LDSHARED) $(CFLAGS) $(LDSHAREDFLAGS) $(LDFLAGS) -o $@ $(DEFFILE) $(PIC_OBJS) $(RCOBJS) $(LDSHAREDLIBC)
247 ifneq ($(STRIP),)
248 $(STRIP) $@
249 endif
250 ifneq ($(SHAREDLIB),$(SHAREDTARGET))
251 rm -f $(SHAREDLIB) $(SHAREDLIBM)
252 ln -s $@ $(SHAREDLIB)
253 ln -s $@ $(SHAREDLIBM)
254 endif
255 endif
256
257 example$(EXE): example.o $(OBJG) $(STATICLIB)
258 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
259 ifneq ($(STRIP),)
260 $(STRIP) $@
261 endif
262
263 minigzip$(EXE): minigzip.o $(OBJG) $(STATICLIB)
264 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
265 ifneq ($(STRIP),)
266 $(STRIP) $@
267 endif
268
269 minigzipsh$(EXE): minigzip.o $(OBJG) $(SHAREDTARGET)
270 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(OBJG) $(SHAREDTARGET) $(LDSHAREDLIBC)
271 ifneq ($(STRIP),)
272 $(STRIP) $@
273 endif
274
275
276 examplesh$(EXE): example.o $(PIC_TESTOBJG) $(SHAREDTARGET)
277 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(PIC_TESTOBJG) $(SHAREDTARGET) $(LDSHAREDLIBC)
278 ifneq ($(STRIP),)
279 $(STRIP) $@
280 endif
281
282 makefixed$(EXE): makefixed.o $(OBJG) $(STATICLIB)
283 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ makefixed.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
284 ifneq ($(STRIP),)
285 $(STRIP) $@
286 endif
287
288 maketrees$(EXE): maketrees.o $(OBJG) $(STATICLIB)
289 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ maketrees.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
290 ifneq ($(STRIP),)
291 $(STRIP) $@
292 endif
293
294 makecrct$(EXE): makecrct.o $(OBJG) $(STATICLIB)
295 $(CC) $(CFLAGS) $(LDFLAGS) -o $@ makecrct.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
296 ifneq ($(STRIP),)
297 $(STRIP) $@
298 endif
299
300 install-shared: $(SHAREDTARGET)
301 ifneq ($(SHAREDTARGET),)
302 -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
303 rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDTARGET)
304 cp $(SHAREDTARGET) $(DESTDIR)$(sharedlibdir)
305 chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDTARGET)
306 ifneq ($(SHAREDLIB),$(SHAREDTARGET))
307 rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM)
308 ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB)
309 ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM)
310 ($(LDCONFIG) || true) >/dev/null 2>&1
311 # ldconfig is for Linux
312 endif
313 ifneq ($(IMPORTLIB),)
314 cp $(IMPORTLIB) $(DESTDIR)$(sharedlibdir)
315 chmod 644 $(DESTDIR)$(sharedlibdir)/$(IMPORTLIB)
316 endif
317 endif
318
319 install-static: $(STATICLIB)
320 -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
321 rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
322 cp $(STATICLIB) $(DESTDIR)$(libdir)
323 chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
324 -@($(RANLIB) $(DESTDIR)$(libdir)/$(STATICLIB) || true) >/dev/null 2>&1
325 # The ranlib in install-static is needed on NeXTSTEP which checks file times
326
327 install-libs: install-shared install-static
328 -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
329 -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
330 rm -f $(DESTDIR)$(pkgconfigdir)/$(PKGFILE)
331 cp $(PKGFILE) $(DESTDIR)$(pkgconfigdir)
332 chmod 644 $(DESTDIR)$(pkgconfigdir)/$(PKGFILE)
333
334 install: install-libs
335 -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
336 rm -f $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h $(DESTDIR)$(includedir)/zlib_name_mangling$(SUFFIX).h
337 cp zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zlib$(SUFFIX).h
338 cp zconf$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h
339 cp zlib_name_mangling$(SUFFIX).h $(DESTDIR)$(includedir)/zlib_name_mangling$(SUFFIX).h
340 chmod 644 $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h $(DESTDIR)$(includedir)/zlib_name_mangling$(SUFFIX).h
341
342 uninstall-static:
343 cd $(DESTDIR)$(libdir) && rm -f $(STATICLIB)
344
345 uninstall-shared:
346 ifneq ($(SHAREDLIB),)
347 cd $(DESTDIR)$(sharedlibdir) && rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM)
348 endif
349 ifneq ($(IMPORTLIB),)
350 cd $(DESTDIR)$(sharedlibdir) && rm -f $(IMPORTLIB)
351 endif
352
353 uninstall: uninstall-static uninstall-shared
354 cd $(DESTDIR)$(includedir) && rm -f zlib$(SUFFIX).h zconf$(SUFFIX).h zlib_name_mangling$(SUFFIX).h
355 cd $(DESTDIR)$(pkgconfigdir) && rm -f $(PKGFILE)
356
357 mostlyclean: clean
358 clean:
359 @if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) clean; fi
360 @if [ -f test/Makefile ]; then $(MAKE) -C test clean; fi
361 rm -f *.o *.lo *~ \
362 example$(EXE) minigzip$(EXE) minigzipsh$(EXE) \
363 infcover makefixed$(EXE) maketrees$(EXE) makecrct$(EXE) \
364 $(STATICLIB) $(IMPORTLIB) $(SHAREDLIB) $(SHAREDLIBV) $(SHAREDLIBM) \
365 foo.gz so_locations \
366 _match.s maketree
367 rm -rf objs
368 rm -f *.gcda *.gcno *.gcov
369 rm -f a.out a.exe
370 rm -f *.pc
371 rm -f *._h
372 rm -rf btmp1 btmp2 pkgtmp1 pkgtmp2
373
374 maintainer-clean: distclean
375 distclean: clean
376 @if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) distclean; fi
377 @if [ -f test/Makefile ]; then $(MAKE) -C test distclean; fi
378 rm -f $(PKGFILE) configure.log zconf.h zconf.h.cmakein zlib$(SUFFIX).h zlib_name_mangling$(SUFFIX)}.h
379 -@rm -f .DS_Store
380 # Reset Makefile if building inside source tree
381 @if [ -f Makefile.in ]; then \
382 printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
383 printf '\ndistclean:\n\t$(MAKE) -f Makefile.in distclean\n' >> Makefile ; \
384 touch -r $(SRCDIR)/Makefile.in Makefile ; fi
385 # Reset zconf.h and zconf.h.cmakein if building inside source tree
386 @if [ -f zconf.h.in ]; then \
387 cp -p $(SRCDIR)/zconf.h.in zconf.h ; \
388 grep -v '^#cmakedefine' $(SRCDIR)/zconf.h.in > zconf.h.cmakein &&\
389 touch -r $(SRCDIR)/zconf.h.in zconf.h.cmakein ; fi
390 # Cleanup these files if building outside source tree
391 @if [ ! -f README.md ]; then rm -f Makefile; fi
392 # Remove arch and test directory if building outside source tree
393 @if [ ! -f $(ARCHDIR)/Makefile.in ]; then rm -rf arch; fi
394 @if [ ! -f test/Makefile.in ]; then rm -rf test; fi
395
396 tags:
397 etags $(SRCDIR)/*.[ch]