makefile.hpgcc 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. # makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
  2. # Copyright (C) 2002, 2006-2008, 2010-2014 Glenn Randers-Pehrson
  3. # Copyright (C) 2001, Laurent faillie
  4. # Copyright (C) 1998, 1999 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).sl
  15. LIBSOMAJ=$(LIBNAME).sl.$(PNGMAJ)
  16. LIBSOREL=$(LIBSOMAJ).$(RELEASE)
  17. OLDSO=libpng.sl
  18. # Utilities:
  19. CC=gcc
  20. LD=ld
  21. AR_RC=ar rc
  22. MKDIR_P=mkdir -p
  23. LN_SF=ln -sf
  24. RANLIB=ranlib
  25. CP=cp
  26. RM_F=/bin/rm -f
  27. # where "make install" puts libpng.a, $(OLDSO)*, png.h, pngconf.h
  28. # and pnglibconf.h
  29. prefix=/usr/local
  30. exec_prefix=$(prefix)
  31. # Where the zlib library and include files are located
  32. ZLIBLIB=/opt/zlib/lib
  33. ZLIBINC=/opt/zlib/include
  34. # Note that if you plan to build a libpng shared library, zlib must also
  35. # be a shared library, which zlib's configure does not do. After running
  36. # zlib's configure, edit the appropriate lines of makefile to read:
  37. # CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
  38. # LDSHARED=ld -b
  39. # SHAREDLIB=libz.sl
  40. ALIGN=
  41. # for i386:
  42. #ALIGN=-malign-loops=2 -malign-functions=2
  43. WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
  44. -Wmissing-declarations -Wtraditional -Wcast-align \
  45. -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
  46. # for pgcc version 2.95.1, -O3 is buggy; don't use it.
  47. CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
  48. CFLAGS=-W -Wall -O3 -funroll-loops $(ALIGN) # $(WARNMORE) -g
  49. #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
  50. LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm
  51. INCPATH=$(prefix)/include
  52. LIBPATH=$(exec_prefix)/lib
  53. MANPATH=$(prefix)/man
  54. BINPATH=$(exec_prefix)/bin
  55. # override DESTDIR= on the make install command line to easily support
  56. # installing into a temporary location. Example:
  57. #
  58. # make install DESTDIR=/tmp/build/libpng
  59. #
  60. # If you're going to install into a temporary location
  61. # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
  62. # you execute make install.
  63. DESTDIR=
  64. DB=$(DESTDIR)$(BINPATH)
  65. DI=$(DESTDIR)$(INCPATH)
  66. DL=$(DESTDIR)$(LIBPATH)
  67. DM=$(DESTDIR)$(MANPATH)
  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) -fPIC -o $@ $*.c
  77. all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
  78. libpng.a: $(OBJS)
  79. $(AR_RC) $@ $(OBJS)
  80. $(RANLIB) $@
  81. libpng.pc:
  82. cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
  83. -e s!@exec_prefix@!$(exec_prefix)! \
  84. -e s!@libdir@!$(LIBPATH)! \
  85. -e s!@includedir@!$(INCPATH)! \
  86. -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
  87. libpng-config:
  88. ( cat scripts/libpng-config-head.in; \
  89. echo prefix=\"$(prefix)\"; \
  90. echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
  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. $(LD) -b +s \
  98. +h $(LIBSOMAJ) -o $(LIBSOMAJ) $(OBJSDLL)
  99. pngtest: pngtest.o $(LIBSO)
  100. $(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
  101. test: pngtest
  102. ./pngtest
  103. install-headers: png.h pngconf.h pnglibconf.h
  104. -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
  105. -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
  106. cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
  107. chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
  108. -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
  109. -@$(RM_F) $(DI)/libpng
  110. (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
  111. install-static: install-headers libpng.a
  112. -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
  113. cp libpng.a $(DL)/$(LIBNAME).a
  114. chmod 644 $(DL)/$(LIBNAME).a
  115. -@$(RM_F) $(DL)/libpng.a
  116. (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
  117. install-shared: install-headers $(LIBSOMAJ) libpng.pc
  118. -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
  119. -@$(RM_F) $(DL)/$(LIBSO)
  120. -@$(RM_F) $(DL)/$(LIBSOREL)
  121. -@$(RM_F) $(DL)/$(OLDSO)
  122. cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
  123. chmod 755 $(DL)/$(LIBSOREL)
  124. (cd $(DL); \
  125. $(LN_SF) $(LIBSOREL) $(LIBSO); \
  126. $(LN_SF) $(LIBSO) $(OLDSO))
  127. -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
  128. -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
  129. -@$(RM_F) $(DL)/pkgconfig/libpng.pc
  130. cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
  131. chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
  132. (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
  133. install-man: libpng.3 libpngpf.3 png.5
  134. -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
  135. -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
  136. -@$(RM_F) $(DM)/man3/libpng.3
  137. -@$(RM_F) $(DM)/man3/libpngpf.3
  138. cp libpng.3 $(DM)/man3
  139. cp libpngpf.3 $(DM)/man3
  140. -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
  141. -@$(RM_F) $(DM)/man5/png.5
  142. cp png.5 $(DM)/man5
  143. install-config: libpng-config
  144. -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
  145. -@$(RM_F) $(DB)/libpng-config
  146. -@$(RM_F) $(DB)/$(LIBNAME)-config
  147. cp libpng-config $(DB)/$(LIBNAME)-config
  148. chmod 755 $(DB)/$(LIBNAME)-config
  149. (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
  150. install: install-static install-shared install-man install-config
  151. # If you installed in $(DESTDIR), test-installed won't work until you
  152. # move the library to its final location. Use test-dd to test it
  153. # before then.
  154. test-dd:
  155. echo
  156. echo Testing installed dynamic shared library in $(DL).
  157. $(CC) -I$(DI) $(CPPFLAGS) \
  158. `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
  159. -L$(DL) -L$(ZLIBLIB) -Wl,-rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
  160. -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
  161. ./pngtestd pngtest.png
  162. test-installed:
  163. echo
  164. echo Testing installed dynamic shared library.
  165. $(CC) $(CPPFLAGS) \
  166. `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
  167. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
  168. -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
  169. ./pngtesti pngtest.png
  170. clean:
  171. $(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
  172. libpng-config $(LIBSO) $(LIBSOMAJ)* \
  173. libpng.pc pnglibconf.h
  174. DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
  175. writelock:
  176. chmod a-w *.[ch35] $(DOCS) scripts/*
  177. # DO NOT DELETE THIS LINE -- make depend depends on it.
  178. png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  179. pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  180. pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  181. pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  182. pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  183. pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  184. pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  185. pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  186. pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  187. pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  188. pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  189. pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  190. pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  191. pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  192. pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  193. pngtest.o: png.h pngconf.h pnglibconf.h