# Makefile for octave's doc/faq directory
#
# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
#               2006, 2007 John W. Eaton
#
# This file is part of Octave.
# 
# Octave is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 3 of the License, or (at
# your option) any later version.
# 
# Octave is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
# for more details.
# 
# You should have received a copy of the GNU General Public License
# along with Octave; see the file COPYING.  If not, see
# <http://www.gnu.org/licenses/>.

TOPDIR = ../..

srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@

include $(TOPDIR)/Makeconf

INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@

SOURCES =

TEXINFO := Octave-FAQ.texi

FORMATTED := Octave-FAQ.info Octave-FAQ.dvi Octave-FAQ.ps Octave-FAQ.pdf

DISTFILES := $(addprefix $(srcdir)/, Makefile.in $(TEXINFO) $(FORMATTED))

SPELL := $(patsubst %.texi, %.spell, $(ALL_TEXINFO))

%.spell : %.texi
	rm -f $@
	$(SED) -e 's/@@/ at /g' -e 's/@[a-zA-Z]*//g' $< | spell > $@.tmp
	mv $@.tmp $@

all: Octave-FAQ.info Octave-FAQ.dvi Octave-FAQ.ps Octave-FAQ.pdf Octave-FAQ.html
.PHONY: all

Octave-FAQ.info: $(TEXINFO)
	-$(MAKEINFO) -I.. -I$(srcdir) -I$(srcdir)/.. $<

Octave-FAQ.dvi: $(TEXINFO)
	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" \
	  $(UNSETCOMSPEC) $(TEXI2DVI) $<

Octave-FAQ.ps: Octave-FAQ.dvi
	-dvips -o $@ $<

Octave-FAQ.pdf: $(TEXINFO)
	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" \
	  $(UNSETCOMSPEC) $(TEXI2PDF) $<

Octave-FAQ.html: $(TEXINFO)
	-$(MAKEINFO) --html --ifinfo --no-split --output=$@ -I.. -I$(srcdir) -I$(srcdir)/.. $<

check install install-strip uninstall:
.PHONY: check install install-strip uninstall

tags: $(SOURCES)
	ctags $(SOURCES)

TAGS: $(SOURCES)
	etags $(SOURCES)

spell: $(SPELL)
.PHONY: spell

mostlyclean clean:
	rm -f Octave-FAQ.cp Octave-FAQ.fn Octave-FAQ.ky Octave-FAQ.pg \
	Octave-FAQ.tp Octave-FAQ.vr Octave-FAQ.cps Octave-FAQ.fns \
	Octave-FAQ.kys Octave-FAQ.pgs Octave-FAQ.tps Octave-FAQ.vrs \
	Octave-FAQ.aux	Octave-FAQ.log Octave-FAQ.toc
.PHONY: mostlyclean clean

distclean: clean
	rm -f Makefile
.PHONY: distclean

maintainer-clean: distclean
	rm -f tags TAGS Octave-FAQ.info Octave-FAQ.info-*
	rm -f Octave-FAQ.dvi Octave-FAQ.ps Octave-FAQ.pdf
	rm -f Octave-FAQ.html
.PHONY: maintainer-clean

dist: all
	ln $(DISTFILES) ../../`cat ../../.fname`/doc/faq
.PHONY: dist
