makefile.solaris 8.1 KB

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