makefile.so9 8.2 KB

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