# Makefile for GNU GNATS documentation
# Copyright (C) 2001, 2002 Milan Zamazal
# Copyright (C) 1993, 2001 Free Software Foundation, Inc.
#
# This file is part of GNU GNATS.
#
# GNU GNATS 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 2, or (at your option)
# any later version.
# 
# GNU GNATS 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 GNU GNATS; see the file COPYING.  If not, write to
# the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.


prefix = @prefix@
infodir = @infodir@
srcdir = @srcdir@

INSTALL = $(srcdir)/../install-sh -c
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_INFO = @INSTALL_INFO@

TEXI2DVI = texi2dvi
TEXI2PDF = texi2pdf
TEXIDIR = $(srcdir)/../texinfo
TEXINPUTS = $(srcdir):$(TEXIDIR)
DVIPS = dvips

VERSION = 4.0.1

GNATS_SOURCES = $(srcdir)/gnats.texi $(srcdir)/emacs.texi \
               $(srcdir)/p-admin.texi $(srcdir)/p-inst.texi \
               $(srcdir)/p-usage.texi version.texi

FAQ_SOURCES = $(srcdir)/gnats-faq.texi

.PHONY: all install install-strip install-gnats install-tools uninstall \
        clean distclean mostlyclean maintainer-clean TAGS info dvi dist check

all: info man
all-gnats: all
all-tools: all

install: install-gnats

install-strip:
	$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install

install-gnats: info man
	for i in gnats.info* gnats-faq.info*; do \
		$(INSTALL_DATA) $$i $(infodir)/$$i ; \
	done
	-if [ -x "$(INSTALL_INFO)" ]; then \
		$(INSTALL_INFO) $(infodir)/gnats.info $(infodir)/dir; \
		$(INSTALL_INFO) $(infodir)/gnats-faq.info $(infodir)/dir; \
	fi
	$(MAKE) -C man install-gnats

install-tools: install-gnats

uninstall:
	-if [ -x "$(INSTALL_INFO)" ]; then \
		$(INSTALL_INFO) --delete $(infodir)/gnats.info \
		                $(infodir)/dir; \
		$(INSTALL_INFO) --delete $(infodir)/gnats-faq.info \
		                $(infodir)/dir; \
	fi
	$(MAKE) -C man uninstall

mostlyclean:
	-rm -f *.toc *.log *.vr *.fn *.cp *.tp *.ky *.pg *.i *.s *.aux *.cps
	$(MAKE) -C man mostlyclean

clean: mostlyclean
	-rm -f *.dvi *.ps *.pdf
	$(MAKE) -C man clean

distclean: clean
	-rm -f Makefile config.cache config.status config.log
	-rm -f .\#* \#* *~
	-rm -f *.orig *.rej
	$(MAKE) -C man distclean

maintainer-clean: distclean
	-rm -f *.info*

Makefile: $(srcdir)/Makefile.in config.status
	./config.status

TAGS:

info: gnats.info gnats-faq.info

gnats.info: $(GNATS_SOURCES)
	$(MAKEINFO) -I $(srcdir) -o $@ $<
gnats-faq.info: $(FAQ_SOURCES)
	$(MAKEINFO) -I $(srcdir) -o $@ $<

version.texi: Makefile
	echo "@set VERSION $(VERSION)" > $@-t
	mv $@-t $@

dvi: gnats.dvi gnats-faq.dvi
gnats.dvi: $(GNATS_SOURCES)
	TEXINPUTS=$(TEXINPUTS) $(TEXI2DVI) $<
gnats-faq.dvi: $(FAQ_SOURCES)
	TEXINPUTS=$(TEXINPUTS) $(TEXI2DVI) $<

ps: gnats.ps gnats-faq.ps
gnats.ps: gnats.dvi
	$(DVIPS) -o gnats.ps $<
gnats-faq.ps: gnats-faq.dvi
	$(DVIPS) -o gnats-faq.ps $<

pdf: gnats.pdf gnats-faq.pdf
gnats.pdf: $(GNATS_SOURCES)
	TEXINPUTS=$(TEXINPUTS) $(TEXI2PDF) $<
gnats-faq.pdf: $(FAQ_SOURCES)
	TEXINPUTS=$(TEXINPUTS) $(TEXI2PDF) $<

man:
	$(MAKE) -C man

dist:

check:
