blob: e7879be380377ec6974abd66eb407a1cabce967e [file] [log] [blame]
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -06001# Makefile.am:
2# Source file for Makefile.in (and hence Makefile)
3#
4# Makefile.am need only be changed on a major version number
Glenn Randers-Pehrson78c419c2009-11-12 22:24:59 -06005# change (e.g. libpng12 --> libpng13). In that case seach
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -05006# this file for every instance of the old base name (libpng12)
Glenn Randers-Pehrson78c419c2009-11-12 22:24:59 -06007# and change to the new one (libpng13), then change the
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -06008# -version-number settings below so that the new values have
9# the correct major part (first field).
10
Glenn Randers-Pehrsona7dbcba2007-05-15 16:16:34 -050011PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060012
13# libpng does not follow GNU file name conventions
14AUTOMAKE_OPTIONS = foreign
15
16# test programs - run on make check, make distcheck
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060017check_PROGRAMS= pngtest
18pngtest_SOURCES = pngtest.c
Glenn Randers-Pehrson8568f6e2009-07-28 17:20:26 -050019pngtest_LDADD = libpng14.la
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060020TESTS = test-pngtest.sh
21TESTS_ENVIRONMENT= srcdir=$(srcdir)
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060022
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060023# man pages
24dist_man_MANS= libpng.3 libpngpf.3 png.5
25
26# generate the -config scripts if required
Glenn Randers-Pehrson8568f6e2009-07-28 17:20:26 -050027binconfigs= libpng14-config
28EXTRA_SCRIPTS= libpng-config libpng14-config
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060029bin_SCRIPTS= @binconfigs@
30
31# rules to build libpng, only build the old library on request
Glenn Randers-Pehrson78c419c2009-11-12 22:24:59 -060032lib_LTLIBRARIES=libpng14.la
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060033EXTRA_LTLIBRARIES= libpng.la
Glenn Randers-Pehrson78c419c2009-11-12 22:24:59 -060034libpng14_la_SOURCES = png.c pngset.c pngget.c pngrutil.c \
35 pngtrans.c pngwutil.c \
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060036 pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -050037 pngwtran.c pngmem.c pngerror.c pngpread.c \
Glenn Randers-Pehrson1c6959c2009-11-12 18:10:00 -060038 png.h pngconf.h pngpriv.h
Glenn Randers-Pehrsond5d63602006-04-15 06:37:45 -050039
Glenn Randers-Pehrson8568f6e2009-07-28 17:20:26 -050040libpng14_la_CPPFLAGS = @LIBPNG_DEFINES@
Glenn Randers-Pehrsond5d63602006-04-15 06:37:45 -050041
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060042# MAJOR UPGRADE: the version-number settings below must be changed.
Glenn Randers-Pehrson8568f6e2009-07-28 17:20:26 -050043libpng14_la_LDFLAGS = -no-undefined -export-dynamic \
Glenn Randers-Pehrson1c6959c2009-11-12 18:10:00 -060044 -version-number 14:@PNGLIB_RELEASE@:0
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -060045
46if HAVE_LD_VERSION_SCRIPT
47 # Versioned symbols and restricted exports
Glenn Randers-Pehrson8568f6e2009-07-28 17:20:26 -050048 libpng14_la_LDFLAGS += -Wl,--version-script=libpng.vers
49 libpng14_la_DEPENDENCIES = libpng.vers
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -060050else
51 # Only restricted exports when possible
Glenn Randers-Pehrson8568f6e2009-07-28 17:20:26 -050052 libpng14_la_LDFLAGS += -export-symbols libpng.sym
53 libpng14_la_DEPENDENCIES = libpng.sym
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -060054endif
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -050055
56# Avoid depending upon Character Ranges.
57AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060058
59#distribute headers in /usr/include/libpng/*
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060060pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -050061pkginclude_HEADERS= png.h pngconf.h
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060062
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060063# pkg-config stuff, note that libpng.pc is always required in order
64# to get the correct library
65pkgconfigdir = @pkgconfigdir@
Glenn Randers-Pehrson8568f6e2009-07-28 17:20:26 -050066pkgconfig_DATA = libpng14.pc
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060067
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060068#extra source distribution files.
Glenn Randers-Pehrson7b34df32006-02-24 06:30:16 -060069EXTRA_DIST= \
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -060070 ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060071 pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
Glenn Randers-Pehrson7b34df32006-02-24 06:30:16 -060072 ${srcdir}/projects/cbuilder5/* \
Glenn Randers-Pehrson7b34df32006-02-24 06:30:16 -060073 ${srcdir}/projects/visualc6/* \
74 ${srcdir}/projects/visualc71/* \
Glenn Randers-Pehrson78c419c2009-11-12 22:24:59 -060075 ${srcdir}/projects/xcode/* \
Glenn Randers-Pehrsonb612eee2009-11-14 05:44:01 -060076 ${srcdir}/scripts/* \
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060077 ${srcdir}/contrib/gregbook/* \
Glenn Randers-Pehrson78c419c2009-11-12 22:24:59 -060078 ${srcdir}/contrib/pngminim/* \
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060079 ${srcdir}/contrib/pngminus/* \
80 ${srcdir}/contrib/pngsuite/* \
81 ${srcdir}/contrib/visupng/* \
82 $(TESTS) \
Glenn Randers-Pehrsonf81b50b2009-12-29 16:50:15 -060083 example.c libpng-1.4.0rc06.txt
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060084
Glenn Randers-Pehrson8568f6e2009-07-28 17:20:26 -050085CLEANFILES= pngout.png libpng14.pc libpng14-config libpng.vers \
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -050086libpng.sym
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060087
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -050088MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
89config.sub configure depcomp install-sh ltmain.sh missing
Glenn Randers-Pehrson3424ee72006-07-12 13:33:47 -050090
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060091$(PNGLIB_BASENAME).pc: libpng.pc
92 cp libpng.pc $@
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060093
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060094$(PNGLIB_BASENAME)-config: libpng-config
95 cp libpng-config $@
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060096
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -050097libpng.sym: png.h pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -060098 rm -f $@ $@.new
Glenn Randers-Pehrson629330e2006-04-17 14:33:23 -050099 $(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -0500100 $(SED) -n -e \
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500101 's|^.*PNG_FUNCTION_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
102 -e 's|^.*PNG_DATA_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
103 >$@.new
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600104 mv $@.new $@
105
106libpng.vers: libpng.sym
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600107 rm -f $@ $@.new
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500108 echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new
Glenn Randers-Pehrson26e47d92006-03-20 07:24:58 -0600109 $(SED) s/$$/\;/ libpng.sym >> $@.new
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500110 echo 'local: *; };' >> $@.new
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600111 mv $@.new $@
112
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500113test: check
114
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600115# install the .../include headers as links to the new ones
116install-data-hook:
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500117 cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600118 cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
Glenn Randers-Pehrsonf7831012008-11-13 06:05:13 -0600119 cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
120 pngconf.h
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600121 cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
122 cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600123
Glenn Randers-Pehrson8568f6e2009-07-28 17:20:26 -0500124# do evil things to libpng to cause libpng14 to be used
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600125install-exec-hook:
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600126 cd $(DESTDIR)$(bindir); rm -f libpng-config
127 cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500128 @set -x;\
129 cd $(DESTDIR)$(libdir);\
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500130 for ext in a la so sl dylib; do\
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500131 rm -f libpng.$$ext;\
Glenn Randers-Pehrson3779c692006-11-07 20:38:11 -0600132 if test -f $(PNGLIB_BASENAME).$$ext; then\
133 $(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
134 fi;\
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500135 done
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600136
137uninstall-hook:
Glenn Randers-Pehrsoneb580912008-07-30 14:47:09 -0500138 cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600139 rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
140 rm -f $(DESTDIR)$(bindir)/libpng-config