+scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
+scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
+
+libpng.sym: scripts/sym.out
+ rm -f $@
+ cp $? $@
+libpng.vers: scripts/vers.out
+ rm -f $@
+ cp $? $@
+pnglibconf.h: pnglibconf.out
+ rm -f $@
+ cp $? $@
+$(srcdir)/scripts/pnglibconf.h.prebuilt:
+ @echo "Attempting to build $@" >&2
+ @echo "This is a machine generated file, but if you want to make" >&2
+ @echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
+ @exit 1
+
+# The following is necessary to ensure that the local pnglibconf.h is used, not
+# an installed one (this can happen immediately after on a clean system if
+# 'make test' is the first thing the user does.)
+contrib/libtests/pngvalid.o pngtest.o: pnglibconf.h
+
+# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
+# be built with PNG_USE_READ_MACROS; this prevents the read macros from
+# interfering with the symbol file format.
+SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
+ -DPNGLIB_VERSION='@PNGLIB_VERSION@'\
+ -DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\
+ -DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
+
+.dfn.out:
+ rm -f $@ dfn.c dfn?.out
+ test -d scripts || mkdir scripts
+ echo '#include "$<"' >dfn.c
+ $(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
+ $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out
+ $(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
+ dfn1.out >dfn2.out
+ $(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out
+ rm -f dfn.c dfn[12].out
+ mv dfn3.out $@
+
+# The .dfn file for pnglibconf.h is machine generated
+pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
+ rm -f $@ dfn?.out
+ $(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out version=search\
+ ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
+ $(DFA_XTRA) 1>&2
+ $(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
+ rm dfn1.out
+ mv dfn2.out $@
+
+# Symbol checks (.def and .out files should match)
+scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
+.out.chk:
+ rm -f $@ symbols.new
+ $(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
+ $< >&2
+ mv symbols.new $@
+
+# used on demand to regenerate the standard header, CPPFLAGS should
+# be empty - no non-standard defines
+scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
+ rm -f $@ dfn?.out
+ test -z "$(CPPFLAGS)"
+ echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
+ $(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out logunsupported=1
+ version=search ${srcdir}/pngconf.h -\
+ ${srcdir}/scripts/pnglibconf.dfa 1>&2
+ $(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
+ rm dfn1.out
+ mv dfn2.out $@
+
+$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
+ pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h
+
+test: check-am
+
+# Extra checks
+check: scripts/symbols.chk
+
+# Don't distribute the generated script files
+dist-hook:
+ cd '$(top_distdir)'; rm -f $(SCRIPT_CLEANFILES)