blob: 4c604a8d7efd4f810f09a83e4270acfc2f2bc59e [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
5# change (e.g. libpng12 --> libpng13). In that case seach
6# this file for every instance of the old base name (libpng12)
7# and change to the new one (libpng13), then change the
8# -version-number settings below so that the new values have
9# the correct major part (first field).
10
11PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@
12
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-Pehrson17218292006-04-20 07:20:46 -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-Pehrson17218292006-04-20 07:20:46 -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-Pehrson17218292006-04-20 07:20:46 -050032lib_LTLIBRARIES=libpng14.la @compatlib@
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060033EXTRA_LTLIBRARIES= libpng.la
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050034libpng14_la_SOURCES = png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060035 pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
Glenn Randers-Pehrson26e47d92006-03-20 07:24:58 -060036 pngwtran.c pngmem.c pngerror.c pngpread.c pnggccrd.c \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050037 png.h pngconf.h pngintrn.h
38libpng_la_SOURCES = $(libpng14_la_SOURCES)
Glenn Randers-Pehrsond5d63602006-04-15 06:37:45 -050039
Glenn Randers-Pehrson629330e2006-04-17 14:33:23 -050040libpng_la_CPPFLAGS = @LIBPNG_DEFINES@
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050041libpng14_la_CPPFLAGS = @LIBPNG_DEFINES@
Glenn Randers-Pehrsond5d63602006-04-15 06:37:45 -050042
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060043# MAJOR UPGRADE: the version-number settings below must be changed.
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050044libpng14_la_LDFLAGS = -no-undefined -export-dynamic \
Glenn Randers-Pehrsonf46918d2006-06-02 05:31:20 -050045 -version-number 1:@PNGLIB_MINOR@:0
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060046# -rpath is needed as automake doesn't know the directory
47libpng_la_LDFLAGS = -rpath '$(libdir)' -no-undefined -export-dynamic \
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050048 -version-number 14:@PNGLIB_MINOR@:0
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -060049
50if HAVE_LD_VERSION_SCRIPT
51 # Versioned symbols and restricted exports
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050052 libpng14_la_LDFLAGS += -Wl,--version-script=libpng.vers
53 libpng14_la_DEPENDENCIES = libpng.vers
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -060054else
55 # Only restricted exports when possible
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050056 libpng14_la_LDFLAGS += -export-symbols libpng.sym
57 libpng14_la_DEPENDENCIES = libpng.sym
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -060058endif
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050059libpng_la_DEPENDENCIES = $(libpng14_la_DEPENDENCIES)
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060060
61#distribute headers in /usr/include/libpng/*
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060062pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060063pkginclude_HEADERS= png.h pngconf.h
64
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060065# pkg-config stuff, note that libpng.pc is always required in order
66# to get the correct library
67pkgconfigdir = @pkgconfigdir@
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050068pkgconfig_DATA = libpng14.pc
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -060069
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060070#extra source distribution files.
Glenn Randers-Pehrson7b34df32006-02-24 06:30:16 -060071EXTRA_DIST= \
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -060072 ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060073 pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
Glenn Randers-Pehrson7b34df32006-02-24 06:30:16 -060074 ${srcdir}/projects/cbuilder5/* \
75 ${srcdir}/projects/beos/* \
76 ${srcdir}/projects/visualc6/* \
77 ${srcdir}/projects/visualc71/* \
78 ${srcdir}/projects/wince.txt \
79 ${srcdir}/projects/netware.txt \
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060080 ${srcdir}/scripts/* \
81 ${srcdir}/contrib/gregbook/* \
82 ${srcdir}/contrib/pngminus/* \
83 ${srcdir}/contrib/pngsuite/* \
84 ${srcdir}/contrib/visupng/* \
85 $(TESTS) \
Glenn Randers-Pehrson26e47d92006-03-20 07:24:58 -060086 example.c libpng.txt pngvcrd.c
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060087
Glenn Randers-Pehrson17218292006-04-20 07:20:46 -050088CLEANFILES= pngout.png libpng14.pc libpng14-config libpng.vers libpng.sym
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -060089
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -050090pngconf.h.in:
91 cat pngconf.h > pngconf.h.in
92
Glenn Randers-Pehrson3424ee72006-07-12 13:33:47 -050093pngconf.h: pngconf.h.in
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -050094 sed "/Makefile-supplied defines go here:/q" pngconf.h.in > pngconf.h
95 @if test -n "@LIBPNG_NO_MMX@"; then \
Glenn Randers-Pehrson73b064c2006-05-15 06:44:21 -050096 echo "#define PNG_NO_MMX_CODE" >> pngconf.h; \
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -050097 fi
98 sed "1,/Makefile-supplied defines go here:/d" pngconf.h.in >> pngconf.h
99
Glenn Randers-Pehrson3424ee72006-07-12 13:33:47 -0500100all: pngconf.h.in pngconf.h
101
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600102$(PNGLIB_BASENAME).pc: libpng.pc
103 cp libpng.pc $@
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600104
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600105$(PNGLIB_BASENAME)-config: libpng-config
106 cp libpng-config $@
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600107
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600108libpng.sym: png.h pngconf.h
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600109 rm -f $@ $@.new
Glenn Randers-Pehrson629330e2006-04-17 14:33:23 -0500110 $(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
Glenn Randers-Pehrsonb3870ab2006-05-11 09:43:09 -0500111 $(SED) -n -e \
112 's|^.*PNG_FUNCTION_EXPORT[ ]*\([a-zA-Z0-9_]*\).*$$|\1|p' \
113 -e 's|^.*PNG_DATA_EXPORT[ ]*\([a-zA-Z0-9_]*\).*$$|\1|p' \
114 >$@.new
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600115 mv $@.new $@
116
117libpng.vers: libpng.sym
Glenn Randers-Pehrson5c60b232006-03-07 07:09:22 -0600118 rm -f $@ $@.new
119 $(ECHO) PNG@PNGLIB_MAJOR@_0 '{global:' > $@.new
Glenn Randers-Pehrson26e47d92006-03-20 07:24:58 -0600120 $(SED) s/$$/\;/ libpng.sym >> $@.new
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600121 $(ECHO) 'local: *; };' >> $@.new
122 mv $@.new $@
123
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600124# install the .../include headers as links to the new ones
125install-data-hook:
126 cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
127 cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
128 cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h pngconf.h
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600129 cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
130 cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
Glenn Randers-Pehrson917648e2004-12-02 18:14:51 -0600131
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500132# do evil things to libpng to cause libpng14 to be used
Glenn Randers-Pehrsonc3d51c12006-03-02 07:23:18 -0600133install-exec-hook:
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600134 cd $(DESTDIR)$(bindir); rm -f libpng-config
135 cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
Glenn Randers-Pehrsond60b8fa2006-04-20 21:31:14 -0500136 @set -x;\
137 cd $(DESTDIR)$(libdir);\
138 for ext in a la so; do\
139 rm -f libpng.$$ext;\
140 $(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
141 done
Glenn Randers-Pehrsone6474622006-03-04 16:50:47 -0600142
143uninstall-hook:
144 cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
145 rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
146 rm -f $(DESTDIR)$(bindir)/libpng-config
147 @if test -n "@compatlib@"; then\
148 set -x;\
149 cd $(DESTDIR)$(libdir);\
150 for ext in a la so; do\
151 rm -f libpng.$$ext;\
152 done;\
153 fi