]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/libpng/lib/dist/Makefile.am
ca44c68d45896321e4c0e3f5d80d3afeed272e58
[l4.git] / l4 / pkg / libpng / lib / dist / Makefile.am
1 # Makefile.am:
2 #   Source file for Makefile.in (and hence Makefile)
3 #
4
5 PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
6
7 ACLOCAL_AMFLAGS = -I scripts
8
9 # test programs - run on make check, make distcheck
10 TESTS_ENVIRONMENT= srcdir=$(srcdir)
11 check_PROGRAMS= pngtest
12 pngtest_SOURCES = pngtest.c
13 pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
14 TESTS = test-pngtest.sh
15
16 # Only do the following if the contrib directory is present.
17 check_PROGRAMS+= pngvalid pngstest pngunknown
18 pngvalid_SOURCES = contrib/libtests/pngvalid.c
19 pngstest_SOURCES = contrib/libtests/pngstest.c
20 pngunknown_SOURCES = contrib/libtests/pngunknown.c
21 pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
22 pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
23 pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
24 TESTS += contrib/libtests/test-pngunknown.sh\
25          contrib/libtests/test-pngvalid-simple.sh\
26          contrib/libtests/test-pngvalid-full.sh\
27          contrib/libtests/test-pngstest.sh
28
29 # man pages
30 dist_man_MANS= libpng.3 libpngpf.3 png.5
31
32 # generate the -config scripts if required
33 binconfigs= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
34 EXTRA_SCRIPTS= libpng-config libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
35 bin_SCRIPTS= @binconfigs@
36
37 # rules to build libpng, only build the old library on request
38 lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
39 # EXTRA_LTLIBRARIES= libpng.la
40 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
41         pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
42         pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
43         png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngusr.dfa
44
45 if PNG_ARM_NEON
46 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
47         arm/filter_neon.S
48 endif
49
50 nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
51
52 libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
53         -version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
54
55 if HAVE_LD_VERSION_SCRIPT
56 #   Versioned symbols and restricted exports
57 if HAVE_SOLARIS_LD
58   libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,-M -Wl,libpng.vers
59 else
60   libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,--version-script=libpng.vers
61 endif
62
63   libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
64 else
65 #   Only restricted exports when possible
66   libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -export-symbols libpng.sym
67   libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
68 endif
69
70 #distribute headers in /usr/include/libpng/*
71 pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
72 pkginclude_HEADERS= png.h pngconf.h
73 nodist_pkginclude_HEADERS= pnglibconf.h
74
75 # pkg-config stuff, note that libpng.pc is always required in order
76 # to get the correct library
77 pkgconfigdir = @pkgconfigdir@
78 pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
79
80 #extra source distribution files.
81 EXTRA_DIST= \
82         ANNOUNCE CHANGES INSTALL LICENSE README TODO \
83         pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
84         ${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
85         $(TESTS) \
86         CMakeLists.txt example.c libpng-manual.txt
87
88 SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
89
90 CLEANFILES= *.tf? pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
91         libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
92         check.new pnglibconf.* pngprefix.h symbols.new pngtest-log.txt \
93         $(SCRIPT_CLEANFILES)
94
95 MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
96 config.sub configure depcomp install-sh ltmain.sh missing
97
98 # PNG_COPTS give extra options for the C compiler to be used on all compilation
99 # steps (unless targe_CFLAGS is specified; that will take precedence over
100 # AM_CFLAGS)
101 PNG_COPTS = @PNG_COPTS@
102 AM_CFLAGS = ${PNG_COPTS}
103
104 # DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe
105 # other operating systems (NeXT?) the C preprocessor selected by configure
106 # checks input tokens for validity - effectively it performs part of the ANSI-C
107 # parsing - and therefore fails with the .df files.  configure.ac has special
108 # checks for this and sets DFNCPP appropriately.
109 DFNCPP = @DFNCPP@
110
111 SUFFIXES = .chk .dfn .out
112
113 $(PNGLIB_BASENAME).pc: libpng.pc
114         cp libpng.pc $@
115
116 $(PNGLIB_BASENAME)-config: libpng-config
117         cp libpng-config $@
118
119 scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
120 scripts/prefix.out: png.h pngconf.h pnglibconf.out
121 scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
122 scripts/intprefix.out: pnglibconf.h
123
124 libpng.sym: scripts/sym.out
125         rm -f $@
126         cp $? $@
127 libpng.vers: scripts/vers.out
128         rm -f $@
129         cp $? $@
130
131 if DO_PNG_PREFIX
132 # Rename functions in scripts/prefix.out with a PNG_PREFIX prefix.
133 # Rename macros in scripts/macro.lst from PNG_PREFIXpng_ to PNG_ (the actual
134 # implementation of the macro).
135 pnglibconf.h: pnglibconf.out scripts/prefix.out scripts/macro.lst
136         rm -f $@
137         $(AWK) 's==0 && NR>1{print prev}\
138            s==0{prev=$$0}\
139            s==1{print "#define", $$1, "@PNG_PREFIX@" $$1}\
140            s==2{print "#define @PNG_PREFIX@png_" $$1, "PNG_" $$1}\
141            END{print prev}' s=0 pnglibconf.out s=1 scripts/prefix.out\
142            s=2 ${srcdir}/scripts/macro.lst >pnglibconf.tf8
143         mv pnglibconf.tf8 $@
144
145 pngprefix.h: scripts/intprefix.out
146         rm -f pngprefix.tf1
147         $(AWK) '{print "#define", $$1, "@PNG_PREFIX@" $$1}' $? >pngprefix.tf1
148         mv pngprefix.tf1 $@
149 else
150 pnglibconf.h: pnglibconf.out
151         rm -f $@
152         cp $? $@
153
154 pngprefix.h: # is empty
155         :>$@
156 endif
157
158 $(srcdir)/scripts/pnglibconf.h.prebuilt:
159         @echo "Attempting to build $@" >&2
160         @echo "This is a machine generated file, but if you want to make" >&2
161         @echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
162         @exit 1
163
164 # The following is necessary to ensure that the local pnglibconf.h is used, not
165 # an installed one (this can happen immediately after on a clean system if
166 # 'make test' is the first thing the user does.)
167 contrib/libtests/pngstest.o contrib/libtests/pngvalid.o pngtest.o: pnglibconf.h
168 contrib/libtests/pngunknown.o: pnglibconf.h
169
170 # We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
171 # be built with PNG_USE_READ_MACROS; this prevents the read macros from
172 # interfering with the symbol file format.
173 SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
174                 -DPNGLIB_VERSION='@PNGLIB_VERSION@'\
175                 -DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\
176                 -DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
177
178 if DO_PNG_PREFIX
179 SYMBOL_CFLAGS += -DPNG_PREFIX='@PNG_PREFIX@'
180 endif
181
182 .dfn.out:
183         rm -f $@ $*.c $*.tf[123]
184         test -d scripts || mkdir scripts
185         echo '#include "$<"' >$*.c
186         $(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)\
187             $(CPPFLAGS) $(SYMBOL_CFLAGS) $*.c > $*.tf1
188         $(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
189             $*.tf1 >$*.tf2
190         $(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' $*.tf2 >$*.tf3
191         rm -f $*.c $*.tf[12]
192         mv $*.tf3 $@
193
194 # The .dfn file for pnglibconf.h is machine generated
195 pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pngusr.dfa $(DFA_XTRA)
196         rm -f $@ $*.tf[45]
197         $(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\
198             ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
199             ${srcdir}/pngusr.dfa $(DFA_XTRA) 1>&2
200         $(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf5 $*.tf4 1>&2
201         rm $*.tf4
202         mv $*.tf5 $@
203
204 # Symbol checks (.def and .out files should match)
205 scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
206
207 .out.chk:
208         rm -f $@ $*.new
209         $(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
210             of="$*.new" $< >&2
211         mv $*.new $@
212
213 # used on demand to regenerate the standard header, CPPFLAGS should
214 # be empty - no non-standard defines
215 scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
216         rm -f $@ pnglibconf.tf[67]
217         test -z "$(CPPFLAGS)"
218         echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
219         $(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf6\
220             logunsupported=1 version=search ${srcdir}/pngconf.h -\
221             ${srcdir}/scripts/pnglibconf.dfa 1>&2
222         $(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf7\
223             pnglibconf.tf6 1>&2
224         rm pnglibconf.tf6
225         mv pnglibconf.tf7 $@
226
227 $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
228         pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h pngprefix.h
229
230 test: check-am
231
232 # Extra checks
233 check: scripts/symbols.chk
234
235 # Don't distribute the generated script files
236 dist-hook:
237         cd '$(top_distdir)'; rm -f $(SCRIPT_CLEANFILES)
238
239 # install the .../include headers as links to the new ones
240 install-data-hook:
241         cd '$(DESTDIR)$(includedir)'; rm -f png.h pngconf.h pnglibconf.h
242         cd '$(DESTDIR)$(includedir)'; $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
243         cd '$(DESTDIR)$(includedir)'; $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
244                 pngconf.h
245         cd '$(DESTDIR)$(includedir)'; $(LN_S) $(PNGLIB_BASENAME)/pnglibconf.h \
246                 pnglibconf.h
247         cd '$(DESTDIR)$(pkgconfigdir)'; rm -f libpng.pc
248         cd '$(DESTDIR)$(pkgconfigdir)'; $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
249
250 # do evil things to libpng to cause libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ to be used
251 install-exec-hook:
252         cd '$(DESTDIR)$(bindir)'; rm -f libpng-config
253         cd '$(DESTDIR)$(bindir)';\
254            $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
255         @set -x;\
256         cd '$(DESTDIR)$(libdir)';\
257         for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@\
258            sl dylib dll.a; do\
259                 rm -f libpng.$$ext;\
260                 if test -f $(PNGLIB_BASENAME).$$ext; then\
261                        $(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
262                 fi;\
263         done
264
265 uninstall-hook:
266         cd '$(DESTDIR)$(includedir)'; rm -f png.h pngconf.h pnglibconf.h
267         rm -f '$(DESTDIR)$(pkgconfigdir)/libpng.pc'
268         rm -f '$(DESTDIR)$(bindir)/libpng-config'
269         rm -f '$(DESTDIR)$(libdir)/libpng.a'
270         rm -f '$(DESTDIR)$(libdir)/libpng.la'
271         rm -f '$(DESTDIR)$(libdir)/libpng.so'
272         rm -f '$(DESTDIR)$(libdir)/libpng.so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@'
273         rm -f '$(DESTDIR)$(libdir)/libpng.sl'
274         rm -f '$(DESTDIR)$(libdir)/libpng.dylib'
275         rm -f '$(DESTDIR)$(libdir)/libpng.dll.a'