#=======================================================================
# 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.
#=======================================================================
# cd WORKING_DIRECTORY ; make ACTION
#=======================================================================

#-----------------------------------------------------------------------
# Macro
#-----------------------------------------------------------------------

# file name prefix.
DOC_PREFIX=example

#-----------------------------------------------------------------------
# Notice that "text" generates an HTML file with the same name
# for the first HTML page. This is why it is before the standard
# HTML typesetting.
#
all:	\
clean 	\
text	\
html	\
ps	\
longps	\
extralongps	\
largeps	\
extralargeps	\
pdf

#-----------------------------------------------------------------------
clean:
	@echo "Cleaning..."				; \
	find . -name core    -exec rm -f \{\} \;	; \
	rm -f $(DOC_PREFIX)*.tex			; \
	rm -f $(DOC_PREFIX)*.dvi			; \
	rm -f $(DOC_PREFIX)*.sp				; \
	rm -f $(DOC_PREFIX)*.sp2			; \
	rm -f $(DOC_PREFIX)*.ps				; \
	rm -f $(DOC_PREFIX)*.pdf			; \
	rm -f $(DOC_PREFIX)*.txt			; \
	rm -f $(DOC_PREFIX)*.log			; \
	rm -f $(DOC_PREFIX)*.aux			; \
	rm -f $(DOC_PREFIX)*.tmp			; \
	rm -f $(DOC_PREFIX)*.tchk			; \
	rm -f $(DOC_PREFIX)*.tdiag			; \
	rm -f $(DOC_PREFIX)*.diag			; \
	rm -f $(DOC_PREFIX)*.pageloc			; \
	rm -f $(DOC_PREFIX)*.pageref			; \
	rm -f $(DOC_PREFIX)*.debug			; \
	rm -f $(DOC_PREFIX)*.out			; \
	rm -f alml.diag					; \
	rm -f .diag					; \
	rm -f .log					; \
	rm -f *.html					; \
	rm -f *.bak					; \
	rm -f *.jpg					; \
	rm -f *.midi					; \
	rm -f *.ps					; \
	rm -f *\~

#-----------------------------------------------------------------------
check:
	@alml --sgml-check				\
	      --verbose                        		\
	      $(DOC_PREFIX).sgml

#-----------------------------------------------------------------------
dvi:
	@alml --dvi				\
	      --verbose                         \
	      $(DOC_PREFIX).sgml

#-----------------------------------------------------------------------
ps:
	@alml --ps				\
	      --verbose                         \
	      $(DOC_PREFIX).sgml

#-----------------------------------------------------------------------
longps:
	@alml --ps				\
	      --verbose                         \
	      --compact				\
	      --long				\
	      --page-numbering=plain		\
	      $(DOC_PREFIX).sgml

#-----------------------------------------------------------------------
extralongps:
	@alml --ps				\
	      --verbose                         \
	      --compact				\
	      --extralong			\
	      --page-numbering=plain		\
	      $(DOC_PREFIX).sgml

#-----------------------------------------------------------------------
largeps:
	@alml --ps				\
	      --verbose                         \
	      --compact				\
	      --large				\
	      --page-numbering=plain		\
	      $(DOC_PREFIX).sgml

#-----------------------------------------------------------------------
extralargeps:
	@alml --ps				\
	      --verbose                         \
	      --compact				\
	      --extralarge			\
	      --page-numbering=plain		\
	      $(DOC_PREFIX).sgml

#-----------------------------------------------------------------------
pdf:
	@alml --pdf				\
	      --verbose                         \
	      --page-numbering=plain		\
	      $(DOC_PREFIX).sgml

#-----------------------------------------------------------------------
html:
	@alml --html				\
	      --verbose       			\
	      $(DOC_PREFIX).sgml

#-----------------------------------------------------------------------
text:
	@alml --html-text			\
	      --verbose                         \
	      $(DOC_PREFIX).sgml		; \
	lynx -dump				\
	     -nolist				\
	     -dont_wrap_pre			\
	     $(DOC_PREFIX).html			\
	      > $(DOC_PREFIX).txt

