Makefile.am 14 KB

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