makefile.sggcc 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. # makefile for libpng.a and libpng16.so, SGI IRIX with 'cc'
  2. # Copyright (C) 2001-2002, 2006, 2010-2014 Glenn Randers-Pehrson
  3. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
  4. #
  5. # This code is released under the libpng license.
  6. # For conditions of distribution and use, see the disclaimer
  7. # and license in png.h
  8. # Library name:
  9. LIBNAME=libpng16
  10. PNGMAJ = 16
  11. # Shared library names:
  12. LIBSO=$(LIBNAME).so
  13. LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
  14. LIBSOREL=$(LIBSOMAJ).$(RELEASE)
  15. OLDSO=libpng.so
  16. # Utilities:
  17. AR_RC=ar rc
  18. CC=gcc
  19. MKDIR_P=mkdir -p
  20. LN_SF=ln -sf
  21. RANLIB=echo
  22. RM_F=/bin/rm -f
  23. # Where make install puts libpng.a, libpng16.so, and libpng16/png.h
  24. # Prefix must be a full pathname.
  25. prefix=/usr/local
  26. exec_prefix=$(prefix)
  27. # Where the zlib library and include files are located
  28. #ZLIBLIB=/usr/local/lib32
  29. #ZLIBINC=/usr/local/include
  30. #ZLIBLIB=/usr/local/lib
  31. #ZLIBINC=/usr/local/include
  32. ZLIBLIB=../zlib
  33. ZLIBINC=../zlib
  34. # ABI can be blank to use default for your system, -32, -o32, -n32, or -64
  35. # See "man abi". zlib must be built with the same ABI.
  36. ABI=
  37. WARNMORE=
  38. CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
  39. CFLAGS=$(ABI) -O $(WARNMORE) -fPIC -mabi=n32 # -g
  40. LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
  41. LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
  42. -set_version sgi$(PNGMAJ).0
  43. # See "man dso" for info about shared objects
  44. INCPATH=$(prefix)/include
  45. LIBPATH=$(exec_prefix)/lib
  46. #LIBPATH=$(exec_prefix)/lib32
  47. MANPATH=$(prefix)/man
  48. BINPATH=$(exec_prefix)/bin
  49. # override DESTDIR= on the make install command line to easily support
  50. # installing into a temporary location. Example:
  51. #
  52. # make install DESTDIR=/tmp/build/libpng
  53. #
  54. # If you're going to install into a temporary location
  55. # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
  56. # you execute make install.
  57. DESTDIR=
  58. DB=$(DESTDIR)$(BINPATH)
  59. DI=$(DESTDIR)$(INCPATH)
  60. DL=$(DESTDIR)$(LIBPATH)
  61. DM=$(DESTDIR)$(MANPATH)
  62. OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
  63. pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
  64. pngwtran.o pngmem.o pngerror.o pngpread.o
  65. .c.o:
  66. $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
  67. all: libpng.a pngtest shared libpng.pc libpng-config
  68. # see scripts/pnglibconf.mak for more options
  69. pnglibconf.h: scripts/pnglibconf.h.prebuilt
  70. cp scripts/pnglibconf.h.prebuilt $@
  71. libpng.a: $(OBJS)
  72. $(AR_RC) $@ $(OBJS)
  73. $(RANLIB) $@
  74. shared: $(LIBSOMAJ)
  75. libpng.pc:
  76. cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
  77. -e s!@exec_prefix@!$(exec_prefix)! \
  78. -e s!@libdir@!$(LIBPATH)! \
  79. -e s!@includedir@!$(INCPATH)! \
  80. -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
  81. libpng-config:
  82. ( cat scripts/libpng-config-head.in; \
  83. echo prefix=\"$(prefix)\"; \
  84. echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
  85. echo ccopts=\"$(ABI)\"; \
  86. echo cppflags=\"\"; \
  87. echo ldopts=\"$(ABI)\"; \
  88. echo L_opts=\"-L$(LIBPATH)\"; \
  89. echo libdir=\"$(LIBPATH)\"; \
  90. echo libs=\"-lpng16 -lz -lm\"; \
  91. cat scripts/libpng-config-body.in ) > libpng-config
  92. chmod +x libpng-config
  93. $(LIBSO): $(LIBSOMAJ)
  94. $(LN_SF) $(LIBSOMAJ) $(LIBSO)
  95. $(LIBSOMAJ): $(OBJS)
  96. $(LDSHARED) -o $@ $(OBJS)
  97. $(RM_F) $(LIBSO) $(LIBSOMAJ)
  98. pngtest: pngtest.o libpng.a
  99. $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
  100. test: pngtest
  101. echo
  102. echo Testing local static library.
  103. ./pngtest
  104. install-headers: png.h pngconf.h pnglibconf.h
  105. -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
  106. -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
  107. cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
  108. chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
  109. -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
  110. -@$(RM_F) $(DI)/libpng
  111. (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
  112. install-static: install-headers libpng.a
  113. -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
  114. cp libpng.a $(DL)/$(LIBNAME).a
  115. chmod 644 $(DL)/$(LIBNAME).a
  116. -@$(RM_F) $(DL)/libpng.a
  117. (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
  118. install-shared: install-headers $(LIBSOMAJ) libpng.pc
  119. -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
  120. -@$(RM_F) $(DL)/$(LIBSO)
  121. -@$(RM_F) $(DL)/$(LIBSOREL)
  122. -@$(RM_F) $(DL)/$(OLDSO)
  123. cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
  124. chmod 755 $(DL)/$(LIBSOREL)
  125. (cd $(DL); \
  126. $(LN_SF) $(LIBSOREL) $(LIBSO); \
  127. $(LN_SF) $(LIBSO) $(OLDSO))
  128. -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
  129. -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
  130. -@$(RM_F) $(DL)/pkgconfig/libpng.pc
  131. cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
  132. chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
  133. (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
  134. install-man: libpng.3 libpngpf.3 png.5
  135. -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
  136. -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
  137. -@$(RM_F) $(DM)/man3/libpng.3
  138. -@$(RM_F) $(DM)/man3/libpngpf.3
  139. cp libpng.3 $(DM)/man3
  140. cp libpngpf.3 $(DM)/man3
  141. -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
  142. -@$(RM_F) $(DM)/man5/png.5
  143. cp png.5 $(DM)/man5
  144. install-config: libpng-config
  145. -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
  146. -@$(RM_F) $(DB)/libpng-config
  147. -@$(RM_F) $(DB)/$(LIBNAME)-config
  148. cp libpng-config $(DB)/$(LIBNAME)-config
  149. chmod 755 $(DB)/$(LIBNAME)-config
  150. (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
  151. install: install-static install-shared install-man install-config
  152. # If you installed in $(DESTDIR), test-installed won't work until you
  153. # move the library to its final location. Use test-dd to test it
  154. # before then.
  155. test-dd:
  156. echo
  157. echo Testing installed dynamic shared library in $(DL).
  158. $(CC) -I$(DI) $(CPPFLAGS) \
  159. `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
  160. -L$(DL) -L$(ZLIBLIB) \
  161. -rpath $(ZLIBLIB):$(DL) \
  162. -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
  163. ./pngtestd pngtest.png
  164. test-installed:
  165. echo
  166. echo Testing installed dynamic shared library.
  167. $(CC) $(CPPFLAGS) \
  168. `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
  169. -L$(ZLIBLIB) \
  170. -rpath $(ZLIBLIB):`$(BINPATH)/$(LIBNAME)-config --libdir` \
  171. -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
  172. ./pngtesti pngtest.png
  173. clean:
  174. $(RM_F) libpng.a pngtest pngtesti pngout.png libpng.pc \
  175. so_locations libpng-config $(LIBSO) $(LIBSOMAJ)* pnglibconf.h
  176. DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
  177. writelock:
  178. chmod a-w *.[ch35] $(DOCS) scripts/*
  179. # DO NOT DELETE THIS LINE -- make depend depends on it.
  180. png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  181. pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  182. pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  183. pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  184. pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  185. pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  186. pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  187. pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  188. pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  189. pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  190. pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  191. pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  192. pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  193. pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  194. pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  195. pngtest.o: png.h pngconf.h pnglibconf.h