## Proxy Makefile.am to build poppler for TeX Live.
##
##   Copyright (C) 2011-2013 Peter Breitenlohner <tex-live@tug.org>
##
##   This file is free software; the copyright holder
##   gives unlimited permission to copy and/or distribute it,
##   with or without modifications, as long as this notice is preserved.
##
ACLOCAL_AMFLAGS = -I ../../m4

# Rebuild
.PHONY: rebuild
rebuild: all

## We want to re-distribute the whole original poppler source tree.
##
EXTRA_DIST = $(POPPLER_TREE)

## Patches applied to the original source tree
##
EXTRA_DIST += $(POPPLER_TREE)-PATCHES

# in case of an SVN repository
dist-hook:
	rm -rf `find $(distdir) -name .svn -o -name .deps -o -name .dirstamp -o -name '*.$(OBJEXT)'`

SUBDIRS = goo fofi poppler

GOO_SRC = $(top_srcdir)/$(POPPLER_TREE)/goo
FOFI_SRC = $(top_srcdir)/$(POPPLER_TREE)/fofi
POPPLER_SRC = $(top_srcdir)/$(POPPLER_TREE)/poppler

AM_CPPFLAGS = -Igoo -Ifofi -Ipoppler -I$(GOO_SRC) -I$(FOFI_SRC) -I$(POPPLER_SRC) $(ZLIB_INCLUDES)
AM_CPPFLAGS += -DPOPPLER_DATADIR='"."'
AM_CFLAGS = $(WARNING_CFLAGS)
AM_CXXFLAGS = $(NO_WARN_CXXFLAGS)

noinst_LIBRARIES = libpoppler.a

nodist_libpoppler_a_SOURCES = \
	$(goo_libGoo_a_sources) \
	$(fofi_libfofi_a_sources) \
	$(poppler_libpoppler_a_sources)

goo_libGoo_a_sources = \
	@POPPLER_TREE@/goo/FixedPoint.cc \
	@POPPLER_TREE@/goo/gfile.cc \
	@POPPLER_TREE@/goo/gmem.cc \
	@POPPLER_TREE@/goo/gmempp.cc \
	@POPPLER_TREE@/goo/GooHash.cc \
	@POPPLER_TREE@/goo/GooList.cc \
	@POPPLER_TREE@/goo/GooString.cc \
	@POPPLER_TREE@/goo/GooTimer.cc \
	@POPPLER_TREE@/goo/grandom.cc \
	@POPPLER_TREE@/goo/gstrtod.cc

fofi_libfofi_a_sources = \
	@POPPLER_TREE@/fofi/FoFiBase.cc \
	@POPPLER_TREE@/fofi/FoFiEncodings.cc \
	@POPPLER_TREE@/fofi/FoFiIdentifier.cc \
	@POPPLER_TREE@/fofi/FoFiTrueType.cc \
	@POPPLER_TREE@/fofi/FoFiType1.cc \
	@POPPLER_TREE@/fofi/FoFiType1C.cc

poppler_libpoppler_a_sources = \
	@POPPLER_TREE@/poppler/Annot.cc \
	@POPPLER_TREE@/poppler/Array.cc \
	@POPPLER_TREE@/poppler/BuiltinFont.cc \
	@POPPLER_TREE@/poppler/BuiltinFontTables.cc \
	@POPPLER_TREE@/poppler/CMap.cc \
	@POPPLER_TREE@/poppler/CachedFile.cc \
	@POPPLER_TREE@/poppler/Catalog.cc \
	@POPPLER_TREE@/poppler/CharCodeToUnicode.cc \
	@POPPLER_TREE@/poppler/DateInfo.cc \
	@POPPLER_TREE@/poppler/Decrypt.cc \
	@POPPLER_TREE@/poppler/Dict.cc \
	@POPPLER_TREE@/poppler/Error.cc \
	@POPPLER_TREE@/poppler/FileSpec.cc \
	@POPPLER_TREE@/poppler/FlateStream.cc \
	@POPPLER_TREE@/poppler/FontEncodingTables.cc \
	@POPPLER_TREE@/poppler/FontInfo.cc \
	@POPPLER_TREE@/poppler/Form.cc \
	@POPPLER_TREE@/poppler/Function.cc \
	@POPPLER_TREE@/poppler/Gfx.cc \
	@POPPLER_TREE@/poppler/GfxFont.cc \
	@POPPLER_TREE@/poppler/GfxState.cc \
	@POPPLER_TREE@/poppler/GlobalParams.cc \
	@POPPLER_TREE@/poppler/Hints.cc \
	@POPPLER_TREE@/poppler/JArithmeticDecoder.cc \
	@POPPLER_TREE@/poppler/JBIG2Stream.cc \
	@POPPLER_TREE@/poppler/JPXStream.cc \
	@POPPLER_TREE@/poppler/Linearization.cc \
	@POPPLER_TREE@/poppler/Lexer.cc \
	@POPPLER_TREE@/poppler/Link.cc \
	@POPPLER_TREE@/poppler/Movie.cc \
	@POPPLER_TREE@/poppler/NameToCharCode.cc \
	@POPPLER_TREE@/poppler/Object.cc \
	@POPPLER_TREE@/poppler/OptionalContent.cc \
	@POPPLER_TREE@/poppler/Outline.cc \
	@POPPLER_TREE@/poppler/OutputDev.cc \
	@POPPLER_TREE@/poppler/PDFDoc.cc \
	@POPPLER_TREE@/poppler/PDFDocEncoding.cc \
	@POPPLER_TREE@/poppler/PSTokenizer.cc \
	@POPPLER_TREE@/poppler/Page.cc \
	@POPPLER_TREE@/poppler/PageLabelInfo.cc \
	@POPPLER_TREE@/poppler/PageTransition.cc \
	@POPPLER_TREE@/poppler/Parser.cc \
	@POPPLER_TREE@/poppler/PopplerCache.cc \
	@POPPLER_TREE@/poppler/PreScanOutputDev.cc \
	@POPPLER_TREE@/poppler/ProfileData.cc \
	@POPPLER_TREE@/poppler/Rendition.cc \
	@POPPLER_TREE@/poppler/SecurityHandler.cc \
	@POPPLER_TREE@/poppler/Sound.cc \
	@POPPLER_TREE@/poppler/Stream.cc \
	@POPPLER_TREE@/poppler/strtok_r.cpp \
	@POPPLER_TREE@/poppler/UnicodeMap.cc \
	@POPPLER_TREE@/poppler/UnicodeTypeTable.cc \
	@POPPLER_TREE@/poppler/UTF.cc \
	@POPPLER_TREE@/poppler/ViewerPreferences.cc \
	@POPPLER_TREE@/poppler/XRef.cc \
	@POPPLER_TREE@/poppler/XpdfPluginAPI.cc

$(libpoppler_a_OBJECTS): config.force

config.force: $(ZLIB_DEPEND)
	echo timestamp >config.force
	$(SHELL) ./config.status --recheck

DISTCLEANFILES = config.force

## Rebuild zlib
@ZLIB_RULE@

