# Info Makefile for GNU Smalltalk
# Copyright 1990, 91, 92, 94, 95, 99 Free Software Foundation, Inc.
# Written by Steve Byrne

# This program 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.

# This program 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 this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.

# $Revision: 1.6.2$

include ../Makefile.defs

.PHONY : mostlyclean clean distclean maintainer-clean all info dvi

TEXI2DVI = texi2dvi

INFO=gst.info
DVI=gst.dvi
SOURCES = gst.txi gpl.txi classes.txi toc.txi tutorial.txi

info: $(INFO)

dvi: $(DVI)

all: info dvi

# MAKEINFO won't fail -- they pass a `:' to us if it's absent
$(INFO): $(SOURCES)
	$(MAKEINFO) $(srcdir)/docs/$<

# It is ok for this to fail because the program isn't present.
$(DVI): $(SOURCES) texinfo.tex
	-$(TEXI2DVI) $(srcdir)/docs/$<

classes.txi:
	cd $(srcdir);							\
	echo TexinfoClassPublisher publishAllDocs! |			\
	  ./gst examples/Publish.st - -qg

# Cleaning targets
mostlyclean:
	$(RM) -f $(DVI)

clean: mostlyclean

distclean: clean
	$(RM) -f classes.txi

maintainer-clean:
	@echo 'This command is intended for maintainers to use; it'
	@echo 'deletes files that may need special tools to rebuild.'
	$(MAKE) do-maintainer-clean

do-maintainer-clean: distclean
	$(RM) -f $(INFO)*

# Install targets
install: all
	$(INSTALL_DATA) gst.1 $(mandir)/man1/gst.1
	cd $(srcdir); for file in $(INFO)*; do				\
	  $(INSTALL_DATA) $$file $(infodir);				\
	done
	cd $(srcdir); for file in $(INFO); do				\
	  $(INSTALL_INFO) --dir-file=$(infodir)/dir $(infodir)/$$file	\
	done

uninstall:
	$(RM) $(mandir)/man1/gst.1
	cd $(srcdir); for file in $(INFO)*; do				\
	  rm -f $(infodir)/$$file; 					\
	done
