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}/contrib/gregbook/* \
77
	${srcdir}/contrib/pngminim/* \
78 79 80 81
	${srcdir}/contrib/pngminus/* \
	${srcdir}/contrib/pngsuite/* \
	${srcdir}/contrib/visupng/* \
	$(TESTS) \
82
	example.c libpng-1.4.0beta98.txt
83

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

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

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

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

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

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

112 113
test: check

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

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

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