makefile.msys 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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 = 10
  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. RM_F = rm -rf
  37. MKDIR_P=mkdir -p
  38. LN_SF=ln -sf
  39. #ARCH = -march=pentium3
  40. #ARCH = -march=i686
  41. ARCH =
  42. CPPFLAGS = # -DPNG_DEBUG=5
  43. CFLAGS = -W -Wall -O2 $(ARCH) # -g
  44. LDFLAGS =
  45. LIBS = -lz -lm
  46. # File extensions
  47. EXEEXT=.exe
  48. INCPATH=$(prefix)/include
  49. LIBPATH=$(exec_prefix)/lib
  50. MANPATH=$(prefix)/man
  51. BINPATH=$(exec_prefix)/bin
  52. # override DESTDIR= on the make install command line to easily support
  53. # installing into a temporary location. Example:
  54. #
  55. # make install DESTDIR=/tmp/build/libpng
  56. #
  57. # If you're going to install into a temporary location
  58. # via DESTDIR, $(DESTDIR)$(prefix) must already exist before
  59. # you execute make install.
  60. DESTDIR=
  61. DB=$(DESTDIR)$(BINPATH)
  62. DI=$(DESTDIR)$(INCPATH)
  63. DL=$(DESTDIR)$(LIBPATH)
  64. DM=$(DESTDIR)$(MANPATH)
  65. # Variables
  66. OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
  67. pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
  68. pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
  69. # Targets
  70. all: static shared
  71. # see scripts/pnglibconf.mak for more options
  72. pnglibconf.h: scripts/pnglibconf.h.prebuilt
  73. cp scripts/pnglibconf.h.prebuilt $@
  74. .c.o:
  75. $(CC) -c $(CPPFLAGS) $(CFLAGS) $<
  76. static: libpng.a pngtest$(EXEEXT)
  77. shared: $(LIBSOMAJ)
  78. $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSO)
  79. $(LIBSO): $(LIBSOMAJ)
  80. $(LN_SF) $(LIBSOMAJ) $(LIBSO)
  81. $(LIBSOMAJ):
  82. $(CC) -shared -Wl,-soname,$(LIBSOMAJ) -o $(LIBSOMAJ)
  83. libpng.a: $(OBJS)
  84. $(AR_RC) $@ $(OBJS)
  85. $(RANLIB) $@
  86. install-headers: png.h pngconf.h pnglibconf.h
  87. -@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
  88. -@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
  89. cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
  90. -@$(RM_F) $(DI)/png.h $(DI)/pngconf.h $(DI)/pnglibconf.h
  91. -@$(RM_F) $(DI)/libpng
  92. (cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
  93. install-static: install-headers libpng.a
  94. -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
  95. cp libpng.a $(DL)/$(LIBNAME).a
  96. -@$(RM_F) $(DL)/libpng.a
  97. (cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
  98. libpng.pc:
  99. cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
  100. -e s!@exec_prefix@!$(exec_prefix)! \
  101. -e s!@libdir@!$(LIBPATH)! \
  102. -e s!@includedir@!$(INCPATH)! \
  103. -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
  104. libpng-config:
  105. ( cat scripts/libpng-config-head.in; \
  106. echo prefix=\"$(prefix)\"; \
  107. echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
  108. echo L_opts=\"-L$(LIBPATH)\"; \
  109. echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
  110. echo libs=\"-lpng16 -lz -lm\"; \
  111. cat scripts/libpng-config-body.in ) > libpng-config
  112. install-shared: install-headers $(LIBSOMAJ) libpng.pc
  113. -@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
  114. -@$(RM_F) $(DL)/$(LIBSO)
  115. -@$(RM_F) $(DL)/$(OLDSO)
  116. cp $(LIBSO) $(DL)/$(LIBSOREL)
  117. (cd $(DL); \
  118. $(LN_SF) $(LIBSOREL) $(LIBSO); \
  119. $(LN_SF) $(LIBSO) $(OLDSO))
  120. -@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
  121. -@$(RM_F) $(DL)/pkgconfig/$(LIBNAME).pc
  122. -@$(RM_F) $(DL)/pkgconfig/libpng.pc
  123. cp libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
  124. (cd $(DL)/pkgconfig; $(LN_SF) $(LIBNAME).pc libpng.pc)
  125. install-man: libpng.3 libpngpf.3 png.5
  126. -@if [ ! -d $(DM) ]; then $(MKDIR_P) $(DM); fi
  127. -@if [ ! -d $(DM)/man3 ]; then $(MKDIR_P) $(DM)/man3; fi
  128. -@$(RM_F) $(DM)/man3/libpng.3
  129. -@$(RM_F) $(DM)/man3/libpngpf.3
  130. cp libpng.3 $(DM)/man3
  131. cp libpngpf.3 $(DM)/man3
  132. -@if [ ! -d $(DM)/man5 ]; then $(MKDIR_P) $(DM)/man5; fi
  133. -@$(RM_F) $(DM)/man5/png.5
  134. cp png.5 $(DM)/man5
  135. install-config: libpng-config
  136. -@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
  137. -@$(RM_F) $(DB)/libpng-config
  138. -@$(RM_F) $(DB)/$(LIBNAME)-config
  139. cp libpng-config $(DB)/$(LIBNAME)-config
  140. (cd $(DB); $(LN_SF) $(LIBNAME)-config libpng-config)
  141. install: install-static install-shared install-man install-config
  142. test: pngtest$(EXEEXT)
  143. ./pngtest$(EXEEXT)
  144. pngtest$(EXEEXT): pngtest.o libpng.a
  145. $(LD) $(LDFLAGS) -L$(ZLIBLIB) -o $@ pngtest.o libpng.a $(LIBS)
  146. clean:
  147. $(RM_F) *.o libpng.a pngtest$(EXEEXT) pngout.png pnglibconf.h $(LIBSO) \
  148. $(LIBSOMAJ) libpng-config
  149. png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  150. pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  151. pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  152. pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  153. pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  154. pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  155. pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  156. pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  157. pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  158. pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  159. pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  160. pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  161. pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  162. pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  163. pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
  164. pngtest.o: png.h pngconf.h pnglibconf.h