makefile.beos 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. # makefile for libpng on BeOS x86 ELF with gcc
  2. # modified from makefile.linux by Sander Stoks
  3. # Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson
  4. # Copyright (C) 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).so
  15. LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
  16. LIBSOREL=$(LIBSOMAJ).$(RELEASE)
  17. OLDSO=libpng.so
  18. # Utilities:
  19. CC=gcc
  20. AR_RC=ar rc
  21. MKDIR_P=mkdir -p
  22. LN_SF=ln -sf
  23. RANLIB=ranlib
  24. RM_F=/bin/rm -f
  25. # Where the zlib library and include files are located
  26. ZLIBLIB=/usr/local/lib
  27. ZLIBINC=/usr/local/include
  28. ALIGN=
  29. # For i386:
  30. # ALIGN=-malign-loops=2 -malign-functions=2
  31. WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
  32. -Wmissing-declarations -Wtraditional -Wcast-align \
  33. -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
  34. # On BeOS, -O1 is actually better than -O3. This is a known bug but it's
  35. # still here in R4.5
  36. CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
  37. CFLAGS=-W -Wall -O1 -funroll-loops $(ALIGN) # $(WARNMORE) -g
  38. # LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz
  39. LDFLAGS=-L. -Wl,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz
  40. # where make install puts libpng.a, libpng16.so*, and png.h
  41. prefix=/usr/local
  42. exec_prefix=$(prefix)
  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. OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
  61. pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
  62. pngwtran.o pngmem.o pngerror.o pngpread.o
  63. OBJSDLL = $(OBJS)
  64. .SUFFIXES: .c .o
  65. .c.o:
  66. $(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
  67. all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
  68. # try include 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. libpng.pc:
  75. cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
  76. -e s!@exec_prefix@!$(exec_prefix)! \
  77. -e s!@libdir@!$(LIBPATH)! \
  78. -e s!@includedir@!$(INCPATH)! \
  79. -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
  80. libpng-config:
  81. ( cat scripts/libpng-config-head.in; \
  82. echo prefix=\"$(prefix)\"; \
  83. echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
  84. echo libs=\"-lpng16 -lz \"; \
  85. cat scripts/libpng-config-body.in ) > libpng-config
  86. chmod +x libpng-config
  87. $(LIBSO): $(LIBSOMAJ)
  88. $(LN_SF) $(LIBSOMAJ) $(LIBSO)
  89. cp $(LIBSO)* /boot/home/config/lib
  90. $(LIBSOMAJ): $(OBJSDLL)
  91. $(CC) -nostart -Wl,-soname,$(LIBSOMAJ) -o \
  92. $(LIBSOMAJ) $(OBJSDLL) $(LDFLAGS)
  93. pngtest: pngtest.o $(LIBSO)
  94. $(CC) -L$(ZLIBLIB) -L. -lz -lpng16 -o pngtest pngtest.o
  95. test: pngtest
  96. ./pngtest
  97. install-headers: png.h pngconf.h pnglibconf.h
  98. -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
  99. -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
  100. cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
  101. chmod 644 $(DI)/$(LIBNAME)/png.h $(DI)/$(LIBNAME)/pngconf.h $(DI)/$(LIBNAME)/pnglibconf.h
  102. -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
  103. -@$(RM_F) $(DI)/libpng
  104. (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
  105. install-static: install-headers libpng.a
  106. -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
  107. cp libpng.a $(DL)/$(LIBNAME).a
  108. chmod 644 $(DL)/$(LIBNAME).a
  109. -@$(RM_F) $(DL)/libpng.a
  110. (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
  111. install-shared: install-headers $(LIBSOMAJ) libpng.pc
  112. -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
  113. -@$(RM_F) $(DL)/$(LIBSO)
  114. -@$(RM_F) $(DL)/$(LIBSOREL)
  115. -@$(RM_F) $(DL)/$(OLDSO)
  116. cp $(LIBSOMAJ) $(DL)/$(LIBSOREL)
  117. chmod 755 $(DL)/$(LIBSOREL)
  118. (cd $(DL); \
  119. $(LN_SF) $(LIBSOREL) $(LIBSO); \
  120. $(LN_SF) $(LIBSO) $(OLDSO))
  121. -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
  122. -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
  123. -@$(RM_F) $(DL)/pkgconfig/libpng.pc
  124. cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
  125. chmod 644 $(DL)/pkgconfig/$(LIBNAME).pc
  126. (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
  127. install-man: libpng.3 libpngpf.3 png.5
  128. -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
  129. -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
  130. -@$(RM_F) $(DM)/man3/libpng.3
  131. -@$(RM_F) $(DM)/man3/libpngpf.3
  132. cp libpng.3 $(DM)/man3
  133. cp libpngpf.3 $(DM)/man3
  134. -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
  135. -@$(RM_F) $(DM)/man5/png.5
  136. cp png.5 $(DM)/man5
  137. install-config: libpng-config
  138. -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
  139. -@$(RM_F) $(DB)/libpng-config
  140. -@$(RM_F) $(DB)/$(LIBNAME)-config
  141. cp libpng-config $(DB)/$(LIBNAME)-config
  142. chmod 755 $(DB)/$(LIBNAME)-config
  143. (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
  144. install: install-static install-shared install-man install-config
  145. # If you installed in $(DESTDIR), test-installed won't work until you
  146. # move the library to its final location. Use test-dd to test it
  147. # before then.
  148. test-dd:
  149. echo
  150. echo Testing installed dynamic shared library in $(DL).
  151. $(CC) -I$(DI) $(CPPFLAGS) $(CFLAGS) \
  152. `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
  153. -L$(DL) -L$(ZLIBLIB) -Wl,-rpath $(ZLIBLIB):$(DL) \
  154. -o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
  155. ./pngtestd pngtest.png
  156. test-installed:
  157. $(CC) $(CPPFLAGS) $(CFLAGS) \
  158. `$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
  159. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
  160. -o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
  161. ./pngtesti pngtest.png
  162. clean:
  163. $(RM_F) *.o libpng.a pngtest pngout.png libpng-config \
  164. $(LIBSO) $(LIBSOMAJ)* pngtesti \
  165. pnglibconf.h libpng.pc
  166. # DO NOT DELETE THIS LINE -- make depend depends on it.
  167. png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  168. pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  169. pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  170. pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  171. pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  172. pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  173. pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  174. pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  175. pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  176. pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  177. pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  178. pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  179. pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  180. pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  181. pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  182. pngtest.o: png.h pngconf.h pnglibconf.h