Makefile.am 13 KB

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