makefile.msys 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. # makefile for libpng using MSYS/gcc (shared, static library)
  2. # Copyright (C) 2012 Glenn Randers-Pehrson and Christopher M. Wheeler
  3. #
  4. # Portions taken from makefile.linux:
  5. # Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and
  6. # Glenn Randers-Pehrson
  7. # Copyright (C) 2000 Cosmin Truta
  8. # Copyright (C) 1996, 1997 Andreas Dilger
  9. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
  10. #
  11. # This code is released under the libpng license.
  12. # For conditions of distribution and use, see the disclaimer
  13. # and license in png.h
  14. # # # # # # # # # # # # # # # # #
  15. prefix=/usr/local
  16. exec_prefix=$(prefix)
  17. # Library name:
  18. LIBNAME = libpng16
  19. PNGMAJ = 16
  20. RELEASE = 20
  21. # Shared library names:
  22. LIBSO=$(LIBNAME).dll
  23. LIBSOMAJ=$(LIBNAME).dll.$(PNGMAJ)
  24. LIBSOREL=$(PNGMAJ).$(RELEASE)
  25. OLDSO=libpng.dll
  26. # Where the zlib library and include files are located.
  27. #ZLIBLIB=../zlib
  28. #ZLIBINC=../zlib
  29. ZLIBLIB=/usr/local/lib
  30. ZLIBINC=/usr/local/include
  31. # Compiler, linker, lib and other tools
  32. CC = gcc
  33. LD = $(CC)
  34. AR_RC = ar rcs
  35. RANLIB = ranlib
  36. CP = cp
  37. RM_F = rm -rf
  38. MKDIR_P=mkdir -p
  39. LN_SF=ln -sf
  40. #ARCH = -march=pentium3
  41. #ARCH = -march=i686
  42. ARCH =
  43. CPPFLAGS = # -DPNG_DEBUG=5
  44. CFLAGS = -W -Wall -O2 $(ARCH) # -g
  45. LDFLAGS =
  46. LIBS = -lz -lm
  47. # File extensions
  48. EXEEXT=.exe
  49. INCPATH=$(prefix)/include
  50. LIBPATH=$(exec_prefix)/lib
  51. MANPATH=$(prefix)/man
  52. BINPATH=$(exec_prefix)/bin
  53. # override DESTDIR= on the make install command line to easily support
  54. # installing into a temporary location. Example:
  55. #
  56. # make install DESTDIR=/tmp/build/libpng
  57. #
  58. # If you're going to install into a temporary location
  59. # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
  60. # you execute make install.
  61. DESTDIR=
  62. DB=$(DESTDIR)$(BINPATH)
  63. DI=$(DESTDIR)$(INCPATH)
  64. DL=$(DESTDIR)$(LIBPATH)
  65. DM=$(DESTDIR)$(MANPATH)
  66. # Pre-built configuration
  67. # See scripts/pnglibconf.mak for more options
  68. PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
  69. # Variables
  70. OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
  71. pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
  72. pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
  73. # Targets
  74. all: static shared
  75. pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
  76. $(CP) $(PNGLIBCONF_H_PREBUILT) $@
  77. .c.o:
  78. $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
  79. static: libpng.a pngtest$(EXEEXT)
  80. shared: $(LIBSOMAJ)
  81. $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSO)
  82. $(LIBSO): $(LIBSOMAJ)
  83. $(LN_SF) $(LIBSOMAJ) $(LIBSO)
  84. $(LIBSOMAJ):
  85. $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ)
  86. libpng.a: $(OBJS)
  87. $(AR_RC) $@ $(OBJS)
  88. $(RANLIB) $@
  89. install-headers: png.h pngconf.h pnglibconf.h
  90. -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
  91. -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
  92. cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
  93. -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
  94. -@$(RM_F) $(DI)/libpng
  95. (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
  96. install-static: install-headers libpng.a
  97. -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
  98. cp libpng.a $(DL)/$(LIBNAME).a
  99. -@$(RM_F) $(DL)/libpng.a
  100. (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
  101. libpng.pc:
  102. cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
  103. -e s!@exec_prefix@!$(exec_prefix)! \
  104. -e s!@libdir@!$(LIBPATH)! \
  105. -e s!@includedir@!$(INCPATH)! \
  106. -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
  107. libpng-config:
  108. ( cat scripts/libpng-config-head.in; \
  109. echo prefix=\"$(prefix)\"; \
  110. echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
  111. echo L_opts=\"-L$(LIBPATH)\"; \
  112. echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
  113. echo libs=\"-lpng16 -lz -lm\"; \
  114. cat scripts/libpng-config-body.in ) > libpng-config
  115. install-shared: install-headers $(LIBSOMAJ) libpng.pc
  116. -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
  117. -@$(RM_F) $(DL)/$(LIBSO)
  118. -@$(RM_F) $(DL)/$(OLDSO)
  119. cp $(LIBSO) $(DL)/$(LIBSOREL)
  120. (cd $(DL); \
  121. $(LN_SF) $(LIBSOREL) $(LIBSO); \
  122. $(LN_SF) $(LIBSO) $(OLDSO))
  123. -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
  124. -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
  125. -@$(RM_F) $(DL)/pkgconfig/libpng.pc
  126. cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
  127. (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
  128. install-man: libpng.3 libpngpf.3 png.5
  129. -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
  130. -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
  131. -@$(RM_F) $(DM)/man3/libpng.3
  132. -@$(RM_F) $(DM)/man3/libpngpf.3
  133. cp libpng.3 $(DM)/man3
  134. cp libpngpf.3 $(DM)/man3
  135. -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
  136. -@$(RM_F) $(DM)/man5/png.5
  137. cp png.5 $(DM)/man5
  138. install-config: libpng-config
  139. -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
  140. -@$(RM_F) $(DB)/libpng-config
  141. -@$(RM_F) $(DB)/$(LIBNAME)-config
  142. cp libpng-config $(DB)/$(LIBNAME)-config
  143. (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
  144. install: install-static install-shared install-man install-config
  145. test: pngtest$(EXEEXT)
  146. ./pngtest$(EXEEXT)
  147. pngtest$(EXEEXT): pngtest.o libpng.a
  148. $(LD) $(LDFLAGS) -L$(ZLIBLIB) -o $@ pngtest.o libpng.a $(LIBS)
  149. clean:
  150. $(RM_F) *.o libpng.a pngtest$(EXEEXT) pngout.png pnglibconf.h $(LIBSO) \
  151. $(LIBSOMAJ) libpng-config
  152. png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  153. pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  154. pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  155. pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  156. pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  157. pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  158. pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  159. pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  160. pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  161. pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  162. pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  163. pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  164. pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  165. pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  166. pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  167. pngtest.o: png.h pngconf.h pnglibconf.h