makefile.solaris-x86 8.1 KB

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