2 # Source file for Makefile.in (and hence Makefile)
5 PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
7 # libpng does not follow GNU file name conventions
9 # "color-tests" requires automake 1.11.1 or later. Enable it if you like,
10 # to get red "FAIL" and green "PASS" notations during tests.
11 # AUTOMAKE_OPTIONS = foreign color-tests
12 AUTOMAKE_OPTIONS = foreign
14 # test programs - run on make check, make distcheck
15 TESTS_ENVIRONMENT= srcdir=$(srcdir)
16 check_PROGRAMS= pngtest
17 pngtest_SOURCES = pngtest.c
18 pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
19 TESTS = test-pngtest.sh
21 # Only do the following if the contrib directory is present.
22 check_PROGRAMS+= pngvalid
23 pngvalid_SOURCES = contrib/libtests/pngvalid.c
24 pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
25 TESTS += test-pngvalid-simple.sh test-pngvalid-full.sh
28 dist_man_MANS= libpng.3 libpngpf.3 png.5
30 # generate the -config scripts if required
31 binconfigs= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
32 EXTRA_SCRIPTS= libpng-config libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
33 bin_SCRIPTS= @binconfigs@
35 # rules to build libpng, only build the old library on request
36 lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
37 # EXTRA_LTLIBRARIES= libpng.la
38 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
39 pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
40 pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
41 png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
44 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/filter_neon.S
47 nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
49 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
51 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
52 -version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
54 if HAVE_LD_VERSION_SCRIPT
55 # Versioned symbols and restricted exports
57 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,-M -Wl,libpng.vers
59 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,--version-script=libpng.vers
62 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
64 # Only restricted exports when possible
65 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -export-symbols libpng.sym
66 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
69 #distribute headers in /usr/include/libpng/*
70 pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
71 pkginclude_HEADERS= png.h pngconf.h
72 nodist_pkginclude_HEADERS= pnglibconf.h
74 # pkg-config stuff, note that libpng.pc is always required in order
75 # to get the correct library
76 pkgconfigdir = @pkgconfigdir@
77 pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
79 #extra source distribution files.
81 ANNOUNCE CHANGES INSTALL LICENSE README TODO \
82 pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
83 ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
85 CMakeLists.txt example.c libpng-manual.txt
87 SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
89 CLEANFILES= dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
90 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
91 check.new pnglibconf.* symbols.new pngtest-log.txt \
94 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
95 config.sub configure depcomp install-sh ltmain.sh missing
97 # DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe
98 # other operating systems (NeXT?) the C preprocessor selected by configure
99 # checks input tokens for validity - effectively it performs part of the ANSI-C
100 # parsing - and therefore fails with the .df files. configure.ac has special
101 # checks for this and sets DFNCPP appropriately.
104 SUFFIXES = .chk .dfn .out
106 $(PNGLIB_BASENAME).pc: libpng.pc
109 $(PNGLIB_BASENAME)-config: libpng-config
112 scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
113 scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
115 libpng.sym: scripts/sym.out
118 libpng.vers: scripts/vers.out
121 pnglibconf.h: pnglibconf.out
124 $(srcdir)/scripts/pnglibconf.h.prebuilt:
125 @echo "Attempting to build $@" >&2
126 @echo "This is a machine generated file, but if you want to make" >&2
127 @echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
130 # The following is necessary to ensure that the local pnglibconf.h is used, not
131 # an installed one (this can happen immediately after on a clean system if
132 # 'make test' is the first thing the user does.)
133 contrib/libtests/pngvalid.o pngtest.o: pnglibconf.h
135 # We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
136 # be built with PNG_USE_READ_MACROS; this prevents the read macros from
137 # interfering with the symbol file format.
138 SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
139 -DPNGLIB_VERSION='@PNGLIB_VERSION@'\
140 -DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\
141 -DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
144 rm -f $@ dfn.c dfn?.out
145 test -d scripts || mkdir scripts
146 echo '#include "$<"' >dfn.c
147 $(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
148 $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out
149 $(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
151 $(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out
152 rm -f dfn.c dfn[12].out
155 # The .dfn file for pnglibconf.h is machine generated
156 pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
158 $(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out version=search\
159 ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
161 $(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
165 # Symbol checks (.def and .out files should match)
166 scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
169 $(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
173 # used on demand to regenerate the standard header, CPPFLAGS should
174 # be empty - no non-standard defines
175 scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
177 test -z "$(CPPFLAGS)"
178 echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
179 $(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out logunsupported=1
180 version=search ${srcdir}/pngconf.h -\
181 ${srcdir}/scripts/pnglibconf.dfa 1>&2
182 $(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2
186 $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
187 pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h
192 check: scripts/symbols.chk
194 # Don't distribute the generated script files
196 cd '$(top_distdir)'; rm -f $(SCRIPT_CLEANFILES)
198 # install the .../include headers as links to the new ones
200 cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
201 cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
202 cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
204 cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pnglibconf.h \
206 cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
207 cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
209 # do evil things to libpng to cause libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ to be used
211 cd $(DESTDIR)$(bindir); rm -f libpng-config
212 cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
214 cd $(DESTDIR)$(libdir);\
215 for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib dll.a; do\
217 if test -f $(PNGLIB_BASENAME).$$ext; then\
218 $(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
223 cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
224 rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
225 rm -f $(DESTDIR)$(bindir)/libpng-config
226 rm -f $(DESTDIR)$(libdir)/libpng.a
227 rm -f $(DESTDIR)$(libdir)/libpng.la