makefile.so9 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. # makefile for libpng on Solaris 9 (beta) with Forte cc
  2. # Updated by Chad Schrock for Solaris 9
  3. # Contributed by William L. Sebok, based on makefile.linux
  4. # Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson
  5. # Copyright (C) 1998-2001 Greg Roelofs
  6. # Copyright (C) 1996-1997 Andreas Dilger
  7. #
  8. # This code is released under the libpng license.
  9. # For conditions of distribution and use, see the disclaimer
  10. # and license in png.h
  11. # Library name:
  12. PNGMAJ = 16
  13. LIBNAME = libpng16
  14. # Shared library names:
  15. LIBSO=$(LIBNAME).so
  16. LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
  17. LIBSOREL=$(LIBSOMAJ).$(RELEASE)
  18. OLDSO=libpng.so
  19. # Utilities:
  20. # gcc 2.95 doesn't work.
  21. CC=cc
  22. AR_RC=ar rc
  23. MKDIR_P=mkdir -p
  24. LN_SF=ln -f -s
  25. RANLIB=echo
  26. RM_F=/bin/rm -f
  27. # Where make install puts libpng.a, $(OLDSO)*, and png.h
  28. prefix=/usr/local
  29. exec_prefix=$(prefix)
  30. # Where the zlib library and include files are located
  31. # Changing these to ../zlib poses a security risk. If you want
  32. # to have zlib in an adjacent directory, specify the full path instead of "..".
  33. #ZLIBLIB=../zlib
  34. #ZLIBINC=../zlib
  35. #ZLIBLIB=/usr/local/lib
  36. #ZLIBINC=/usr/local/include
  37. #Use the preinstalled zlib that comes with Solaris 9:
  38. ZLIBLIB=/usr/lib
  39. ZLIBINC=/usr/include
  40. #WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
  41. -Wmissing-declarations -Wtraditional -Wcast-align \
  42. -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
  43. CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
  44. #CFLAGS=-W -Wall -O3 $(WARNMORE) -g
  45. CFLAGS=-O3
  46. LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm
  47. INCPATH=$(prefix)/include
  48. LIBPATH=$(exec_prefix)/lib
  49. MANPATH=$(prefix)/man
  50. BINPATH=$(exec_prefix)/bin
  51. # override DESTDIR= on the make install command line to easily support
  52. # installing into a temporary location. Example:
  53. #
  54. # make install DESTDIR=/tmp/build/libpng
  55. #
  56. # If you're going to install into a temporary location
  57. # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
  58. # you execute make install.
  59. DESTDIR=
  60. DB=$(DESTDIR)$(BINPATH)
  61. DI=$(DESTDIR)$(INCPATH)
  62. DL=$(DESTDIR)$(LIBPATH)
  63. DM=$(DESTDIR)$(MANPATH)
  64. OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
  65. pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
  66. pngwtran.o pngmem.o pngerror.o pngpread.o
  67. OBJSDLL = $(OBJS:.o=.pic.o)
  68. .SUFFIXES: .c .o .pic.o
  69. .c.o:
  70. $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
  71. .c.pic.o:
  72. $(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c
  73. all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
  74. # see scripts/pnglibconf.mak for more options
  75. pnglibconf.h: scripts/pnglibconf.h.prebuilt
  76. cp scripts/pnglibconf.h.prebuilt $@
  77. libpng.a: $(OBJS)
  78. $(AR_RC) $@ $(OBJS)
  79. $(RANLIB) $@
  80. libpng.pc:
  81. cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
  82. -e s!@exec_prefix@!$(exec_prefix)! \
  83. -e s!@libdir@!$(LIBPATH)! \
  84. -e s!@includedir@!$(INCPATH)! \
  85. -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
  86. libpng-config:
  87. ( cat scripts/libpng-config-head.in; \
  88. echo prefix=\"$(prefix)\"; \
  89. echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
  90. echo L_opts=\"-L$(LIBPATH)\"; \
  91. echo R_opts=\"-R$(LIBPATH)\"; \
  92. echo libs=\"-lpng16 -lz -lm\"; \
  93. cat scripts/libpng-config-body.in ) > libpng-config
  94. chmod +x libpng-config
  95. $(LIBSO): $(LIBSOMAJ)
  96. $(LN_SF) $(LIBSOMAJ) $(LIBSO)
  97. $(LIBSOMAJ): $(OBJSDLL)
  98. @case "`type ld`" in *ucb*) \
  99. echo; \
  100. echo '## WARNING:'; \
  101. echo '## The commands "CC" and "LD" must NOT refer to /usr/ucb/cc'; \
  102. echo '## and /usr/ucb/ld. If they do, you need to adjust your PATH'; \
  103. echo '## environment variable to put /usr/ccs/bin ahead of /usr/ucb.'; \
  104. echo '## The environment variable LD_LIBRARY_PATH should not be set'; \
  105. echo '## at all. If it is, things are likely to break because of'; \
  106. echo '## the libucb dependency that is created.'; \
  107. echo; \
  108. ;; \
  109. esac
  110. $(LD) -G -h $(LIBSOMAJ) \
  111. -o $(LIBSOMAJ) $(OBJSDLL)
  112. pngtest: pngtest.o $(LIBSO)
  113. $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
  114. test: pngtest
  115. ./pngtest
  116. install-headers: png.h pngconf.h pnglibconf.h
  117. -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
  118. -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
  119. cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
  120. chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
  121. -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
  122. -@$(RM_F) $(DI)/libpng
  123. (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
  124. install-static: install-headers libpng.a
  125. -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
  126. cp libpng.a $(DL)/$(LIBNAME).a
  127. chmod 644 $(DL)/$(LIBNAME).a
  128. -@$(RM_F) $(DL)/libpng.a
  129. (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
  130. install-shared: install-headers $(LIBSOMAJ) libpng.pc
  131. -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
  132. -@$(RM_F) $(DL)/$(LIBSO)
  133. -@$(RM_F) $(DL)/$(LIBSOREL)
  134. -@$(RM_F) $(DL)/$(OLDSO)
  135. cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
  136. chmod 755 $(DL)/$(LIBSOREL)
  137. (cd $(DL); \
  138. $(LN_SF) $(LIBSOREL) $(LIBSO); \
  139. $(LN_SF) $(LIBSO) $(OLDSO))
  140. -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
  141. -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
  142. -@$(RM_F) $(DL)/pkgconfig/libpng.pc
  143. cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
  144. chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
  145. (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
  146. install-man: libpng.3 libpngpf.3 png.5
  147. -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
  148. -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
  149. -@$(RM_F) $(DM)/man3/libpng.3
  150. -@$(RM_F) $(DM)/man3/libpngpf.3
  151. cp libpng.3 $(DM)/man3
  152. cp libpngpf.3 $(DM)/man3
  153. -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
  154. -@$(RM_F) $(DM)/man5/png.5
  155. cp png.5 $(DM)/man5
  156. install-config: libpng-config
  157. -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
  158. -@$(RM_F) $(DB)/libpng-config
  159. -@$(RM_F) $(DB)/$(LIBNAME)-config
  160. cp libpng-config $(DB)/$(LIBNAME)-config
  161. chmod 755 $(DB)/$(LIBNAME)-config
  162. (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
  163. install: install-static install-shared install-man install-config
  164. # If you installed in $(DESTDIR), test-installed won't work until you
  165. # move the library to its final location. Use test-dd to test it
  166. # before then.
  167. test-dd:
  168. echo
  169. echo Testing installed dynamic shared library in $(DL).
  170. $(CC) -I$(DI) $(CPPFLAGS) \
  171. `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
  172. -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags` \
  173. -L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL)
  174. ./pngtestd pngtest.png
  175. test-installed:
  176. echo
  177. echo Testing installed dynamic shared library.
  178. $(CC) $(CPPFLAGS) \
  179. `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
  180. -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
  181. -L$(ZLIBLIB) -R$(ZLIBLIB)
  182. ./pngtesti pngtest.png
  183. clean:
  184. $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
  185. libpng-config $(LIBSO) $(LIBSOMAJ)* \
  186. libpng.pc pnglibconf.h
  187. DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
  188. writelock:
  189. chmod a-w *.[ch35] $(DOCS) scripts/*
  190. # DO NOT DELETE THIS LINE -- make depend depends on it.
  191. png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  192. pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  193. pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  194. pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  195. pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  196. pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  197. pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  198. pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  199. pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  200. pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  201. pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  202. pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  203. pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  204. pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  205. pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  206. pngtest.o: png.h pngconf.h pnglibconf.h