Makefile.am 4.4 KB
Newer Older
1 2 3 4
# Makefile.am:
#   Source file for Makefile.in (and hence Makefile)
#
# 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 9 10
# -version-number settings below so that the new values have
# the correct major part (first field).

11
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
12 13 14 15 16

# libpng does not follow GNU file name conventions
AUTOMAKE_OPTIONS = foreign

# test programs - run on make check, make distcheck
17 18
check_PROGRAMS= pngtest
pngtest_SOURCES = pngtest.c
19
pngtest_LDADD = libpng14.la
20 21
TESTS = test-pngtest.sh
TESTS_ENVIRONMENT= srcdir=$(srcdir) 
22 23

# man pages
24 25
dist_man_MANS= libpng.3 libpngpf.3 png.5

26
# generate the -config scripts if required
27 28
binconfigs= libpng14-config 
EXTRA_SCRIPTS= libpng-config libpng14-config
29 30 31
bin_SCRIPTS= @binconfigs@

# rules to build libpng, only build the old library on request
32
lib_LTLIBRARIES=libpng14.la
33
EXTRA_LTLIBRARIES= libpng.la
34 35
libpng14_la_SOURCES = png.c pngset.c pngget.c pngrutil.c \
	pngtrans.c pngwutil.c \
36
	pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
37
	pngwtran.c pngmem.c pngerror.c pngpread.c \
38
	png.h pngconf.h pngpriv.h
39

40
libpng14_la_CPPFLAGS = @LIBPNG_DEFINES@
41

42
# MAJOR UPGRADE: the version-number settings below must be changed.
43
libpng14_la_LDFLAGS = -no-undefined -export-dynamic \
44
	-version-number 14:@PNGLIB_RELEASE@:0
45 46 47

if HAVE_LD_VERSION_SCRIPT
  # Versioned symbols and restricted exports
48 49
  libpng14_la_LDFLAGS += -Wl,--version-script=libpng.vers
  libpng14_la_DEPENDENCIES = libpng.vers
50 51
else
  # Only restricted exports when possible
52 53
  libpng14_la_LDFLAGS += -export-symbols libpng.sym
  libpng14_la_DEPENDENCIES = libpng.sym
54
endif
55 56 57

# Avoid depending upon Character Ranges.
AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
58 59

#distribute headers in /usr/include/libpng/*
60
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
61
pkginclude_HEADERS= png.h pngconf.h
62

63 64 65
# pkg-config stuff, note that libpng.pc is always required in order
# to get the correct library
pkgconfigdir = @pkgconfigdir@
66
pkgconfig_DATA = libpng14.pc
67

68
#extra source distribution files.
69
EXTRA_DIST= \
70
	ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
71
	pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
72 73 74
	${srcdir}/projects/cbuilder5/* \
	${srcdir}/projects/visualc6/* \
	${srcdir}/projects/visualc71/* \
75
	${srcdir}/projects/xcode/* \
76
	${srcdir}/scripts/* \
77
	${srcdir}/contrib/gregbook/* \
78
	${srcdir}/contrib/pngminim/* \
79 80 81 82
	${srcdir}/contrib/pngminus/* \
	${srcdir}/contrib/pngsuite/* \
	${srcdir}/contrib/visupng/* \
	$(TESTS) \
83
	example.c libpng-1.4.0rc08.txt
84

85
CLEANFILES= pngout.png libpng14.pc libpng14-config libpng.vers \
86
libpng.sym
87

88 89
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing
90

91 92
$(PNGLIB_BASENAME).pc: libpng.pc
	cp libpng.pc $@
93

94 95
$(PNGLIB_BASENAME)-config: libpng-config
	cp libpng-config $@
96

97
libpng.sym: png.h pngconf.h
98
	rm -f $@ $@.new
99
	$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
100
		$(SED) -n -e \
101 102 103
		's|^.*PNG_FUNCTION_EXPORT[ 	]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
		-e 's|^.*PNG_DATA_EXPORT[ 	]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
			>$@.new
104 105 106
	mv $@.new $@

libpng.vers: libpng.sym
107
	rm -f $@ $@.new
108
	echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new
109
	$(SED) s/$$/\;/ libpng.sym >> $@.new
110
	echo 'local: *; };' >> $@.new
111 112
	mv $@.new $@

113 114
test: check

115 116
# install the .../include headers as links to the new ones
install-data-hook:
117
	cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
118
	cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
119 120
	cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
		pngconf.h
121 122
	cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
	cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
123

124
# do evil things to libpng to cause libpng14 to be used
125
install-exec-hook:
126 127
	cd $(DESTDIR)$(bindir); rm -f libpng-config
	cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
128 129
	@set -x;\
	cd $(DESTDIR)$(libdir);\
130
	for ext in a la so sl dylib; do\
131
		rm -f libpng.$$ext;\
132 133 134
                if test -f $(PNGLIB_BASENAME).$$ext; then\
                       $(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
                fi;\
135
	done
136 137

uninstall-hook:
138
	cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
139 140
	rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
	rm -f $(DESTDIR)$(bindir)/libpng-config