Makefile.am 14 KB

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