Makefile.am 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393
  1. # Makefile.am, the source file for Makefile.in (and hence Makefile), is
  2. #
  3. # Copyright (c) 2018 Cosmin Truta
  4. # Copyright (c) 2004-2016 Glenn Randers-Pehrson
  5. #
  6. # This code is released under the libpng license.
  7. # For conditions of distribution and use, see the disclaimer
  8. # and license in png.h
  9. PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
  10. ACLOCAL_AMFLAGS = -I scripts
  11. # test programs - run on make check, make distcheck
  12. check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage pngcp
  13. if HAVE_CLOCK_GETTIME
  14. check_PROGRAMS += timepng
  15. endif
  16. # Utilities - installed
  17. bin_PROGRAMS= pngfix png-fix-itxt
  18. # This ensures that pnglibconf.h gets built at the start of 'make all' or
  19. # 'make check', but it does not add dependencies to the individual programs,
  20. # this is done below.
  21. #
  22. # IMPORTANT: always add the object modules of new programs to the list below
  23. # because otherwise the sequence 'configure; make new-program' will *sometimes*
  24. # result in the installed (system) pnglibconf.h being used and the result is
  25. # always wrong and always very confusing.
  26. BUILT_SOURCES = pnglibconf.h
  27. pngtest_SOURCES = pngtest.c
  28. pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
  29. pngvalid_SOURCES = contrib/libtests/pngvalid.c
  30. pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
  31. pngstest_SOURCES = contrib/libtests/pngstest.c
  32. pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
  33. pngunknown_SOURCES = contrib/libtests/pngunknown.c
  34. pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
  35. pngimage_SOURCES = contrib/libtests/pngimage.c
  36. pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
  37. timepng_SOURCES = contrib/libtests/timepng.c
  38. timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
  39. pngfix_SOURCES = contrib/tools/pngfix.c
  40. pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
  41. png_fix_itxt_SOURCES = contrib/tools/png-fix-itxt.c
  42. pngcp_SOURCES = contrib/tools/pngcp.c
  43. pngcp_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
  44. # Generally these are single line shell scripts to run a test with a particular
  45. # set of parameters:
  46. TESTS =\
  47. tests/pngtest\
  48. tests/pngtest-badpngs\
  49. tests/pngvalid-gamma-16-to-8 tests/pngvalid-gamma-alpha-mode\
  50. tests/pngvalid-gamma-background tests/pngvalid-gamma-expand16-alpha-mode\
  51. tests/pngvalid-gamma-expand16-background\
  52. tests/pngvalid-gamma-expand16-transform tests/pngvalid-gamma-sbit\
  53. tests/pngvalid-gamma-threshold tests/pngvalid-gamma-transform\
  54. tests/pngvalid-progressive-size\
  55. tests/pngvalid-progressive-interlace-standard\
  56. tests/pngvalid-transform\
  57. tests/pngvalid-progressive-standard tests/pngvalid-standard\
  58. tests/pngstest-1.8 tests/pngstest-1.8-alpha tests/pngstest-linear\
  59. tests/pngstest-linear-alpha tests/pngstest-none tests/pngstest-none-alpha\
  60. tests/pngstest-sRGB tests/pngstest-sRGB-alpha tests/pngunknown-IDAT\
  61. tests/pngunknown-discard tests/pngunknown-if-safe tests/pngunknown-sAPI\
  62. tests/pngunknown-sTER tests/pngunknown-save tests/pngunknown-vpAg\
  63. tests/pngimage-quick tests/pngimage-full
  64. # man pages
  65. dist_man_MANS= libpng.3 libpngpf.3 png.5
  66. # generate the -config scripts if required
  67. binconfigs= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
  68. EXTRA_SCRIPTS= libpng-config libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
  69. bin_SCRIPTS= @binconfigs@
  70. # rules to build libpng, only build the old library on request
  71. lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
  72. # EXTRA_LTLIBRARIES= libpng.la
  73. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
  74. pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
  75. pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
  76. png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngusr.dfa
  77. if PNG_ARM_NEON
  78. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
  79. arm/filter_neon.S arm/filter_neon_intrinsics.c \
  80. arm/palette_neon_intrinsics.c
  81. endif
  82. if PNG_MIPS_MSA
  83. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += mips/mips_init.c\
  84. mips/filter_msa_intrinsics.c
  85. endif
  86. if PNG_INTEL_SSE
  87. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += intel/intel_init.c\
  88. intel/filter_sse2_intrinsics.c
  89. endif
  90. if PNG_POWERPC_VSX
  91. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += powerpc/powerpc_init.c\
  92. powerpc/filter_vsx_intrinsics.c
  93. endif
  94. nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
  95. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
  96. -version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
  97. if HAVE_LD_VERSION_SCRIPT
  98. # Versioned symbols and restricted exports
  99. if HAVE_SOLARIS_LD
  100. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,-M -Wl,libpng.vers
  101. else
  102. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,--version-script=libpng.vers
  103. endif
  104. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
  105. else
  106. # Only restricted exports when possible
  107. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -export-symbols libpng.sym
  108. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
  109. endif
  110. #distribute headers in /usr/include/libpng/*
  111. pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
  112. pkginclude_HEADERS= png.h pngconf.h
  113. nodist_pkginclude_HEADERS= pnglibconf.h
  114. # pkg-config stuff, note that libpng.pc is always required in order
  115. # to get the correct library
  116. pkgconfigdir = @pkgconfigdir@
  117. pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
  118. # Extra source distribution files, '${srcdir}' is used below to stop build files
  119. # from those directories being included. This only works if the configure is
  120. # not done in the source directory!
  121. EXTRA_DIST= \
  122. ANNOUNCE AUTHORS CHANGES INSTALL LICENSE README TODO TRADEMARK \
  123. pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
  124. ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
  125. $(TESTS) $(XFAIL_TESTS) tests/pngstest \
  126. CMakeLists.txt example.c libpng-manual.txt
  127. SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk
  128. CLEANFILES= *.tf? pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
  129. libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
  130. check.new pnglibconf.h pngprefix.h symbols.new pngtest-log.txt \
  131. pnglibconf.out pnglibconf.c pnglibconf.pre pnglibconf.dfn \
  132. $(SCRIPT_CLEANFILES)
  133. MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
  134. config.sub configure depcomp install-sh ltmain.sh missing
  135. # PNG_COPTS give extra options for the C compiler to be used on all compilation
  136. # steps (unless targe_CFLAGS is specified; that will take precedence over
  137. # AM_CFLAGS)
  138. PNG_COPTS = @PNG_COPTS@
  139. AM_CFLAGS = ${PNG_COPTS}
  140. # DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe
  141. # other operating systems (NeXT?) the C preprocessor selected by configure
  142. # checks input tokens for validity - effectively it performs part of the ANSI-C
  143. # parsing - and therefore fails with the .df files. configure.ac has special
  144. # checks for this and sets DFNCPP appropriately.
  145. DFNCPP = @DFNCPP@
  146. SUFFIXES = .chk .out
  147. $(PNGLIB_BASENAME).pc: libpng.pc
  148. cp libpng.pc $@
  149. $(PNGLIB_BASENAME)-config: libpng-config
  150. cp libpng-config $@
  151. scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
  152. scripts/prefix.out: png.h pngconf.h pnglibconf.out
  153. scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
  154. scripts/intprefix.out: pnglibconf.h
  155. libpng.sym: scripts/sym.out
  156. rm -f $@
  157. cp $? $@
  158. libpng.vers: scripts/vers.out
  159. rm -f $@
  160. cp $? $@
  161. if DO_PNG_PREFIX
  162. # Rename functions in scripts/prefix.out with a PNG_PREFIX prefix.
  163. # Rename macros in scripts/macro.lst from PNG_PREFIXpng_ to PNG_ (the actual
  164. # implementation of the macro).
  165. pnglibconf.h: pnglibconf.out scripts/prefix.out scripts/macro.lst
  166. rm -f $@
  167. $(AWK) 's==0 && NR>1{print prev}\
  168. s==0{prev=$$0}\
  169. s==1{print "#define", $$1, "@PNG_PREFIX@" $$1}\
  170. s==2{print "#define @PNG_PREFIX@png_" $$1, "PNG_" $$1}\
  171. END{print prev}' s=0 pnglibconf.out s=1 scripts/prefix.out\
  172. s=2 ${srcdir}/scripts/macro.lst >pnglibconf.tf8
  173. mv pnglibconf.tf8 $@
  174. pngprefix.h: scripts/intprefix.out
  175. rm -f pngprefix.tf1
  176. $(AWK) '{print "#define", $$1, "@PNG_PREFIX@" $$1}' $? >pngprefix.tf1
  177. mv pngprefix.tf1 $@
  178. else
  179. pnglibconf.h: pnglibconf.out
  180. rm -f $@
  181. cp $? $@
  182. pngprefix.h: # is empty
  183. :>$@
  184. endif
  185. $(srcdir)/scripts/pnglibconf.h.prebuilt:
  186. @echo "Attempting to build $@" >&2
  187. @echo "This is a machine generated file, but if you want to make" >&2
  188. @echo "a new one simply make 'scripts/pnglibconf.out', copy that" >&2
  189. @echo "AND set PNG_ZLIB_VERNUM to 0 (you MUST do this)" >&2
  190. @exit 1
  191. # The following is necessary to ensure that the local pnglibconf.h is used, not
  192. # an installed one (this can happen immediately after on a clean system if
  193. # 'make test' is the first thing the user does.) Only files which include
  194. # one of the png source files (typically png.h or pngpriv.h) need to be listed
  195. # here:
  196. pngtest.o: pnglibconf.h
  197. contrib/libtests/makepng.o: pnglibconf.h
  198. contrib/libtests/pngstest.o: pnglibconf.h
  199. contrib/libtests/pngunknown.o: pnglibconf.h
  200. contrib/libtests/pngimage.o: pnglibconf.h
  201. contrib/libtests/pngvalid.o: pnglibconf.h
  202. contrib/libtests/readpng.o: pnglibconf.h
  203. contrib/libtests/tarith.o: pnglibconf.h
  204. contrib/libtests/timepng.o: pnglibconf.h
  205. contrib/tools/makesRGB.o: pnglibconf.h
  206. contrib/tools/pngfix.o: pnglibconf.h
  207. contrib/tools/pngcp.o: pnglibconf.h
  208. # We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
  209. # be built with PNG_USE_READ_MACROS; this prevents the read macros from
  210. # interfering with the symbol file format.
  211. SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
  212. -DPNGLIB_VERSION='@PNGLIB_VERSION@'\
  213. -DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\
  214. -DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
  215. if DO_PNG_PREFIX
  216. SYMBOL_CFLAGS += -DPNG_PREFIX='@PNG_PREFIX@'
  217. endif
  218. .c.out:
  219. rm -f $@ $*.tf[12]
  220. test -d scripts || mkdir scripts || test -d scripts
  221. $(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)\
  222. $(CPPFLAGS) $(SYMBOL_CFLAGS) $< > $*.tf1
  223. $(AWK) -f "${srcdir}/scripts/dfn.awk" out="$*.tf2" $*.tf1 1>&2
  224. rm -f $*.tf1
  225. mv $*.tf2 $@
  226. # The .c file for pnglibconf.h is machine generated
  227. pnglibconf.c: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
  228. rm -f $@ $*.tf[45]
  229. $(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\
  230. ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
  231. ${srcdir}/pngusr.dfa $(DFA_XTRA) 1>&2
  232. $(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf5 $*.tf4 1>&2
  233. rm $*.tf4
  234. mv $*.tf5 $@
  235. # Symbol checks (.def and .out files should match)
  236. scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
  237. .out.chk:
  238. rm -f $@ $*.new
  239. $(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
  240. of="$*.new" $< >&2
  241. mv $*.new $@
  242. # used on demand to regenerate the standard header, CPPFLAGS should
  243. # be empty - no non-standard defines
  244. scripts/pnglibconf.c: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
  245. rm -f $@ pnglibconf.tf[67]
  246. test -z "$(CPPFLAGS)"
  247. echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
  248. $(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf6\
  249. logunsupported=1 version=search ${srcdir}/pngconf.h -\
  250. ${srcdir}/scripts/pnglibconf.dfa 1>&2
  251. $(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf7\
  252. pnglibconf.tf6 1>&2
  253. rm pnglibconf.tf6
  254. mv pnglibconf.tf7 $@
  255. $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
  256. pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h pngprefix.h
  257. test: check-am
  258. # Extra checks
  259. check: scripts/symbols.chk
  260. # Don't distribute the generated script files
  261. dist-hook:
  262. cd '$(top_distdir)'; rm -f $(SCRIPT_CLEANFILES)
  263. # Make links between installed files with release-specific names and the generic
  264. # file names. If this install rule is run the generic names will be deleted and
  265. # recreated - this has obvious issues for systems with multiple installations.
  266. install-header-links:
  267. @set -ex; cd '$(DESTDIR)$(includedir)'; for f in $(HEADERS); do \
  268. rm -f "$$f"; $(LN_S) "$(PNGLIB_BASENAME)/$$f" "$$f"; done
  269. uninstall-header-links:
  270. cd '$(DESTDIR)$(includedir)'; rm -f $(HEADERS)
  271. install-libpng-pc:
  272. @set -ex; cd '$(DESTDIR)$(pkgconfigdir)'; rm -f libpng.pc; \
  273. $(LN_S) '$(PNGLIB_BASENAME).pc' libpng.pc
  274. uninstall-libpng-pc:
  275. rm -f '$(DESTDIR)$(pkgconfigdir)/libpng.pc'
  276. # EXT_LIST is a list of the possibly library directory extensions, this exists
  277. # because we can't find a good way of discovering the file extensions that are
  278. # actually installed on a given system, so instead we check for every extension
  279. # we have seen.
  280. EXT_LIST = a dll.a so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ la sl dylib
  281. install-library-links:
  282. @set -x; cd '$(DESTDIR)$(libdir)';\
  283. for ext in $(EXT_LIST); do\
  284. rm -f "libpng.$$ext";\
  285. if test -f "$(PNGLIB_BASENAME).$$ext"; then\
  286. $(LN_S) "$(PNGLIB_BASENAME).$$ext" "libpng.$$ext" || exit 1;\
  287. fi;\
  288. done
  289. uninstall-library-links:
  290. @set -x; cd '$(DESTDIR)$(libdir)'; for ext in $(EXT_LIST); do\
  291. rm -f "libpng.$$ext"; done
  292. install-libpng-config:
  293. @set -ex; cd '$(DESTDIR)$(bindir)'; rm -f libpng-config; \
  294. $(LN_S) '$(PNGLIB_BASENAME)-config' libpng-config
  295. uninstall-libpng-config:
  296. rm -f '$(DESTDIR)$(bindir)/libpng-config'
  297. if DO_INSTALL_LINKS
  298. # If --enable-unversioned-links is specified the header and lib file links
  299. # will be automatically made on a 'make install':
  300. install-data-hook: install-header-links
  301. uninstall-hook: uninstall-header-links
  302. install-exec-hook: install-library-links
  303. uninstall-hook: uninstall-library-links
  304. endif
  305. if DO_INSTALL_LIBPNG_PC
  306. # Likewise, --install-pc causes libpng.pc to be constructed:
  307. install-data-hook: install-libpng-pc
  308. uninstall-hook: uninstall-libpng-pc
  309. endif
  310. if DO_INSTALL_LIBPNG_CONFIG
  311. # And --install-config:
  312. install-exec-hook: install-libpng-config
  313. uninstall-hook: uninstall-libpng-config
  314. endif
  315. # The following addition ensures that 'make all' always builds the test programs
  316. # too. It used to, but some change either in libpng or configure stopped this
  317. # working.
  318. all-am: $(check_PROGRAMS)