Makefile.in 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  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. # 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.5
  29. SHAREDLIBM=libz.so.1
  30. LIBS=$(STATICLIB) $(SHAREDLIBV)
  31. AR=ar rc
  32. RANLIB=ranlib
  33. LDCONFIG=ldconfig
  34. LDSHAREDLIBC=-lc
  35. TAR=tar
  36. SHELL=/bin/sh
  37. EXE=
  38. prefix = /usr/local
  39. exec_prefix = ${prefix}
  40. libdir = ${exec_prefix}/lib
  41. sharedlibdir = ${libdir}
  42. includedir = ${prefix}/include
  43. mandir = ${prefix}/share/man
  44. man3dir = ${mandir}/man3
  45. pkgconfigdir = ${libdir}/pkgconfig
  46. OBJC = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \
  47. gzwrite.o infback.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
  48. PIC_OBJC = adler32.lo compress.lo crc32.lo deflate.lo gzclose.lo gzlib.lo gzread.lo \
  49. gzwrite.lo infback.lo inffast.lo inflate.lo inftrees.lo trees.lo uncompr.lo zutil.lo
  50. # to use the asm code: make OBJA=match.o, PIC_OBJA=match.lo
  51. OBJA =
  52. PIC_OBJA =
  53. OBJS = $(OBJC) $(OBJA)
  54. PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
  55. all: static shared
  56. static: example$(EXE) minigzip$(EXE)
  57. shared: examplesh$(EXE) minigzipsh$(EXE)
  58. all64: example64$(EXE) minigzip64$(EXE)
  59. check: test
  60. test: all teststatic testshared
  61. teststatic: static
  62. @if echo hello world | ./minigzip | ./minigzip -d && ./example; then \
  63. echo ' *** zlib test OK ***'; \
  64. else \
  65. echo ' *** zlib test FAILED ***'; false; \
  66. fi
  67. -@rm -f foo.gz
  68. testshared: shared
  69. @LD_LIBRARY_PATH=`pwd`:$(LD_LIBRARY_PATH) ; export LD_LIBRARY_PATH; \
  70. LD_LIBRARYN32_PATH=`pwd`:$(LD_LIBRARYN32_PATH) ; export LD_LIBRARYN32_PATH; \
  71. DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
  72. SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
  73. if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh; then \
  74. echo ' *** zlib shared test OK ***'; \
  75. else \
  76. echo ' *** zlib shared test FAILED ***'; false; \
  77. fi
  78. -@rm -f foo.gz
  79. test64: all64
  80. @if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64; then \
  81. echo ' *** zlib 64-bit test OK ***'; \
  82. else \
  83. echo ' *** zlib 64-bit test FAILED ***'; false; \
  84. fi
  85. -@rm -f foo.gz
  86. libz.a: $(OBJS)
  87. $(AR) $@ $(OBJS)
  88. -@ ($(RANLIB) $@ || true) >/dev/null 2>&1
  89. match.o: match.S
  90. $(CPP) match.S > _match.s
  91. $(CC) -c _match.s
  92. mv _match.o match.o
  93. rm -f _match.s
  94. match.lo: match.S
  95. $(CPP) match.S > _match.s
  96. $(CC) -c -fPIC _match.s
  97. mv _match.o match.lo
  98. rm -f _match.s
  99. example64.o: example.c zlib.h zconf.h
  100. $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ example.c
  101. minigzip64.o: minigzip.c zlib.h zconf.h
  102. $(CC) $(CFLAGS) -D_FILE_OFFSET_BITS=64 -c -o $@ minigzip.c
  103. .SUFFIXES: .lo
  104. .c.lo:
  105. -@mkdir objs 2>/dev/null || test -d objs
  106. $(CC) $(SFLAGS) -DPIC -c -o objs/$*.o $<
  107. -@mv objs/$*.o $@
  108. $(SHAREDLIBV): $(PIC_OBJS)
  109. $(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
  110. rm -f $(SHAREDLIB) $(SHAREDLIBM)
  111. ln -s $@ $(SHAREDLIB)
  112. ln -s $@ $(SHAREDLIBM)
  113. -@rmdir objs
  114. example$(EXE): example.o $(STATICLIB)
  115. $(CC) $(CFLAGS) -o $@ example.o $(TEST_LDFLAGS)
  116. minigzip$(EXE): minigzip.o $(STATICLIB)
  117. $(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
  118. examplesh$(EXE): example.o $(SHAREDLIBV)
  119. $(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
  120. minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
  121. $(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
  122. example64$(EXE): example64.o $(STATICLIB)
  123. $(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
  124. minigzip64$(EXE): minigzip64.o $(STATICLIB)
  125. $(CC) $(CFLAGS) -o $@ minigzip64.o $(TEST_LDFLAGS)
  126. install-libs: $(LIBS)
  127. -@if [ ! -d $(DESTDIR)$(exec_prefix) ]; then mkdir -p $(DESTDIR)$(exec_prefix); fi
  128. -@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
  129. -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
  130. -@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
  131. -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
  132. cp $(STATICLIB) $(DESTDIR)$(libdir)
  133. cp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)
  134. cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB)
  135. -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
  136. -@cd $(DESTDIR)$(sharedlibdir); if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
  137. chmod 755 $(SHAREDLIBV); \
  138. rm -f $(SHAREDLIB) $(SHAREDLIBM); \
  139. ln -s $(SHAREDLIBV) $(SHAREDLIB); \
  140. ln -s $(SHAREDLIBV) $(SHAREDLIBM); \
  141. ($(LDCONFIG) || true) >/dev/null 2>&1; \
  142. fi
  143. cp zlib.3 $(DESTDIR)$(man3dir)
  144. chmod 644 $(DESTDIR)$(man3dir)/zlib.3
  145. cp zlib.pc $(DESTDIR)$(pkgconfigdir)
  146. chmod 644 $(DESTDIR)$(pkgconfigdir)/zlib.pc
  147. # The ranlib in install is needed on NeXTSTEP which checks file times
  148. # ldconfig is for Linux
  149. install: install-libs
  150. -@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
  151. cp zlib.h zconf.h $(DESTDIR)$(includedir)
  152. chmod 644 $(DESTDIR)$(includedir)/zlib.h $(DESTDIR)$(includedir)/zconf.h
  153. uninstall:
  154. cd $(DESTDIR)$(includedir); rm -f zlib.h zconf.h
  155. cd $(DESTDIR)$(libdir); rm -f libz.a; \
  156. if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
  157. rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM); \
  158. fi
  159. cd $(DESTDIR)$(man3dir); rm -f zlib.3
  160. cd $(DESTDIR)$(pkgconfigdir); rm -f zlib.pc
  161. docs: zlib.3.pdf
  162. zlib.3.pdf: zlib.3
  163. groff -mandoc -f H -T ps zlib.3 | ps2pdf - zlib.3.pdf
  164. zconf.h.in: zconf.h.cmakein
  165. sed "/^#cmakedefine/D" < zconf.h.cmakein > zconf.h.in
  166. touch -r zconf.h.cmakein zconf.h.in
  167. zconf: zconf.h.in
  168. cp -p zconf.h.in zconf.h
  169. mostlyclean: clean
  170. clean:
  171. rm -f *.o *.lo *~ \
  172. example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
  173. example64$(EXE) minigzip64$(EXE) \
  174. libz.* foo.gz so_locations \
  175. _match.s maketree contrib/infback9/*.o
  176. rm -rf objs
  177. maintainer-clean: distclean
  178. distclean: clean zconf docs
  179. rm -f Makefile zlib.pc
  180. -@rm -f .DS_Store
  181. -@printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile
  182. -@printf '\ndistclean:\n\tmake -f Makefile.in distclean\n' >> Makefile
  183. -@touch -r Makefile.in Makefile
  184. tags:
  185. etags *.[ch]
  186. depend:
  187. makedepend -- $(CFLAGS) -- *.[ch]
  188. # DO NOT DELETE THIS LINE -- make depend depends on it.
  189. adler32.o zutil.o: zutil.h zlib.h zconf.h
  190. gzclose.o gzlib.o gzread.o gzwrite.o: zlib.h zconf.h gzguts.h
  191. compress.o example.o minigzip.o uncompr.o: zlib.h zconf.h
  192. crc32.o: zutil.h zlib.h zconf.h crc32.h
  193. deflate.o: deflate.h zutil.h zlib.h zconf.h
  194. infback.o inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
  195. inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
  196. inftrees.o: zutil.h zlib.h zconf.h inftrees.h
  197. trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
  198. adler32.lo zutil.lo: zutil.h zlib.h zconf.h
  199. gzclose.lo gzlib.lo gzread.lo gzwrite.lo: zlib.h zconf.h gzguts.h
  200. compress.lo example.lo minigzip.lo uncompr.lo: zlib.h zconf.h
  201. crc32.lo: zutil.h zlib.h zconf.h crc32.h
  202. deflate.lo: deflate.h zutil.h zlib.h zconf.h
  203. infback.lo inflate.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
  204. inffast.lo: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h
  205. inftrees.lo: zutil.h zlib.h zconf.h inftrees.h
  206. trees.lo: deflate.h zutil.h zlib.h zconf.h trees.h