Makefile.am 13 KB

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