[poppler] configure.ac cpp/Makefile.am cpp/tests fofi/Makefile.am glib/demo glib/Makefile.am glib/reference goo/Makefile.am poppler/Makefile.am qt4/demos qt4/src qt4/tests qt5/demos qt5/src qt5/tests splash/Makefile.am test/Makefile.am utils/Makefile.am

Albert Astals Cid aacid at kemper.freedesktop.org
Tue Aug 12 09:14:23 PDT 2014


 configure.ac               |   13 +++-
 cpp/Makefile.am            |   66 +++++++++++++------------
 cpp/tests/Makefile.am      |   13 +---
 fofi/Makefile.am           |    6 +-
 glib/Makefile.am           |   29 ++++++-----
 glib/demo/Makefile.am      |   18 +++---
 glib/reference/Makefile.am |    3 -
 goo/Makefile.am            |   38 +++++++-------
 poppler/Makefile.am        |  118 ++++++++++++++++++++++-----------------------
 qt4/demos/Makefile.am      |   59 +++++++++++-----------
 qt4/src/Makefile.am        |   31 ++++++-----
 qt4/tests/Makefile.am      |   97 ++++++++++++------------------------
 qt5/demos/Makefile.am      |   59 +++++++++++-----------
 qt5/src/Makefile.am        |   27 +++++-----
 qt5/tests/Makefile.am      |   98 +++++++++++++------------------------
 splash/Makefile.am         |   42 ++++++++--------
 test/Makefile.am           |   68 ++++++++-----------------
 utils/Makefile.am          |   97 ++++++++++++++++++------------------
 18 files changed, 405 insertions(+), 477 deletions(-)

New commits:
commit 572c60764bbbd2080bfd7a926c646ad20b467aea
Author: Hib Eris <hib at hiberis.nl>
Date:   Tue Aug 12 18:12:45 2014 +0200

    Makefile.am cleanups
    
    Bug #79411

diff --git a/configure.ac b/configure.ac
index 9436fdd..477b2f7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -465,6 +465,7 @@ fi
 
 CAIRO_VERSION="1.10.0"
 AC_SUBST(CAIRO_VERSION)
+CAIRO_DEPS="cairo >= $CAIRO_VERSION cairo-ft >= $CAIRO_VERSION)"
 AC_ARG_ENABLE(cairo-output,
               AC_HELP_STRING([--disable-cairo-output],
                              [Don't build the cairo graphics backend.]),
@@ -472,9 +473,9 @@ AC_ARG_ENABLE(cairo-output,
               enable_cairo_output="try")
 use_cairo=""
 if test x$enable_cairo_output = xyes; then
-  PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION cairo-ft >= $CAIRO_VERSION)
+  PKG_CHECK_MODULES(CAIRO, $CAIRO_DEPS)
 elif test x$enable_cairo_output = xtry; then
-  PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION cairo-ft >= $CAIRO_VERSION,
+  PKG_CHECK_MODULES(CAIRO, $CAIRO_DEPS,
                     [enable_cairo_output="yes"],
                     [enable_cairo_output="no"
 		     use_cairo="no (requires cairo >= $CAIRO_VERSION)"])
@@ -699,15 +700,19 @@ fi
 AM_CONDITIONAL(BUILD_POPPLER_CPP, test "x$enable_poppler_cpp" = "xyes")
 
 
+GTK_TEST_DEPS='gtk+-3.0 >= 3.8 gdk-pixbuf-2.0'
+if test x$enable_cairo_output = xyes; then
+  GTK_TEST_DEPS="$GTK_TEST_DEPS $CAIRO_DEPS"
+fi
 AC_ARG_ENABLE(gtk-test,
               AC_HELP_STRING([--disable-gtk-test],
 	                     [Don't compile GTK+ test program.]),
               enable_gtk_test=$enableval,
               enable_gtk_test="try")
 if test x$enable_gtk_test = xyes; then
-  PKG_CHECK_MODULES(GTK_TEST, gtk+-3.0 >= 3.8 gdk-pixbuf-2.0)
+  PKG_CHECK_MODULES(GTK_TEST, $GTK_TEST_DEPS)
 elif test x$enable_gtk_test = xtry; then
-  PKG_CHECK_MODULES(GTK_TEST, gtk+-3.0 >= 3.8 gdk-pixbuf-2.0,
+  PKG_CHECK_MODULES(GTK_TEST, $GTK_TEST_DEPS,
                     [enable_gtk_test="yes"],
                     [enable_gtk_test="no"])
 fi
diff --git a/cpp/Makefile.am b/cpp/Makefile.am
index 50856e2..2b23e05 100644
--- a/cpp/Makefile.am
+++ b/cpp/Makefile.am
@@ -1,37 +1,14 @@
-INCLUDES =					\
-	-I$(top_srcdir)				\
-	-I$(top_srcdir)/goo			\
-	-I$(top_srcdir)/poppler			\
-	$(libjpeg_includes)			\
-	$(libtiff_includes)			\
-	$(libjpeg2000_includes)			\
-	$(libpng_includes)
-
-if BUILD_LIBJPEG
-libjpeg_includes = $(LIBJPEG_CFLAGS)
-endif
-
-if BUILD_LIBTIFF
-libtiff_includes = $(LIBTIFF_CFLAGS)
-endif
-
-if BUILD_LIBOPENJPEG
-libjpeg2000_includes = $(LIBOPENJPEG_CFLAGS)
-endif
-
-if BUILD_LIBPNG
-libpng_includes = $(LIBPNG_CFLAGS)
-endif
-
 SUBDIRS = . tests
 
-poppler_includedir = $(includedir)/poppler/cpp
-poppler_include_HEADERS =			\
+lib_LTLIBRARIES = libpoppler-cpp.la
+
+libpoppler_cpp_includedir = $(includedir)/poppler/cpp
+libpoppler_cpp_include_HEADERS =		\
 	poppler-document.h			\
 	poppler-embedded-file.h			\
 	poppler-font.h				\
 	poppler-global.h			\
-	poppler-image.h			\
+	poppler-image.h				\
 	poppler-page.h				\
 	poppler-page-renderer.h			\
 	poppler-page-transition.h		\
@@ -39,7 +16,6 @@ poppler_include_HEADERS =			\
 	poppler-toc.h				\
 	$(builddir)/poppler-version.h
 
-lib_LTLIBRARIES = libpoppler-cpp.la
 libpoppler_cpp_la_SOURCES =			\
 	poppler-document.cpp			\
 	poppler-document-private.h		\
@@ -60,11 +36,39 @@ libpoppler_cpp_la_SOURCES =			\
 	poppler-toc-private.h			\
 	poppler-version.cpp
 
+if BUILD_LIBJPEG
+libjpeg_includes = $(LIBJPEG_CFLAGS)
+endif
+
+if BUILD_LIBTIFF
+libtiff_includes = $(LIBTIFF_CFLAGS)
+endif
+
+if BUILD_LIBOPENJPEG
+libjpeg2000_includes = $(LIBOPENJPEG_CFLAGS)
+endif
+
+if BUILD_LIBPNG
+libpng_includes = $(LIBPNG_CFLAGS)
+endif
+
+libpoppler_cpp_la_CPPFLAGS =			\
+	-I$(top_srcdir)				\
+	-I$(top_srcdir)/goo			\
+	-I$(top_srcdir)/poppler			\
+	$(libjpeg_includes)			\
+	$(libtiff_includes)			\
+	$(libjpeg2000_includes)			\
+	$(libpng_includes)
+
 libpoppler_cpp_la_CXXFLAGS =			\
 	-Dpoppler_cpp_EXPORTS
 
-libpoppler_cpp_la_LIBADD = 			\
+libpoppler_cpp_la_LIBADD =			\
 	$(top_builddir)/poppler/libpoppler.la	\
 	$(LIBICONV)
 
-libpoppler_cpp_la_LDFLAGS = -version-info 2:0:2 @create_shared_lib@ @auto_import_flags@
+libpoppler_cpp_la_LDFLAGS =			\
+	-version-info 2:0:2			\
+	@create_shared_lib@			\
+	@auto_import_flags@
diff --git a/cpp/tests/Makefile.am b/cpp/tests/Makefile.am
index aab55f2..137a1f0 100644
--- a/cpp/tests/Makefile.am
+++ b/cpp/tests/Makefile.am
@@ -1,27 +1,22 @@
 AM_LDFLAGS = @auto_import_flags@
 
-INCLUDES =					\
+AM_CPPFLAGS =					\
 	-I$(top_srcdir)				\
 	-I$(top_srcdir)/utils			\
 	-I$(top_srcdir)/cpp
 
-LDADDS =					\
+LDADD =						\
 	$(top_builddir)/poppler/libpoppler.la	\
 	$(top_builddir)/cpp/libpoppler-cpp.la
 
-
 noinst_PROGRAMS =				\
 	poppler-dump				\
 	poppler-render
 
-poppler_dump_SOURCES = \
+poppler_dump_SOURCES =				\
 	$(top_srcdir)/utils/parseargs.cc	\
 	poppler-dump.cpp
-poppler_dump_LDADD = $(LDADDS)
-
 
-poppler_render_SOURCES = \
+poppler_render_SOURCES =			\
 	$(top_srcdir)/utils/parseargs.cc	\
 	poppler-render.cpp
-poppler_render_LDADD = $(LDADDS)
-
diff --git a/fofi/Makefile.am b/fofi/Makefile.am
index c4654dd..4deb7d5 100644
--- a/fofi/Makefile.am
+++ b/fofi/Makefile.am
@@ -1,6 +1,3 @@
-INCLUDES =					\
-	-I$(top_srcdir)
-
 noinst_LTLIBRARIES = libfofi.la
 
 if ENABLE_XPDF_HEADERS
@@ -26,3 +23,6 @@ libfofi_la_SOURCES =		\
 	FoFiType1C.cc		\
 	FoFiIdentifier.cc	\
 	FoFiType1C.h
+
+libfofi_la_CPPFLAGS =		\
+	-I$(top_srcdir)
diff --git a/glib/Makefile.am b/glib/Makefile.am
index 21ac4c7..baad5d8 100644
--- a/glib/Makefile.am
+++ b/glib/Makefile.am
@@ -1,14 +1,8 @@
 AM_LDFLAGS = @auto_import_flags@
 
 SUBDIRS = . reference demo
-INCLUDES =					\
-	-DG_LOG_DOMAIN=\"Poppler\"		\
-	-I$(top_srcdir)				\
-	-I$(top_srcdir)/poppler			\
-	$(POPPLER_GLIB_CFLAGS)			\
-	$(FREETYPE_CFLAGS)			\
-	$(POPPLER_GLIB_DISABLE_DEPRECATED)	\
-	$(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES)
+
+lib_LTLIBRARIES = libpoppler-glib.la
 
 stamp_files = stamp-poppler-enums.h
 
@@ -26,8 +20,8 @@ poppler-enums.c: poppler-enums.c.template $(poppler_glib_public_headers)
 	&& (cmp -s xgen-etbc poppler-enums.c || cp xgen-etbc poppler-enums.c ) \
 	&& rm -f xgen-etbc
 
-EXTRA_DIST = \
-	poppler-enums.h.template	\
+EXTRA_DIST =					\
+	poppler-enums.h.template		\
 	poppler-enums.c.template
 
 poppler_glib_public_headers =			\
@@ -51,7 +45,6 @@ poppler_glib_include_HEADERS =			\
 	poppler-enums.h
 nodist_poppler_glib_include_HEADERS = poppler-features.h
 
-lib_LTLIBRARIES = libpoppler-glib.la
 libpoppler_glib_la_SOURCES =			\
 	$(BUILT_SOURCES)			\
 	poppler-action.cc			\
@@ -72,13 +65,25 @@ libpoppler_glib_la_SOURCES =			\
 	poppler.cc				\
 	poppler-private.h
 
+libpoppler_glib_la_CPPFLAGS =			\
+	-DG_LOG_DOMAIN=\"Poppler\"		\
+	-I$(top_srcdir)				\
+	-I$(top_srcdir)/poppler			\
+	$(POPPLER_GLIB_CFLAGS)			\
+	$(FREETYPE_CFLAGS)			\
+	$(POPPLER_GLIB_DISABLE_DEPRECATED)	\
+	$(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES)
+
 libpoppler_glib_la_LIBADD =				\
 	$(top_builddir)/poppler/libpoppler.la		\
 	$(top_builddir)/poppler/libpoppler-cairo.la	\
 	$(POPPLER_GLIB_LIBS)				\
 	$(FREETYPE_LIBS)
 
-libpoppler_glib_la_LDFLAGS = -version-info 14:0:6 @create_shared_lib@ @auto_import_flags@
+libpoppler_glib_la_LDFLAGS =			\
+	-version-info 14:0:6			\
+	@create_shared_lib@			\
+	@auto_import_flags@
 
 BUILT_SOURCES =					\
 	poppler-enums.c				\
diff --git a/glib/demo/Makefile.am b/glib/demo/Makefile.am
index e5df9d0..2e09d8c 100644
--- a/glib/demo/Makefile.am
+++ b/glib/demo/Makefile.am
@@ -1,17 +1,10 @@
-INCLUDES = 					\
-	-I$(top_srcdir)/glib			\
-	-I$(top_builddir)/glib			\
-	$(GTK_TEST_CFLAGS)			\
-	$(POPPLER_GLIB_DISABLE_DEPRECATED)	\
-	$(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES)
-
 AM_LDFLAGS = @auto_import_flags@
 
 if BUILD_GTK_TEST
 bin_PROGRAMS = poppler-glib-demo
 endif
 
-poppler_glib_demo_SOURCES = 			\
+poppler_glib_demo_SOURCES =			\
 	main.c					\
 	annots.h				\
 	annots.c				\
@@ -50,7 +43,14 @@ poppler_glib_demo_SOURCES = 			\
 	utils.h					\
 	utils.c
 
-LDADD =						\
+poppler_glib_demo_CPPFLAGS =			\
+	-I$(top_srcdir)/glib			\
+	-I$(top_builddir)/glib			\
+	$(GTK_TEST_CFLAGS)			\
+	$(POPPLER_GLIB_DISABLE_DEPRECATED)	\
+	$(POPPLER_GLIB_DISABLE_SINGLE_INCLUDES)
+
+poppler_glib_demo_LDADD =			\
 	$(top_builddir)/glib/libpoppler-glib.la	\
 	$(top_builddir)/poppler/libpoppler.la	\
 	$(GTK_TEST_LIBS)
diff --git a/glib/reference/Makefile.am b/glib/reference/Makefile.am
index b01192d..3f772df 100644
--- a/glib/reference/Makefile.am
+++ b/glib/reference/Makefile.am
@@ -67,7 +67,8 @@ expand_content_files=
 # signals and properties.
 # e.g. INCLUDES=-I$(top_srcdir) -I$(top_builddir) $(GTK_DEBUG_FLAGS)
 # e.g. GTKDOC_LIBS=$(top_builddir)/gtk/$(gtktargetlib)
-INCLUDES=-I$(top_srcdir)/glib -I$(top_builddir)/glib	\
+GTKDOC_CFLAGS=						\
+	-I$(top_srcdir)/glib -I$(top_builddir)/glib	\
 	$(CAIRO_CFLAGS)					\
 	$(POPPLER_GLIB_CFLAGS)				\
 	$(FREETYPE_CFLAGS)
diff --git a/goo/Makefile.am b/goo/Makefile.am
index a48b20e..370e850 100644
--- a/goo/Makefile.am
+++ b/goo/Makefile.am
@@ -24,6 +24,24 @@ poppler_goo_include_HEADERS =			\
 
 endif
 
+libgoo_la_SOURCES =				\
+	gfile.cc				\
+	gmempp.cc				\
+	GooHash.cc				\
+	GooList.cc				\
+	GooTimer.cc				\
+	GooString.cc				\
+	gmem.cc					\
+	FixedPoint.cc				\
+	NetPBMWriter.cc				\
+	PNGWriter.cc				\
+	JpegWriter.cc				\
+	TiffWriter.cc				\
+	ImgWriter.cc				\
+	gtypes_p.h				\
+	gstrtod.cc				\
+	grandom.cc
+
 if BUILD_LIBJPEG
 libjpeg_includes = $(LIBJPEG_CFLAGS)
 endif
@@ -40,27 +58,9 @@ if BUILD_LIBPNG
 libpng_includes = $(LIBPNG_CFLAGS)
 endif
 
-INCLUDES =					\
+libgoo_la_CPPFLAGS =				\
 	-I$(top_srcdir)				\
 	$(libjpeg_includes)                     \
 	$(libtiff_includes)                     \
 	$(libjpeg2000_includes)                 \
 	$(libpng_includes)
-
-libgoo_la_SOURCES =				\
-	gfile.cc				\
-	gmempp.cc				\
-	GooHash.cc				\
-	GooList.cc				\
-	GooTimer.cc				\
-	GooString.cc				\
-	gmem.cc					\
-	FixedPoint.cc				\
-	NetPBMWriter.cc				\
-	PNGWriter.cc				\
-	JpegWriter.cc				\
-	TiffWriter.cc				\
-	ImgWriter.cc				\
-	gtypes_p.h				\
-	gstrtod.cc				\
-	grandom.cc
diff --git a/poppler/Makefile.am b/poppler/Makefile.am
index ce6f4b2..0bce3a1 100644
--- a/poppler/Makefile.am
+++ b/poppler/Makefile.am
@@ -1,3 +1,16 @@
+CFLAGS+=$(PTHREAD_CFLAGS)
+CXXFLAGS+=$(PTHREAD_CFLAGS)
+
+AM_CPPFLAGS =					\
+	-I$(top_srcdir)				\
+	-I$(top_srcdir)/goo
+
+lib_LTLIBRARIES = libpoppler.la
+
+if BUILD_CAIRO_OUTPUT
+noinst_LTLIBRARIES = libpoppler-cairo.la
+endif
+
 if BUILD_SPLASH_OUTPUT
 
 splash_sources =				\
@@ -15,26 +28,6 @@ splash_libs =					\
 
 endif
 
-if BUILD_CAIRO_OUTPUT
-
-poppler_cairo = libpoppler-cairo.la
-
-cairo_includes =				\
-	$(CAIRO_CFLAGS)
-
-cairo_libs =					\
-	$(CAIRO_LIBS)
-
-libpoppler_cairo_la_SOURCES =			\
-	CairoFontEngine.cc			\
-	CairoFontEngine.h			\
-	CairoOutputDev.cc			\
-	CairoOutputDev.h			\
-	CairoRescaleBox.cc			\
-	CairoRescaleBox.h
-
-endif
-
 if BUILD_LIBJPEG
 
 libjpeg_sources =				\
@@ -120,45 +113,6 @@ cms_includes = $(LCMS_CFLAGS)
 cms_libs = $(LCMS_LIBS)
 endif
 
-INCLUDES =					\
-	-I$(top_srcdir)				\
-	-I$(top_srcdir)/goo			\
-	$(cms_includes)				\
-	$(splash_includes)			\
-	$(cairo_includes)			\
-	$(libjpeg_includes)			\
-	$(libtiff_includes)			\
-	$(libjpeg2000_includes)			\
-	$(libpng_includes)			\
-	$(libcurl_includes)			\
-	$(FREETYPE_CFLAGS)			\
-	$(FONTCONFIG_CFLAGS)
-
-lib_LTLIBRARIES = libpoppler.la
-
-noinst_LTLIBRARIES = $(poppler_cairo)
-
-CFLAGS+=$(PTHREAD_CFLAGS)
-CXXFLAGS+=$(PTHREAD_CFLAGS)
-
-libpoppler_la_LIBADD =				\
-	$(top_builddir)/goo/libgoo.la		\
-	$(top_builddir)/fofi/libfofi.la		\
-	$(cms_libs)				\
-	$(splash_libs)				\
-	$(libtiff_libs)				\
-	$(libjpeg_libs)				\
-	$(libpng_libs)				\
-	$(zlib_libs)				\
-	$(libcurl_libs)				\
-	$(libjpeg2000_libs)			\
-	$(FREETYPE_LIBS)			\
-	$(FONTCONFIG_LIBS)			\
-	$(PTHREAD_LIBS)				\
-	$(win32_libs)
-
-libpoppler_la_LDFLAGS = -version-info 46:0:0 @create_shared_lib@ @auto_import_flags@
-
 if ENABLE_XPDF_HEADERS
 
 poppler_includedir = $(includedir)/poppler
@@ -244,7 +198,6 @@ endif
 
 libpoppler_la_SOURCES =		\
 	$(splash_sources)	\
-	$(cairo_sources)	\
 	$(libjpeg_sources)	\
 	$(zlib_sources)		\
 	$(libjpeg2000_sources)	\
@@ -314,6 +267,51 @@ libpoppler_la_SOURCES =		\
 	Sound.cc		\
 	XpdfPluginAPI.cc
 
+libpoppler_la_CPPFLAGS =			\
+	$(cms_includes)				\
+	$(splash_includes)			\
+	$(libjpeg_includes)			\
+	$(libtiff_includes)			\
+	$(libjpeg2000_includes)			\
+	$(libpng_includes)			\
+	$(libcurl_includes)			\
+	$(FREETYPE_CFLAGS)			\
+	$(FONTCONFIG_CFLAGS)			\
+	$(AM_CPPFLAGS)
+
+libpoppler_la_LIBADD =				\
+	$(top_builddir)/goo/libgoo.la		\
+	$(top_builddir)/fofi/libfofi.la		\
+	$(cms_libs)				\
+	$(splash_libs)				\
+	$(libtiff_libs)				\
+	$(libjpeg_libs)				\
+	$(libpng_libs)				\
+	$(zlib_libs)				\
+	$(libcurl_libs)				\
+	$(libjpeg2000_libs)			\
+	$(FREETYPE_LIBS)			\
+	$(FONTCONFIG_LIBS)			\
+	$(PTHREAD_LIBS)				\
+	$(win32_libs)
+
+libpoppler_la_LDFLAGS =				\
+	-version-info 46:0:0			\
+	@create_shared_lib@			\
+	@auto_import_flags@
+
+libpoppler_cairo_la_SOURCES =			\
+	CairoFontEngine.cc			\
+	CairoFontEngine.h			\
+	CairoOutputDev.cc			\
+	CairoOutputDev.h			\
+	CairoRescaleBox.cc			\
+	CairoRescaleBox.h
+
+libpoppler_cairo_la_CPPFLAGS =			\
+	$(CAIRO_CFLAGS)				\
+	$(AM_CPPFLAGS)
+
 EXTRA_DIST = gen-unicode-tables.py	\
              GlobalParamsWin.cc         \
              PageLabelInfo_p.h
diff --git a/qt4/demos/Makefile.am b/qt4/demos/Makefile.am
index 3cadda9..448facd 100644
--- a/qt4/demos/Makefile.am
+++ b/qt4/demos/Makefile.am
@@ -1,25 +1,23 @@
 AM_LDFLAGS = @auto_import_flags@
 
-INCLUDES =					\
-	-I$(top_srcdir)				\
-	-I$(top_srcdir)/poppler			\
-	-I$(top_srcdir)/qt4/src			\
-	$(POPPLER_QT4_CFLAGS)
-
-LDADDS =					\
-	$(top_builddir)/poppler/libpoppler.la	\
-	$(top_builddir)/qt4/src/libpoppler-qt4.la	\
-	$(POPPLER_QT4_LIBS)
-
-SUFFIXES: .moc
-
-# This rule lets GNU make create any *.moc from the equivalent *.h
-.h.moc:
-	$(AM_V_GEN) $(MOCQT4) -i $< -o $@
-
 noinst_PROGRAMS = poppler_qt4viewer
 
+BUILT_SOURCES =					\
+	abstractinfodock.moc			\
+	embeddedfiles.moc			\
+	fonts.moc				\
+	info.moc				\
+	metadata.moc				\
+	navigationtoolbar.moc			\
+	optcontent.moc				\
+	pageview.moc				\
+	permissions.moc				\
+	thumbnails.moc				\
+	toc.moc					\
+	viewer.moc
+
 poppler_qt4viewer_SOURCES =			\
+	$(BUILT_SOURCES)			\
 	abstractinfodock.cpp			\
 	abstractinfodock.h			\
 	documentobserver.cpp			\
@@ -48,20 +46,21 @@ poppler_qt4viewer_SOURCES =			\
 	viewer.cpp				\
 	viewer.h
 
-abstractinfodock.$(OBJEXT): abstractinfodock.moc
-embeddedfiles.$(OBJEXT): embeddedfiles.moc
-fonts.$(OBJEXT): fonts.moc
-info.$(OBJEXT): info.moc
-metadata.$(OBJEXT): metadata.moc
-navigationtoolbar.$(OBJEXT): navigationtoolbar.moc
-optcontent.$(OBJEXT): optcontent.moc
-pageview.$(OBJEXT): pageview.moc
-permissions.$(OBJEXT): permissions.moc
-thumbnails.$(OBJEXT): thumbnails.moc
-toc.$(OBJEXT): toc.moc
-viewer.$(OBJEXT): viewer.moc
+poppler_qt4viewer_CPPFLAGS =			\
+	-I$(top_srcdir)				\
+	-I$(top_srcdir)/poppler			\
+	-I$(top_srcdir)/qt4/src			\
+	$(POPPLER_QT4_CFLAGS)
 
-poppler_qt4viewer_LDADD = $(LDADDS)
+poppler_qt4viewer_LDADD =				\
+	$(top_builddir)/poppler/libpoppler.la		\
+	$(top_builddir)/qt4/src/libpoppler-qt4.la	\
+	$(POPPLER_QT4_LIBS)
+
+# This rule lets GNU make create any *.moc from the equivalent *.h
+.h.moc:
+	$(AM_V_GEN) $(MOCQT4) -i $< -o $@
+SUFFIXES: .moc
 
 clean-generic:
 	rm -f *.moc
diff --git a/qt4/src/Makefile.am b/qt4/src/Makefile.am
index 83a3b98..42859fd 100644
--- a/qt4/src/Makefile.am
+++ b/qt4/src/Makefile.am
@@ -1,14 +1,7 @@
-INCLUDES =					\
-	-I$(top_srcdir)				\
-	-I$(top_srcdir)/poppler			\
-	$(POPPLER_QT4_CFLAGS)			\
-	$(LCMS_CFLAGS)
-
-SUFFIXES: .moc
-
-poppler_includedir = $(includedir)/poppler/qt4
+lib_LTLIBRARIES = libpoppler-qt4.la
 
-poppler_include_HEADERS =			\
+libpoppler_qt4_includedir = $(includedir)/poppler/qt4
+libpoppler_qt4_include_HEADERS =		\
 	poppler-qt4.h				\
 	poppler-link.h				\
 	poppler-annotation.h			\
@@ -18,8 +11,6 @@ poppler_include_HEADERS =			\
 	poppler-media.h				\
 	poppler-page-transition.h
 
-lib_LTLIBRARIES = libpoppler-qt4.la
-
 libpoppler_qt4_la_SOURCES =			\
 	poppler-document.cc			\
 	poppler-page.cc				\
@@ -55,18 +46,28 @@ libpoppler_qt4_la_SOURCES =			\
 	ArthurOutputDev.h			\
 	ArthurOutputDev.cc
 
-libpoppler_qt4_la_CXXFLAGS = 			\
+libpoppler_qt4_la_CPPFLAGS =			\
+	-I$(top_srcdir)				\
+	-I$(top_srcdir)/poppler			\
+	$(POPPLER_QT4_CFLAGS)			\
+	$(LCMS_CFLAGS)
+
+libpoppler_qt4_la_CXXFLAGS =			\
 	-Dpoppler_qt4_EXPORTS
 
-libpoppler_qt4_la_LIBADD = 			\
+libpoppler_qt4_la_LIBADD =			\
 	$(top_builddir)/poppler/libpoppler.la	\
 	$(POPPLER_QT4_LIBS)
 
-libpoppler_qt4_la_LDFLAGS = -version-info 8:0:4 @create_shared_lib@ @auto_import_flags@
+libpoppler_qt4_la_LDFLAGS =			\
+	-version-info 8:0:4			\
+	@create_shared_lib@			\
+	@auto_import_flags@
 
 # This rule lets GNU make create any *.moc from the equivalent *.h
 .h.moc:
 	$(AM_V_GEN) $(MOCQT4) -i $< -o $@
+SUFFIXES: .moc
 
 BUILT_SOURCES = poppler-optcontent.moc
 
diff --git a/qt4/tests/Makefile.am b/qt4/tests/Makefile.am
index 4e4b210..2f5170e 100644
--- a/qt4/tests/Makefile.am
+++ b/qt4/tests/Makefile.am
@@ -1,99 +1,65 @@
 AM_LDFLAGS = @auto_import_flags@
 
-INCLUDES =					\
+AM_CPPFLAGS =					\
 	-I$(top_srcdir)				\
 	-I$(top_srcdir)/poppler			\
 	-I$(top_srcdir)/qt4/src			\
 	-DTESTDATADIR=\"$(TESTDATADIR)\"        \
 	$(POPPLER_QT4_CFLAGS)
 
-LDADDS =					\
-	$(top_builddir)/poppler/libpoppler.la	\
+LDADD =							\
+	$(top_builddir)/poppler/libpoppler.la		\
 	$(top_builddir)/qt4/src/libpoppler-qt4.la	\
 	$(POPPLER_QT4_LIBS)
 
-SUFFIXES: .moc
-
-.cpp.moc:
-	$(AM_V_GEN) $(MOCQT4) -i $< -o $@
-
 noinst_PROGRAMS = test-poppler-qt4 stress-poppler-qt4 \
 	poppler-fonts test-password-qt4 stress-poppler-dir \
 	poppler-attachments poppler-texts poppler-forms \
 	stress-threads-qt4 test-render-to-file
 
-
 test_poppler_qt4_SOURCES =			\
        test-poppler-qt4.cpp
 
-test_poppler_qt4_LDADD = $(LDADDS)
-
-
 test_render_to_file_SOURCES =			\
        test-render-to-file.cpp
 
-test_render_to_file_LDADD = $(LDADDS)
-
-
 test_password_qt4_SOURCES =			\
        test-password-qt4.cpp
 
-test_password_qt4_LDADD = $(LDADDS)
-
-
-poppler_fonts_SOURCES =			\
+poppler_fonts_SOURCES =				\
        poppler-fonts.cpp
 
-poppler_fonts_LDADD = $(LDADDS)
-
 poppler_attachments_SOURCES =			\
        poppler-attachments.cpp
 
-poppler_attachments_LDADD = $(LDADDS)
-
-poppler_texts_SOURCES =			\
+poppler_texts_SOURCES =				\
        poppler-texts.cpp
 
-poppler_texts_LDADD = $(LDADDS)
-
-poppler_forms_SOURCES =			\
+poppler_forms_SOURCES =				\
        poppler-forms.cpp
 
-poppler_forms_LDADD = $(LDADDS)
-
-
 stress_poppler_qt4_SOURCES =			\
        stress-poppler-qt4.cpp
 
-stress_poppler_qt4_LDADD = $(LDADDS)
-
 stress_poppler_dir_SOURCES =			\
        stress-poppler-dir.cpp
 
-stress_poppler_dir_LDADD = $(LDADDS)
-
 stress_threads_qt4_SOURCES =			\
        stress-threads-qt4.cpp
 
-stress_threads_qt4_LDADD = $(LDADDS)
-
-
-clean-generic:
-	rm -f *.moc
-
 if BUILD_POPPLER_QT4
 TESTS = \
 	check_attachments	\
 	check_actualtext	\
-	check_dateConversion 	\
+	check_dateConversion	\
 	check_fonts		\
 	check_links		\
-	check_metadata         	\
+	check_metadata		\
 	check_optcontent	\
-	check_permissions      	\
-	check_pagelabelinfo    	\
-	check_pagemode    	\
-	check_password    	\
+	check_permissions	\
+	check_pagelabelinfo	\
+	check_pagemode		\
+	check_password		\
 	check_pagelayout	\
 	check_search		\
 	check_strings		\
@@ -104,67 +70,72 @@ check_PROGRAMS = $(TESTS)
 
 check_attachments_SOURCES = check_attachments.cpp
 check_attachments.$(OBJEXT): check_attachments.moc
-check_attachments_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_attachments_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_actualtext_SOURCES = check_actualtext.cpp
 check_actualtext.$(OBJEXT): check_actualtext.moc
-check_actualtext_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_actualtext_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_dateConversion_SOURCES = check_dateConversion.cpp
 check_dateConversion.$(OBJEXT): check_dateConversion.moc
-check_dateConversion_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_dateConversion_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_fonts_SOURCES = check_fonts.cpp
 check_fonts.$(OBJEXT): check_fonts.moc
-check_fonts_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_fonts_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_links_SOURCES = check_links.cpp
 check_links.$(OBJEXT): check_links.moc
-check_links_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_links_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_metadata_SOURCES = check_metadata.cpp
 check_metadata.$(OBJEXT): check_metadata.moc
-check_metadata_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_metadata_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_optcontent_SOURCES = check_optcontent.cpp
 check_optcontent.$(OBJEXT): check_optcontent.moc
-check_optcontent_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_optcontent_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_pagemode_SOURCES = check_pagemode.cpp
 check_pagemode.$(OBJEXT): check_pagemode.moc
-check_pagemode_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_pagemode_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_permissions_SOURCES = check_permissions.cpp
 check_permissions.$(OBJEXT): check_permissions.moc
-check_permissions_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_permissions_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_pagelayout_SOURCES = check_pagelayout.cpp
 check_pagelayout.$(OBJEXT): check_pagelayout.moc
-check_pagelayout_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_pagelayout_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_password_SOURCES = check_password.cpp
 check_password.$(OBJEXT): check_password.moc
-check_password_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_password_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_search_SOURCES = check_search.cpp
 check_search.$(OBJEXT): check_search.moc
-check_search_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_search_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_strings_SOURCES = check_strings.cpp
 check_strings.$(OBJEXT): check_strings.moc
-check_strings_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_strings_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_lexer_SOURCES = check_lexer.cpp
 check_lexer.$(OBJEXT): check_lexer.moc
-check_lexer_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_lexer_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_pagelabelinfo_SOURCES = check_pagelabelinfo.cpp
 check_pagelabelinfo.$(OBJEXT): check_pagelabelinfo.moc
-check_pagelabelinfo_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
+check_pagelabelinfo_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 
 check_goostring_SOURCES = check_goostring.cpp
 check_goostring.$(OBJEXT): check_goostring.moc
-check_goostring_LDADD = $(LDADDS) $(POPPLER_QT4_TEST_LIBS)
-
+check_goostring_LDADD = $(LDADD) $(POPPLER_QT4_TEST_LIBS)
 endif
 
+.cpp.moc:
+	$(AM_V_GEN) $(MOCQT4) -i $< -o $@
+SUFFIXES: .moc
+
+clean-generic:
+	rm -f *.moc
diff --git a/qt5/demos/Makefile.am b/qt5/demos/Makefile.am
index 15942f2..9ab2f68 100644
--- a/qt5/demos/Makefile.am
+++ b/qt5/demos/Makefile.am
@@ -1,25 +1,23 @@
 AM_LDFLAGS = @auto_import_flags@
 
-INCLUDES =					\
-	-I$(top_srcdir)				\
-	-I$(top_srcdir)/poppler			\
-	-I$(top_srcdir)/qt5/src			\
-	$(POPPLER_QT5_CFLAGS)
-
-LDADDS =					\
-	$(top_builddir)/poppler/libpoppler.la	\
-	$(top_builddir)/qt5/src/libpoppler-qt5.la	\
-	$(POPPLER_QT5_LIBS)
-
-SUFFIXES: .moc
-
-# This rule lets GNU make create any *.moc from the equivalent *.h
-.h.moc:
-	$(AM_V_GEN) $(MOCQT5) -i $< -o $@
-
 noinst_PROGRAMS = poppler_qt5viewer
 
+BUILT_SOURCES =					\
+	abstractinfodock.moc			\
+	embeddedfiles.moc			\
+	fonts.moc				\
+	info.moc				\
+	metadata.moc				\
+	navigationtoolbar.moc			\
+	optcontent.moc				\
+	pageview.moc				\
+	permissions.moc				\
+	thumbnails.moc				\
+	toc.moc					\
+	viewer.moc
+
 poppler_qt5viewer_SOURCES =			\
+	$(BUILT_SOURCES)			\
 	abstractinfodock.cpp			\
 	abstractinfodock.h			\
 	documentobserver.cpp			\
@@ -48,20 +46,21 @@ poppler_qt5viewer_SOURCES =			\
 	viewer.cpp				\
 	viewer.h
 
-abstractinfodock.$(OBJEXT): abstractinfodock.moc
-embeddedfiles.$(OBJEXT): embeddedfiles.moc
-fonts.$(OBJEXT): fonts.moc
-info.$(OBJEXT): info.moc
-metadata.$(OBJEXT): metadata.moc
-navigationtoolbar.$(OBJEXT): navigationtoolbar.moc
-optcontent.$(OBJEXT): optcontent.moc
-pageview.$(OBJEXT): pageview.moc
-permissions.$(OBJEXT): permissions.moc
-thumbnails.$(OBJEXT): thumbnails.moc
-toc.$(OBJEXT): toc.moc
-viewer.$(OBJEXT): viewer.moc
+poppler_qt5viewer_CPPFLAGS =			\
+	-I$(top_srcdir)				\
+	-I$(top_srcdir)/poppler			\
+	-I$(top_srcdir)/qt5/src			\
+	$(POPPLER_QT5_CFLAGS)
 
-poppler_qt5viewer_LDADD = $(LDADDS)
+poppler_qt5viewer_LDADD =				\
+	$(top_builddir)/poppler/libpoppler.la		\
+	$(top_builddir)/qt5/src/libpoppler-qt5.la	\
+	$(POPPLER_QT5_LIBS)
+
+# This rule lets GNU make create any *.moc from the equivalent *.h
+.h.moc:
+	$(AM_V_GEN) $(MOCQT5) -i $< -o $@
+SUFFIXES: .moc
 
 clean-generic:
 	rm -f *.moc
diff --git a/qt5/src/Makefile.am b/qt5/src/Makefile.am
index 81dba68..245a478 100644
--- a/qt5/src/Makefile.am
+++ b/qt5/src/Makefile.am
@@ -1,13 +1,6 @@
-INCLUDES =					\
-	-I$(top_srcdir)				\
-	-I$(top_srcdir)/poppler			\
-	$(POPPLER_QT5_CFLAGS)			\
-	$(LCMS_CFLAGS)
-
-SUFFIXES: .moc
+lib_LTLIBRARIES = libpoppler-qt5.la
 
 poppler_includedir = $(includedir)/poppler/qt5
-
 poppler_include_HEADERS =			\
 	poppler-qt5.h				\
 	poppler-link.h				\
@@ -18,8 +11,6 @@ poppler_include_HEADERS =			\
 	poppler-media.h				\
 	poppler-page-transition.h
 
-lib_LTLIBRARIES = libpoppler-qt5.la
-
 libpoppler_qt5_la_SOURCES =			\
 	poppler-document.cc			\
 	poppler-page.cc				\
@@ -55,18 +46,28 @@ libpoppler_qt5_la_SOURCES =			\
 	ArthurOutputDev.h			\
 	ArthurOutputDev.cc
 
-libpoppler_qt5_la_CXXFLAGS = 			\
+libpoppler_qt5_la_CPPFLAGS =			\
+	-I$(top_srcdir)				\
+	-I$(top_srcdir)/poppler			\
+	$(POPPLER_QT5_CFLAGS)			\
+	$(LCMS_CFLAGS)
+
+libpoppler_qt5_la_CXXFLAGS =			\
 	-Dpoppler_qt5_EXPORTS -fPIC
 
-libpoppler_qt5_la_LIBADD = 			\
+libpoppler_qt5_la_LIBADD =			\
 	$(top_builddir)/poppler/libpoppler.la	\
 	$(POPPLER_QT5_LIBS)
 
-libpoppler_qt5_la_LDFLAGS = -version-info 2:0:1 @create_shared_lib@ @auto_import_flags@
+libpoppler_qt5_la_LDFLAGS =			\
+	-version-info 2:0:1			\
+	@create_shared_lib@			\
+	@auto_import_flags@
 
 # This rule lets GNU make create any *.moc from the equivalent *.h
 .h.moc:
 	$(AM_V_GEN) $(MOCQT5) -i $< -o $@
+SUFFIXES: .moc
 
 BUILT_SOURCES = poppler-optcontent.moc
 
diff --git a/qt5/tests/Makefile.am b/qt5/tests/Makefile.am
index b3eecef..86cdfca 100644
--- a/qt5/tests/Makefile.am
+++ b/qt5/tests/Makefile.am
@@ -1,98 +1,65 @@
 AM_LDFLAGS = @auto_import_flags@
 
-INCLUDES =					\
+AM_CPPFLAGS =					\
 	-I$(top_srcdir)				\
 	-I$(top_srcdir)/poppler			\
 	-I$(top_srcdir)/qt5/src			\
 	-DTESTDATADIR=\"$(TESTDATADIR)\"        \
 	$(POPPLER_QT5_CFLAGS)
 
-LDADDS =					\
-	$(top_builddir)/poppler/libpoppler.la	\
+LDADD =							\
+	$(top_builddir)/poppler/libpoppler.la		\
 	$(top_builddir)/qt5/src/libpoppler-qt5.la	\
 	$(POPPLER_QT5_LIBS)
 
-SUFFIXES: .moc
-
-.cpp.moc:
-	$(AM_V_GEN) $(MOCQT5) -i $< -o $@
-
 noinst_PROGRAMS = test-poppler-qt5 stress-poppler-qt5 \
 	poppler-fonts test-password-qt5 stress-poppler-dir \
 	poppler-attachments poppler-texts poppler-forms \
 	stress-threads-qt5 test-render-to-file
 
-
 test_poppler_qt5_SOURCES =			\
        test-poppler-qt5.cpp
 
-test_poppler_qt5_LDADD = $(LDADDS)
-
-
 test_render_to_file_SOURCES =			\
        test-render-to-file.cpp
 
-test_render_to_file_LDADD = $(LDADDS)
-
-
 test_password_qt5_SOURCES =			\
        test-password-qt5.cpp
 
-test_password_qt5_LDADD = $(LDADDS)
-
-
-poppler_fonts_SOURCES =			\
+poppler_fonts_SOURCES =				\
        poppler-fonts.cpp
 
-poppler_fonts_LDADD = $(LDADDS)
-
 poppler_attachments_SOURCES =			\
        poppler-attachments.cpp
 
-poppler_attachments_LDADD = $(LDADDS)
-
-poppler_texts_SOURCES =			\
+poppler_texts_SOURCES =				\
        poppler-texts.cpp
 
-poppler_texts_LDADD = $(LDADDS)
-
-poppler_forms_SOURCES =                        \
+poppler_forms_SOURCES =				\
        poppler-forms.cpp
- 
-poppler_forms_LDADD = $(LDADDS)
-
 
 stress_poppler_qt5_SOURCES =			\
        stress-poppler-qt5.cpp
 
-stress_poppler_qt5_LDADD = $(LDADDS)
-
 stress_poppler_dir_SOURCES =			\
        stress-poppler-dir.cpp
 
-stress_poppler_dir_LDADD = $(LDADDS)
-
-stress_threads_qt5_SOURCES =                   \
+stress_threads_qt5_SOURCES =			\
        stress-threads-qt5.cpp
 
-stress_threads_qt5_LDADD = $(LDADDS)
-
-clean-generic:
-	rm -f *.moc
-
 if BUILD_POPPLER_QT5
 TESTS = \
 	check_attachments	\
 	check_actualtext	\
-	check_dateConversion 	\
+	check_dateConversion	\
 	check_fonts		\
 	check_links		\
-	check_metadata         	\
+	check_metadata		\
 	check_optcontent	\
-	check_permissions      	\
-	check_pagelabelinfo    	\
-	check_pagemode    	\
-	check_password    	\
+	check_permissions	\
+	check_pagelabelinfo	\
+	check_pagemode		\
+	check_password		\
 	check_pagelayout	\
 	check_search		\
 	check_strings		\
@@ -103,67 +70,72 @@ check_PROGRAMS = $(TESTS)
 
 check_attachments_SOURCES = check_attachments.cpp
 check_attachments.$(OBJEXT): check_attachments.moc
-check_attachments_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_attachments_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_actualtext_SOURCES = check_actualtext.cpp
 check_actualtext.$(OBJEXT): check_actualtext.moc
-check_actualtext_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_actualtext_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_dateConversion_SOURCES = check_dateConversion.cpp
 check_dateConversion.$(OBJEXT): check_dateConversion.moc
-check_dateConversion_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_dateConversion_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_fonts_SOURCES = check_fonts.cpp
 check_fonts.$(OBJEXT): check_fonts.moc
-check_fonts_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_fonts_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_links_SOURCES = check_links.cpp
 check_links.$(OBJEXT): check_links.moc
-check_links_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_links_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_metadata_SOURCES = check_metadata.cpp
 check_metadata.$(OBJEXT): check_metadata.moc
-check_metadata_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_metadata_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_optcontent_SOURCES = check_optcontent.cpp
 check_optcontent.$(OBJEXT): check_optcontent.moc
-check_optcontent_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_optcontent_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_pagemode_SOURCES = check_pagemode.cpp
 check_pagemode.$(OBJEXT): check_pagemode.moc
-check_pagemode_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_pagemode_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_permissions_SOURCES = check_permissions.cpp
 check_permissions.$(OBJEXT): check_permissions.moc
-check_permissions_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_permissions_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_pagelayout_SOURCES = check_pagelayout.cpp
 check_pagelayout.$(OBJEXT): check_pagelayout.moc
-check_pagelayout_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_pagelayout_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_password_SOURCES = check_password.cpp
 check_password.$(OBJEXT): check_password.moc
-check_password_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_password_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_search_SOURCES = check_search.cpp
 check_search.$(OBJEXT): check_search.moc
-check_search_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_search_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_strings_SOURCES = check_strings.cpp
 check_strings.$(OBJEXT): check_strings.moc
-check_strings_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_strings_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_lexer_SOURCES = check_lexer.cpp
 check_lexer.$(OBJEXT): check_lexer.moc
-check_lexer_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_lexer_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_pagelabelinfo_SOURCES = check_pagelabelinfo.cpp
 check_pagelabelinfo.$(OBJEXT): check_pagelabelinfo.moc
-check_pagelabelinfo_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
+check_pagelabelinfo_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 
 check_goostring_SOURCES = check_goostring.cpp
 check_goostring.$(OBJEXT): check_goostring.moc
-check_goostring_LDADD = $(LDADDS) $(POPPLER_QT5_TEST_LIBS)
-
+check_goostring_LDADD = $(LDADD) $(POPPLER_QT5_TEST_LIBS)
 endif
 
+.cpp.moc:
+	$(AM_V_GEN) $(MOCQT5) -i $< -o $@
+SUFFIXES: .moc
+
+clean-generic:
+	rm -f *.moc
diff --git a/splash/Makefile.am b/splash/Makefile.am
index 4330c53..5c265d6 100644
--- a/splash/Makefile.am
+++ b/splash/Makefile.am
@@ -1,24 +1,3 @@
-INCLUDES =					\
-	-I$(top_srcdir)				\
-	-I$(top_srcdir)/goo			\
-	$(libjpeg_includes)			\
-	$(libtiff_includes)			\
-	$(libpng_includes)			\
-	$(FREETYPE_CFLAGS)
-
-# SplashBitmap includes JpegWriter.h, TiffWriter.h, PNGWriter.h
-if BUILD_LIBJPEG
-libjpeg_includes = $(LIBJPEG_CFLAGS)
-endif
-
-if BUILD_LIBTIFF
-libtiff_includes = $(LIBTIFF_CFLAGS)
-endif
-
-if BUILD_LIBPNG
-libpng_includes = $(LIBPNG_CFLAGS)
-endif
-
 noinst_LTLIBRARIES = libsplash.la
 
 if ENABLE_XPDF_HEADERS
@@ -71,3 +50,24 @@ libsplash_la_SOURCES =				\
 	SplashT1FontFile.cc			\
 	SplashXPath.cc				\
 	SplashXPathScanner.cc
+
+# SplashBitmap includes JpegWriter.h, TiffWriter.h, PNGWriter.h
+if BUILD_LIBJPEG
+libjpeg_includes = $(LIBJPEG_CFLAGS)
+endif
+
+if BUILD_LIBTIFF
+libtiff_includes = $(LIBTIFF_CFLAGS)
+endif
+
+if BUILD_LIBPNG
+libpng_includes = $(LIBPNG_CFLAGS)
+endif
+
+libsplash_la_CPPFLAGS =				\
+	-I$(top_srcdir)				\
+	-I$(top_srcdir)/goo			\
+	$(libjpeg_includes)			\
+	$(libtiff_includes)			\
+	$(libpng_includes)			\
+	$(FREETYPE_CFLAGS)
diff --git a/test/Makefile.am b/test/Makefile.am
index af5bcf2..8d7b923 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -1,76 +1,54 @@
-if BUILD_GTK_TEST
-
-if BUILD_SPLASH_OUTPUT
+AM_LDFLAGS = @auto_import_flags@
 
-splash_includes =				\
-	-I$(top_srcdir)/splash
+AM_CPPFLAGS =					\
+	-I$(top_srcdir)				\
+	-I$(top_srcdir)/poppler
 
-endif
+noinst_PROGRAMS = pdf-fullrewrite
 
+if BUILD_GTK_TEST
+noinst_PROGRAMS += gtk-test
 if BUILD_CAIRO_OUTPUT
-
-pdf_inspector =				\
-	pdf_inspector
-
-cairo_includes =				\
-	$(CAIRO_CFLAGS)				\
-	$(FREETYPE_CFLAGS)
-
+noinst_PROGRAMS += pdf_inspector
 endif
-
-gtk_test = \
-	gtk-test
-
 endif
 
 if BUILD_SPLASH_OUTPUT
-
-perf_test =				\
-	perf-test
-
+noinst_PROGRAMS += perf-test
 endif
 
-pdf_fullrewrite = \
-	pdf-fullrewrite
-
-INCLUDES =					\
-	-I$(top_srcdir)				\
-	-I$(top_srcdir)/poppler			\
-	-I$(top_srcdir)/glib			\
-	-I$(top_builddir)/glib			\
-	$(cairo_includes)			\
-	$(GTK_TEST_CFLAGS)
-
-noinst_PROGRAMS = $(pdf_inspector) $(perf_test) $(pdf_fullrewrite) $(gtk_test)
-
-AM_LDFLAGS = @auto_import_flags@
-
 gtk_test_SOURCES =					\
 	gtk-test.cc
 
+gtk_test_CPPFLAGS =					\
+	$(AM_CPPFLAGS)					\
+	-I$(top_srcdir)/glib				\
+	-I$(top_builddir)/glib				\
+	$(GTK_TEST_CFLAGS)
+
 gtk_test_LDADD =					\
 	$(top_builddir)/poppler/libpoppler.la           \
 	$(top_builddir)/glib/libpoppler-glib.la         \
-	$(CAIRO_LIBS)					\
 	$(GTK_TEST_LIBS)				\
 	$(PTHREAD_LIBS)
 
+pdf_inspector_SOURCES =					\
+	pdf-inspector.cc
 
-pdf_inspector_SOURCES =			\
-       pdf-inspector.cc
+pdf_inspector_CPPFLAGS =				\
+	$(AM_CPPFLAGS)					\
+	$(GTK_TEST_CFLAGS)
 
 pdf_inspector_LDADD =					\
 	$(top_builddir)/poppler/libpoppler-cairo.la	\
 	$(top_builddir)/poppler/libpoppler.la		\
-	$(CAIRO_LIBS)					\
-	$(FREETYPE_LIBS)				\
 	$(GTK_TEST_LIBS)				\
 	$(X_EXTRA_LIBS)					\
 	$(PTHREAD_LIBS)
 
-perf_test_SOURCES =			\
-       perf-test.cc                     \
-       perf-test-preview-dummy.cc
+perf_test_SOURCES =					\
+	perf-test.cc					\
+	perf-test-preview-dummy.cc
 
 perf_test_LDADD =				\
 	$(top_builddir)/poppler/libpoppler.la	\
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 1dd9a12..be6aa6d 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -1,53 +1,16 @@
-if BUILD_SPLASH_OUTPUT
-
-pdftoppm_SOURCES =				\
-	pdftoppm.cc				\
-	$(common)
-
-pdftoppm_binary = pdftoppm
-
-pdftoppm_manpage = pdftoppm.1
-
-endif
+AM_LDFLAGS = @auto_import_flags@
 
-INCLUDES =					\
+AM_CPPFLAGS =					\
 	-I$(top_srcdir)				\
 	-I$(top_srcdir)/goo			\
 	-I$(top_srcdir)/utils			\
 	-I$(top_srcdir)/poppler			\
-	$(UTILS_CFLAGS)				\
-	$(PDFTOCAIRO_CFLAGS)
+	$(UTILS_CFLAGS)
 
 LDADD =						\
 	$(top_builddir)/poppler/libpoppler.la	\
 	$(UTILS_LIBS)
 
-if BUILD_CAIRO_OUTPUT
-
-pdftocairo_SOURCES =				\
-	pdftocairo.cc				\
-	$(common)
-
-if USE_CMS
-PDFTOCAIRO_CFLAGS += $(LCMS_CFLAGS)
-PDFTOCAIRO_LIBS += $(LCMS_LIBS)
-endif
-
-pdftocairo_LDADD =				\
-	$(top_builddir)/poppler/libpoppler-cairo.la \
-	$(LDADD)				\
-	$(PDFTOCAIRO_LIBS)			\
-	$(PTHREAD_LIBS)
-
-
-pdftocairo_binary = pdftocairo
-
-pdftocairo_manpage = pdftocairo.1
-
-endif
-
-AM_LDFLAGS = @auto_import_flags@
-
 bin_PROGRAMS =					\
 	pdfdetach				\
 	pdffonts				\
@@ -57,9 +20,15 @@ bin_PROGRAMS =					\
 	pdftotext				\
 	pdftohtml				\
 	pdfseparate				\
-	pdfunite				\
-	$(pdftoppm_binary)			\
-	$(pdftocairo_binary)
+	pdfunite
+
+if BUILD_SPLASH_OUTPUT
+bin_PROGRAMS += pdftoppm
+endif
+
+if BUILD_CAIRO_OUTPUT
+bin_PROGRAMS += pdftocairo
+endif
 
 dist_man1_MANS =				\
 	pdfdetach.1				\
@@ -70,13 +39,19 @@ dist_man1_MANS =				\
 	pdftotext.1				\
 	pdftohtml.1				\
 	pdfseparate.1				\
-	pdfunite.1				\
-	$(pdftoppm_manpage)			\
-	$(pdftocairo_manpage)
+	pdfunite.1
+
+if BUILD_SPLASH_OUTPUT
+dist_man1_MANS += pdftoppm.1
+endif
+
+if BUILD_CAIRO_OUTPUT
+dist_man1_MANS += pdftocairo.1
+endif
 
 common = parseargs.cc parseargs.h
 
-pdfdetach_SOURCES = 				\
+pdfdetach_SOURCES =				\
 	pdfdetach.cc				\
 	$(common)
 
@@ -122,9 +97,8 @@ pdftohtml_SOURCES =				\
 	$(common)
 
 # HtmlOutputDev uses goo/PNGWriter.h that may depend on libpng header
-pdftohtml_CXXFLAGS = $(AM_CXXFLAGS)
 if BUILD_LIBPNG
-pdftohtml_CXXFLAGS += $(LIBPNG_CFLAGS)
+pdftohtml_CXXFLAGS = $(AM_CXXFLAGS) $(LIBPNG_CFLAGS)
 endif
 
 pdfseparate_SOURCES =				\
@@ -135,6 +109,31 @@ pdfunite_SOURCES =				\
 	pdfunite.cc				\
 	$(common)
 
+pdftoppm_SOURCES =				\
+	pdftoppm.cc				\
+	$(common)
+
+pdftocairo_SOURCES =				\
+	pdftocairo.cc				\
+	$(common)
+
+if BUILD_CAIRO_OUTPUT
+if USE_CMS
+PDFTOCAIRO_CFLAGS += $(LCMS_CFLAGS)
+PDFTOCAIRO_LIBS += $(LCMS_LIBS)
+endif
+endif
+
+pdftocairo_LDADD =					\
+	$(top_builddir)/poppler/libpoppler-cairo.la	\
+	$(LDADD)					\
+	$(PDFTOCAIRO_LIBS)				\
+	$(PTHREAD_LIBS)
+
+pdftocairo_CPPFLAGS =				\
+	$(AM_CPPFLAGS)				\
+	$(PDFTOCAIRO_CFLAGS)
+
 # Yay, automake!  It should be able to figure out that it has to dist
 # pdftoppm.1, but nooo.  So we just add it here.
 


More information about the poppler mailing list