#=======================================================================
# Copyright (C) 2000, 2003 Daniele Giacomini daniele@swlibero.org
#
# 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 of the License, 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.
#=======================================================================

#-----------------------------------------------------------------------
# Program name.
#-----------------------------------------------------------------------
PROJECT=sgmltexi

#-----------------------------------------------------------------------
# Do all compositions.
#-----------------------------------------------------------------------
all: \
ps \
text \
html \
info \
pdf

#-----------------------------------------------------------------------
# Delete stale files.
#-----------------------------------------------------------------------
clean:
	@echo "Cleaning stale files."			; \
	rm -f $(PROJECT).aux				; \
	rm -f $(PROJECT).cp				; \
	rm -f $(PROJECT).cps				; \
	rm -f $(PROJECT).sg				; \
	rm -f $(PROJECT).sgs				; \
	rm -f $(PROJECT).fl				; \
	rm -f $(PROJECT).fls				; \
	rm -f $(PROJECT).fn				; \
	rm -f $(PROJECT).fns				; \
	rm -f $(PROJECT).ky				; \
	rm -f $(PROJECT).kys				; \
	rm -f $(PROJECT).log				; \
	rm -f $(PROJECT).pg				; \
	rm -f $(PROJECT).pgs				; \
	rm -f $(PROJECT).toc				; \
	rm -f $(PROJECT).tp				; \
	rm -f $(PROJECT).tps				; \
	rm -f $(PROJECT).vr				; \
	rm -f $(PROJECT).vrs				; \
	rm -f $(PROJECT).diag				; \
	rm -f $(PROJECT).orig				; \
	rm -f $(PROJECT).orig?				; \
	rm -f $(PROJECT).texinfo.bak			; \
	rm -f $(PROJECT)*.bak

#-----------------------------------------------------------------------
# Delete stale files.
#-----------------------------------------------------------------------
cleanall: clean
	@echo "Cleaning non-vital files."			; \
	rm -f $(PROJECT).ps				; \
	rm -f $(PROJECT).pdf				; \
	rm -f $(PROJECT).html				; \
	rm -f $(PROJECT).info				; \
	rm -f $(PROJECT).info.gz			; \
	rm -f $(PROJECT).info-*				; \
	rm -f $(PROJECT).tex				; \
	rm -f $(PROJECT).texinfo			; \
	rm -f $(PROJECT).txt				; \
	rm -f $(PROJECT).dvi				; \
	rm -f $(PROJECT).xml				; \
	rm -rf $(PROJECT)				; \

#-----------------------------------------------------------------------
# Check spelling.
#-----------------------------------------------------------------------
spell:
	@sgmltexi --text --force $(PROJECT).sgml	; \
	ispell $(PROJECT).txt				; \
	ispell $(PROJECT).1				; \
	ispell Makefile

#-----------------------------------------------------------------------
# Check SGML syntax.
#-----------------------------------------------------------------------
check:
	@sgmltexi --sgml-check $(PROJECT).sgml

#-----------------------------------------------------------------------
# Compose as PostScript.
#-----------------------------------------------------------------------
ps:
	@sgmltexi --ps $(PROJECT).sgml

#-----------------------------------------------------------------------
# Compose as PDF.
#-----------------------------------------------------------------------
pdf:
	@sgmltexi --pdf $(PROJECT).sgml

#-----------------------------------------------------------------------
# Compose as Info.
#-----------------------------------------------------------------------
info:
	@sgmltexi --info --force $(PROJECT).sgml

#-----------------------------------------------------------------------
# Compose as text.
#-----------------------------------------------------------------------
txt: text
text:
	@sgmltexi --text --force $(PROJECT).sgml

#-----------------------------------------------------------------------
# Compose as HTML.
#-----------------------------------------------------------------------
html:
	@sgmltexi --html --force $(PROJECT).sgml


#-----------------------------------------------------------------------
# Test.
#-----------------------------------------------------------------------
test:
	@sgmltexi --docbook --force $(PROJECT).sgml
