# Info Makefile for GNU Smalltalk
# Copyright 1988-92, 1994-95, 1999, 2000 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.7.5$

include ../Makefile.defs
include ../Makefile.body

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

INFO=gst.info
DVI=gst.dvi
TEXI2DVI=$(srcdir)/docs/texi2dvi

# The SOURCES variable uses stamp-classes, and we enforce that
# classes.txi is there only if the target needs to be remade -- else,
# we can avoid building classes.txi which is a pretty long task.
SOURCES = gst.txi toc.txi tutorial.txi stamp-classes

info: $(INFO)

dvi: $(DVI)

all: info dvi

# MAKEINFO won't fail -- we use the `missing' script if it's absent
$(INFO): $(SOURCES)
	$(MAKE) classes.txi
	cd $(srcdir)/docs; $(MAKEINFO) $<

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

# Using a timestamp file allows me to avoid distributing classes.txi
classes.txi: $(KERNEL_FILES)
	cd ..;								\
	echo ClassPublisher Texinfo publishAllDocs! |			\
	  ./gst examples/Publish.st - -qg
	echo timestamp>stamp-classes

stamp-classes: $(KERNEL_FILES)
	$(MAKE) classes.txi

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

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

# 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)*

# Tell versions [3.59, 3.63) of GNU make not to export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
