#========================================================================
#
# Xpdf Makefile
#
# Copyright 1996 Derek B. Noonburg
#
#========================================================================

srcdir = @srcdir@
VPATH = @srcdir@

GOOSRCDIR = $(srcdir)/../goo
GOOLIBDIR = ../goo
LTKSRCDIR = $(srcdir)/../ltk
LTKLIBDIR = ../ltk

CXXFLAGS = @CXXFLAGS@ @DEFS@ @OPTIONS@ -I$(GOOSRCDIR) -I$(LTKSRCDIR) -I$(srcdir) @X_CFLAGS@ @Xpm_CFLAGS@

XLIBS = @Xpm_LIBS@ @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@

OTHERLIBS = @LIBS@

CXX = @CXX@
STRIP = @STRIP@

LIBPREFIX = @LIBPREFIX@
EXE = @EXE@

#------------------------------------------------------------------------

.SUFFIXES: .cc

.cc.o:
	$(CXX) $(CXXFLAGS) -c $<

#------------------------------------------------------------------------

CXX_SRC = \
	$(srcdir)/Array.cc \
	$(srcdir)/Catalog.cc \
	$(srcdir)/Dict.cc \
	$(srcdir)/Error.cc \
	$(srcdir)/Gfx.cc \
	$(srcdir)/GfxFont.cc \
	$(srcdir)/GfxState.cc \
	$(srcdir)/ImageOutputDev.cc \
	$(srcdir)/Lexer.cc \
	$(srcdir)/Link.cc \
	$(srcdir)/LTKOutputDev.cc \
	$(srcdir)/Object.cc \
	$(srcdir)/OutputDev.cc \
	$(srcdir)/Page.cc \
	$(srcdir)/Params.cc \
	$(srcdir)/Parser.cc \
	$(srcdir)/PBMOutputDev.cc \
	$(srcdir)/PDFDoc.cc \
	$(srcdir)/PSOutputDev.cc \
	$(srcdir)/Stream.cc \
	$(srcdir)/TextOutputDev.cc \
	$(srcdir)/XOutputDev.cc \
	$(srcdir)/XRef.cc \
	$(srcdir)/xpdf.cc \
	$(srcdir)/pdftops.cc \
	$(srcdir)/pdftotext.cc \
	$(srcdir)/pdfinfo.cc \
	$(srcdir)/pdftopbm.cc \
	$(srcdir)/pdfimages.cc

#------------------------------------------------------------------------

all: apdf$(EXE) pdftops$(EXE) pdftotext$(EXE) pdfinfo$(EXE) \
	pdftopbm$(EXE) pdfimages$(EXE)

#------------------------------------------------------------------------

XPDF_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \
	GfxState.o Lexer.o Link.o LTKOutputDev.o Object.o OutputDev.o \
	Page.o Params.o Parser.o PDFDoc.o PSOutputDev.o Stream.o \
	TextOutputDev.o XOutputDev.o XRef.o xpdf.o
XPDF_LIBS = -L$(LTKLIBDIR) -lLTK -L$(GOOLIBDIR) -lGoo $(XLIBS) $(OTHERLIBS) -lm

xpdf$(EXE): $(XPDF_OBJS)
	$(CXX) $(CXXFLAGS) -o xpdf$(EXE) $(XPDF_OBJS) $(XPDF_LIBS)
	$(STRIP) xpdf$(EXE)

xpdf-ltk.h: xpdf.ltk
	rm -f $@
	$(LTKLIBDIR)/ltkbuild <xpdf.ltk >$@.new
	mv $@.new $@

#------------------------------------------------------------------------

APDF_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \
	GfxState.o Lexer.o Link.o Object.o OutputDev.o \
	Page.o Params.o Parser.o PDFDoc.o PSOutputDev.o Stream.o \
	TextOutputDev.o AOutputDev.o XRef.o apdf.o
APDF_LIBS = -L$(GOOLIBDIR) -lGoo $(XLIBS) $(OTHERLIBS) -lm

Apdf$(EXE): $(APDF_OBJS)
	$(CXX) $(CXXFLAGS) -o apdf$(EXE) $(APDF_OBJS) $(APDF_LIBS)
	$(STRIP) apdf$(EXE)

#------------------------------------------------------------------------

PDFTOPS_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \
	GfxState.o Lexer.o Link.o Object.o OutputDev.o Page.o Params.o \
	Parser.o PDFDoc.o PSOutputDev.o Stream.o XRef.o pdftops.o
PDFTOPS_LIBS = -L$(GOOLIBDIR) -lGoo $(OTHERLIBS) -lm

pdftops$(EXE): $(PDFTOPS_OBJS)
	$(CXX) $(CXXFLAGS) -o pdftops$(EXE) $(PDFTOPS_OBJS) $(PDFTOPS_LIBS)
	$(STRIP) pdftops$(EXE)

#------------------------------------------------------------------------

PDFTOTEXT_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \
	GfxState.o Lexer.o Link.o Object.o OutputDev.o Page.o Params.o \
	Parser.o PDFDoc.o TextOutputDev.o Stream.o XRef.o pdftotext.o
PDFTOTEXT_LIBS = -L$(GOOLIBDIR) -lGoo $(OTHERLIBS) -lm

pdftotext$(EXE): $(PDFTOTEXT_OBJS)
	$(CXX) $(CXXFLAGS) -o pdftotext$(EXE) $(PDFTOTEXT_OBJS) \
		$(PDFTOTEXT_LIBS)
	$(STRIP) pdftotext$(EXE)

#------------------------------------------------------------------------

PDFINFO_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \
	GfxState.o Lexer.o Link.o Object.o OutputDev.o Page.o \
	Params.o Parser.o PDFDoc.o Stream.o XRef.o pdfinfo.o
PDFINFO_LIBS = -L$(GOOLIBDIR) -lGoo $(OTHERLIBS) -lm

pdfinfo$(EXE): $(PDFINFO_OBJS)
	$(CXX) $(CXXFLAGS) -o pdfinfo$(EXE) $(PDFINFO_OBJS) $(PDFINFO_LIBS)
	$(STRIP) pdfinfo$(EXE)

#------------------------------------------------------------------------

PDFTOPBM_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \
	GfxState.o Lexer.o Link.o Object.o OutputDev.o PBMOutputDev.o \
	Page.o Params.o Parser.o PDFDoc.o Stream.o TextOutputDev.o \
	XOutputDev.o XRef.o pdftopbm.o
PDFTOPBM_LIBS = -L$(GOOLIBDIR) -lGoo $(XLIBS) $(OTHERLIBS) -lm

pdftopbm$(EXE): $(PDFTOPBM_OBJS)
	$(CXX) $(CXXFLAGS) -o pdftopbm$(EXE) $(PDFTOPBM_OBJS) $(PDFTOPBM_LIBS)
	$(STRIP) pdftopbm$(EXE)

#------------------------------------------------------------------------

PDFIMAGES_OBJS = Array.o Catalog.o Dict.o Error.o Gfx.o GfxFont.o \
	GfxState.o ImageOutputDev.o Lexer.o Link.o Object.o OutputDev.o \
	Page.o Params.o Parser.o PDFDoc.o Stream.o XRef.o pdfimages.o
PDFIMAGES_LIBS = -L$(GOOLIBDIR) -lGoo $(OTHERLIBS) -lm

pdfimages$(EXE): $(PDFIMAGES_OBJS)
	$(CXX) $(CXXFLAGS) -o pdfimages$(EXE) $(PDFIMAGES_OBJS) \
		$(PDFIMAGES_LIBS)
	$(STRIP) pdfimages$(EXE)

#------------------------------------------------------------------------

clean:
	rm -f $(XPDF_OBJS) xpdf-ltk.h.new xpdf$(EXE)
	rm -f $(APDF_OBJS) apdf$(EXE)
	rm -f $(PDFTOPS_OBJS) pdftops$(EXE)
	rm -f $(PDFTOTEXT_OBJS) pdftotext$(EXE)
	rm -f $(PDFINFO_OBJS) pdfinfo$(EXE)
	rm -f $(PDFTOPBM_OBJS) pdftopbm$(EXE)
	rm -f $(PDFIMAGES_OBJS) pdfimages$(EXE)

#------------------------------------------------------------------------

distdepend:
	cp Makefile.in Makefile.in.bak
	sed '/^#----- dependences -----/q' Makefile.in.bak >Makefile.in
	$(CXX) $(CXXFLAGS) -MM $(CXX_SRC) >>Makefile.in

#----- dependences -----
Array.o: ./Array.cc ../goo/gmem.h Object.h ../goo/gtypes.h \
 ../goo/GString.h Array.h Dict.h Stream.h
Catalog.o: ./Catalog.cc ../goo/gmem.h Object.h ../goo/gtypes.h \
 ../goo/GString.h Array.h Dict.h Stream.h Page.h Error.h config.h \
 Link.h Catalog.h
Dict.o: ./Dict.cc ../goo/gmem.h Object.h ../goo/gtypes.h \
 ../goo/GString.h Array.h Dict.h Stream.h XRef.h
Error.o: ./Error.cc ../goo/gtypes.h Params.h Error.h config.h
Gfx.o: ./Gfx.cc ../goo/gmem.h Object.h ../goo/gtypes.h \
 ../goo/GString.h Array.h Dict.h Stream.h Lexer.h Parser.h GfxFont.h \
 GfxState.h OutputDev.h Params.h Error.h config.h Gfx.h
GfxFont.o: ./GfxFont.cc ../goo/GString.h ../goo/gmem.h ../goo/gfile.h \
 ../goo/gtypes.h config.h Object.h Array.h Dict.h Stream.h Error.h \
 Params.h GfxFont.h FontInfo.h
GfxState.o: ./GfxState.cc ../goo/gmem.h Error.h config.h Object.h \
 ../goo/gtypes.h ../goo/GString.h Array.h Dict.h Stream.h GfxState.h
ImageOutputDev.o: ./ImageOutputDev.cc ../goo/gmem.h config.h Error.h \
 GfxState.h ../goo/gtypes.h Object.h ../goo/GString.h Array.h Dict.h \
 Stream.h ImageOutputDev.h OutputDev.h
Lexer.o: ./Lexer.cc Lexer.h Object.h ../goo/gtypes.h ../goo/gmem.h \
 ../goo/GString.h Array.h Dict.h Stream.h Error.h config.h
Link.o: ./Link.cc ../goo/gmem.h ../goo/GString.h Error.h config.h \
 Object.h ../goo/gtypes.h Array.h Dict.h Stream.h Link.h
LTKOutputDev.o: ./LTKOutputDev.cc ../goo/gmem.h ../goo/GString.h \
 ../ltk/LTKWindow.h ../goo/gtypes.h ../ltk/LTKScrollingCanvas.h \
 ../ltk/LTKWidget.h Object.h Array.h Dict.h Stream.h GfxState.h \
 GfxFont.h Error.h config.h Params.h LTKOutputDev.h XOutputDev.h \
 OutputDev.h
Object.o: ./Object.cc Object.h ../goo/gtypes.h ../goo/gmem.h \
 ../goo/GString.h Array.h Dict.h Stream.h Error.h config.h XRef.h
OutputDev.o: ./OutputDev.cc Object.h ../goo/gtypes.h ../goo/gmem.h \
 ../goo/GString.h Array.h Dict.h Stream.h GfxState.h OutputDev.h
Page.o: ./Page.cc Object.h ../goo/gtypes.h ../goo/gmem.h \
 ../goo/GString.h Array.h Dict.h Stream.h XRef.h OutputDev.h Gfx.h \
 Error.h config.h Params.h Page.h
Params.o: ./Params.cc ../goo/gtypes.h ../goo/gmem.h ../goo/GString.h \
 ../goo/gfile.h Params.h
Parser.o: ./Parser.cc Object.h ../goo/gtypes.h ../goo/gmem.h \
 ../goo/GString.h Array.h Dict.h Stream.h Parser.h Lexer.h Error.h \
 config.h
PBMOutputDev.o: ./PBMOutputDev.cc ../goo/gmem.h ../goo/GString.h \
 Object.h ../goo/gtypes.h Array.h Dict.h Stream.h GfxState.h GfxFont.h \
 Error.h config.h Params.h PBMOutputDev.h XOutputDev.h OutputDev.h
PDFDoc.o: ./PDFDoc.cc ../goo/GString.h config.h Page.h Object.h \
 ../goo/gtypes.h ../goo/gmem.h Array.h Dict.h Stream.h Catalog.h \
 XRef.h Link.h OutputDev.h Params.h Error.h PDFDoc.h
PSOutputDev.o: ./PSOutputDev.cc ../goo/GString.h config.h Object.h \
 ../goo/gtypes.h ../goo/gmem.h Array.h Dict.h Stream.h Error.h \
 GfxState.h GfxFont.h Catalog.h Page.h PSOutputDev.h OutputDev.h
Stream.o: ./Stream.cc ../goo/gmem.h config.h Error.h Object.h \
 ../goo/gtypes.h ../goo/GString.h Array.h Dict.h Stream.h \
 Stream-CCITT.h
TextOutputDev.o: ./TextOutputDev.cc ../goo/GString.h ../goo/gmem.h \
 config.h Error.h GfxState.h ../goo/gtypes.h GfxFont.h Object.h \
 Array.h Dict.h Stream.h TextOutputDev.h OutputDev.h \
 TextOutputFontInfo.h
XOutputDev.o: ./XOutputDev.cc ../goo/gmem.h ../goo/GString.h Object.h \
 ../goo/gtypes.h Array.h Dict.h Stream.h GfxState.h GfxFont.h Error.h \
 config.h Params.h TextOutputDev.h OutputDev.h XOutputDev.h \
 XOutputFontInfo.h
XRef.o: ./XRef.cc ../goo/gmem.h Object.h ../goo/gtypes.h \
 ../goo/GString.h Array.h Dict.h Stream.h Lexer.h Parser.h Error.h \
 config.h XRef.h
xpdf.o: ./xpdf.cc ../goo/gtypes.h ../goo/GString.h ../goo/parseargs.h \
 ../goo/gfile.h ../goo/gmem.h ../ltk/LTKAll.h ../ltk/LTKApp.h \
 ../ltk/LTKWindow.h ../ltk/LTKMenu.h ../ltk/LTKWidget.h \
 ../ltk/LTKCompoundWidget.h ../ltk/LTKBox.h ../ltk/LTKBorder.h \
 ../ltk/LTKButtonDialog.h ../ltk/LTKButton.h ../ltk/LTKCanvas.h \
 ../ltk/LTKDblBufCanvas.h ../ltk/LTKEmpty.h ../ltk/LTKFileReq.h \
 ../ltk/LTKLabel.h ../ltk/LTKList.h ../ltk/LTKScrollbar.h \
 ../ltk/LTKScrollingCanvas.h ../ltk/LTKTextIn.h ../ltk/LTKResources.h \
 Object.h Array.h Dict.h Stream.h XRef.h Catalog.h Page.h Link.h \
 PDFDoc.h XOutputDev.h config.h OutputDev.h LTKOutputDev.h \
 PSOutputDev.h TextOutputDev.h Params.h Error.h xpdfIcon.xpm \
 leftArrow.xbm dblLeftArrow.xbm rightArrow.xbm dblRightArrow.xbm \
 zoomIn.xbm zoomOut.xbm find.xbm postscript.xbm about.xbm xpdf-ltk.h
pdftops.o: ./pdftops.cc ../goo/parseargs.h ../goo/gtypes.h \
 ../goo/GString.h ../goo/gmem.h Object.h Array.h Dict.h Stream.h \
 XRef.h Catalog.h Page.h PDFDoc.h Link.h PSOutputDev.h config.h \
 OutputDev.h Params.h Error.h
pdftotext.o: ./pdftotext.cc ../goo/parseargs.h ../goo/gtypes.h \
 ../goo/GString.h ../goo/gmem.h Object.h Array.h Dict.h Stream.h \
 XRef.h Catalog.h Page.h PDFDoc.h Link.h TextOutputDev.h OutputDev.h \
 Params.h Error.h config.h
pdfinfo.o: ./pdfinfo.cc ../goo/parseargs.h ../goo/gtypes.h \
 ../goo/GString.h ../goo/gmem.h Object.h Array.h Dict.h Stream.h \
 XRef.h Catalog.h Page.h PDFDoc.h Link.h Params.h Error.h config.h
pdftopbm.o: ./pdftopbm.cc ../goo/parseargs.h ../goo/gtypes.h \
 ../goo/GString.h ../goo/gmem.h Object.h Array.h Dict.h Stream.h \
 XRef.h Catalog.h Page.h PDFDoc.h Link.h PBMOutputDev.h config.h \
 XOutputDev.h OutputDev.h Params.h Error.h
pdfimages.o: ./pdfimages.cc ../goo/parseargs.h ../goo/gtypes.h \
 ../goo/GString.h ../goo/gmem.h Object.h Array.h Dict.h Stream.h \
 XRef.h Catalog.h Page.h PDFDoc.h Link.h ImageOutputDev.h OutputDev.h \
 Params.h Error.h config.h
AOutputDev.o: ./AOutputDev.cc ../goo/gmem.h ../goo/GString.h Object.h \
 ../goo/gtypes.h Array.h Dict.h Stream.h GfxState.h GfxFont.h Error.h \
 config.h Params.h TextOutputDev.h OutputDev.h AOutputDev.h \
 XOutputFontInfo.h
apdf.o: ./apdf.cc ../goo/gtypes.h ../goo/GString.h ../goo/parseargs.h \
 ../goo/gfile.h ../goo/gmem.h \
 Object.h Array.h Dict.h Stream.h XRef.h Catalog.h Page.h Link.h \
 PDFDoc.h AOutputDev.h config.h OutputDev.h \
 PSOutputDev.h TextOutputDev.h Params.h Error.h

