Makefile.am 8.2 KB
Newer Older
1 2 3 4
# Makefile.am:
#   Source file for Makefile.in (and hence Makefile)
#

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 11
TESTS_ENVIRONMENT= srcdir=$(srcdir)
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
18
pngvalid_SOURCES = contrib/libtests/pngvalid.c
19
pngstest_SOURCES = contrib/libtests/pngstest.c
20
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
21
pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
22
TESTS += test-pngvalid-simple.sh test-pngvalid-full.sh test-pngstest.sh
23 24

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

27
# generate the -config scripts if required
28
binconfigs= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
29
EXTRA_SCRIPTS= libpng-config libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config
30 31 32
bin_SCRIPTS= @binconfigs@

# rules to build libpng, only build the old library on request
33 34
lib_LTLIBRARIES=libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
# EXTRA_LTLIBRARIES= libpng.la
35
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngerror.c\
G
[devel]  
Glenn Randers-Pehrson 已提交
36 37
	pngget.c pngmem.c pngpread.c pngread.c pngrio.c pngrtran.c pngrutil.c\
	pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
38
	png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h
39

40 41 42 43
if PNG_ARM_NEON
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/filter_neon.S
endif

44 45
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h

46 47
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
	-version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
48 49

if HAVE_LD_VERSION_SCRIPT
50 51
#   Versioned symbols and restricted exports
if HAVE_SOLARIS_LD
52
  libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,-M -Wl,libpng.vers
53
else
54
  libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,--version-script=libpng.vers
55 56
endif

57
  libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
58
else
59
#   Only restricted exports when possible
60 61
  libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -export-symbols libpng.sym
  libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
62
endif
63

64
#distribute headers in /usr/include/libpng/*
65
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
66
pkginclude_HEADERS= png.h pngconf.h
67
nodist_pkginclude_HEADERS= pnglibconf.h
68

69 70 71
# pkg-config stuff, note that libpng.pc is always required in order
# to get the correct library
pkgconfigdir = @pkgconfigdir@
72
pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
73

74
#extra source distribution files.
75
EXTRA_DIST= \
76
	ANNOUNCE CHANGES INSTALL LICENSE README TODO \
77
	pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
78
	${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
79
	$(TESTS) \
80
	CMakeLists.txt example.c libpng-manual.txt
81

82 83
SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn

84
CLEANFILES= *.tf? pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
85
	libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
86
	check.new pnglibconf.* symbols.new pngtest-log.txt \
87
	$(SCRIPT_CLEANFILES)
88

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

92 93 94 95 96 97
# PNG_COPTS give extra options for the C compiler to be used on all compilation
# steps (unless targe_CFLAGS is specified; that will take precedence over
# AM_CFLAGS)
PNG_COPTS = @PNG_COPTS@
AM_CFLAGS = ${PNG_COPTS}

98 99 100 101 102 103 104
# DFNCPP is normally just CPP - the C preprocessor - but on Solaris and maybe
# other operating systems (NeXT?) the C preprocessor selected by configure
# checks input tokens for validity - effectively it performs part of the ANSI-C
# parsing - and therefore fails with the .df files.  configure.ac has special
# checks for this and sets DFNCPP appropriately.
DFNCPP = @DFNCPP@

105
SUFFIXES = .chk .dfn .out
106

107 108
$(PNGLIB_BASENAME).pc: libpng.pc
	cp libpng.pc $@
109

110 111
$(PNGLIB_BASENAME)-config: libpng-config
	cp libpng-config $@
112

113 114
scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
scripts/symbols.out: png.h pngconf.h $(srcdir)/scripts/pnglibconf.h.prebuilt
115 116 117 118 119 120 121

libpng.sym: scripts/sym.out
	rm -f $@
	cp $? $@
libpng.vers: scripts/vers.out
	rm -f $@
	cp $? $@
122
pnglibconf.h: pnglibconf.out
123 124
	rm -f $@
	cp $? $@
125 126
$(srcdir)/scripts/pnglibconf.h.prebuilt:
	@echo "Attempting to build $@" >&2
127 128 129
	@echo "This is a machine generated file, but if you want to make" >&2
	@echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
	@exit 1
130

131 132 133
# The following is necessary to ensure that the local pnglibconf.h is used, not
# an installed one (this can happen immediately after on a clean system if
# 'make test' is the first thing the user does.)
134
contrib/libtests/pngstest.o contrib/libtests/pngvalid.o pngtest.o: pnglibconf.h
135

136
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
137 138
# be built with PNG_USE_READ_MACROS; this prevents the read macros from
# interfering with the symbol file format.
139 140
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
		-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
141
		-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'\
142
		-DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
143

144
.dfn.out:
145
	rm -f $@ $*.c $*.tf[123]
146
	test -d scripts || mkdir scripts
147
	echo '#include "$<"' >$*.c
148
	$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)\
149
	    $(CPPFLAGS) $(SYMBOL_CFLAGS) $*.c > $*.tf1
150
	$(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
151 152 153 154
	    $*.tf1 >$*.tf2
	$(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' $*.tf2 >$*.tf3
	rm -f $*.c $*.tf[12]
	mv $*.tf3 $@
155

156
# The .dfn file for pnglibconf.h is machine generated
157
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
158 159
	rm -f $@ $*.tf[45]
	$(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\
160 161
	    ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
	    $(DFA_XTRA) 1>&2
162 163 164
	$(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf5 $*.tf4 1>&2
	rm $*.tf4
	mv $*.tf5 $@
165 166 167

# Symbol checks (.def and .out files should match)
scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
168

169
.out.chk:
170
	rm -f $@ $*.new
171
	$(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
172 173
	    of="$*.new" $< >&2
	mv $*.new $@
174

175 176
# used on demand to regenerate the standard header, CPPFLAGS should
# be empty - no non-standard defines
177
scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
178
	rm -f $@ pnglibconf.tf[67]
179
	test -z "$(CPPFLAGS)"
180
	echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
181 182 183 184 185 186 187
	$(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf6\
	    logunsupported=1 version=search ${srcdir}/pngconf.h -\
	    ${srcdir}/scripts/pnglibconf.dfa 1>&2
	$(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf7\
	    pnglibconf.tf6 1>&2
	rm pnglibconf.tf6
	mv pnglibconf.tf7 $@
188 189

$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
190
	pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h
191 192 193 194

test: check-am

# Extra checks
195
check: scripts/symbols.chk
196

197 198 199
# Don't distribute the generated script files
dist-hook:
	cd '$(top_distdir)'; rm -f $(SCRIPT_CLEANFILES)
200

201 202
# install the .../include headers as links to the new ones
install-data-hook:
203
	cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
204
	cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
205 206
	cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h \
		pngconf.h
207 208
	cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pnglibconf.h \
		pnglibconf.h
209 210
	cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
	cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
211

212
# do evil things to libpng to cause libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ to be used
213
install-exec-hook:
214 215
	cd $(DESTDIR)$(bindir); rm -f libpng-config
	cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
216 217
	@set -x;\
	cd $(DESTDIR)$(libdir);\
218
	for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib dll.a; do\
219
		rm -f libpng.$$ext;\
220 221 222
                if test -f $(PNGLIB_BASENAME).$$ext; then\
                       $(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
                fi;\
223
	done
224 225

uninstall-hook:
226
	cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h pnglibconf.h
227 228
	rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
	rm -f $(DESTDIR)$(bindir)/libpng-config
229 230
	rm -f $(DESTDIR)$(libdir)/libpng.a
	rm -f $(DESTDIR)$(libdir)/libpng.la
231
	rm -f $(DESTDIR)$(libdir)/libpng.dll.a