Makefile.in 8.8 KB

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