From 4586d01428cad472b2fbf050cd7cc00cd5d8b0a1 Mon Sep 17 00:00:00 2001
From: simonm <unknown>
Date: Fri, 30 Jan 1998 17:07:46 +0000
Subject: [PATCH] [project @ 1998-01-30 17:07:42 by simonm] Remove old literate
 documentation support, and add support for multi-file SGML documents.

---
 mk/paths.mk  |  27 --------
 mk/suffix.mk | 191 ++-------------------------------------------------
 mk/target.mk |  90 ++++++++----------------
 3 files changed, 31 insertions(+), 277 deletions(-)

diff --git a/mk/paths.mk b/mk/paths.mk
index 3a958616b331..355a64df73b8 100644
--- a/mk/paths.mk
+++ b/mk/paths.mk
@@ -169,33 +169,6 @@ MOSTLY_CLEAN_FILES += \
  tags TAGS *.ind *.ilg *.idx *.idx-prev *.aux *.aux-prev *.dvi *.log \
  *.toc *.lot *.lof *.blg *.info *.itxi *.itex *.ihtml *.cb
 
-#------------------------------------------------------------------
-# Documentation setup.
-#
-# Documentation is not normally produced via the default target, but
-# selectively through a set of standard targets (e.g, dvi, html, etc., see
-# target.mk). Here we define the variables (and their default settings),
-# that control the operation of these standard targets.
-#
-# Documentation variables:
-#
-#  DOC_SRCS  = list of documents you want to generate various
-#              forms of documentation from.
-#  DOC_DVI   = list of DVI files to generate.
-#  DOC_HTML  = list of HTML files to generate
-#  DOC_TEXI  = list of TexInfo files to generate
-#  DOC_INFO  = list of Emacs Info files to generate
-#  DOC_TEXT  = list of simple text files to generate
-# 
-DOC_SRCS=$(wildcard    *.tex *.lit)
-DOC_DVI =$(addsuffix  .dvi,$(basename $(DOC_SRCS)))
-DOC_PS  =$(addsuffix   .ps,$(basename $(DOC_SRCS)))
-DOC_TEXI=$(addsuffix .texi,$(basename $(DOC_SRCS)))
-DOC_INFO=$(addsuffix .info,$(basename $(DOC_SRCS)))
-DOC_HTML=$(addsuffix .html,$(basename $(DOC_SRCS)))
-DOC_TEXT=$(addsuffix .txt,$(basename $(DOC_SRCS)))
-CLEAN_FILES += $(DOC_TEXT) $(DOC_HTML) $(DOC_TEXI) $(DOC_PS) $(DOC_DVI)
-
 #------------------------------------------------------------------
 #
 # Distribution setup
diff --git a/mk/suffix.mk b/mk/suffix.mk
index 8fc22b77af52..12ad26c37f05 100644
--- a/mk/suffix.mk
+++ b/mk/suffix.mk
@@ -188,11 +188,9 @@ SRC_HC_PRE  += $(HC_PRE__)
 #-----------------------------------------------------------------------------
 # SGML suffix rules
 #
-# make sure these don't conflict with the literate rules!
-
 %.sgml : %.vsgml
 	@$(RM) $@
-	expand $*.vsgml | $(SGMLVERB) > $@
+	expand $< | $(SGMLVERB) > $@
 
 %.tex : %.sgml
 	@$(RM) $@
@@ -202,10 +200,9 @@ SRC_HC_PRE  += $(HC_PRE__)
 	@$(RM) $@
 	$(SGML2LATEX) -m --output=dvi $<
 
-# Not yet: we already have a %.ps : %.dvi rule, this one would conflict.
-#%,ps : %.sgml
-#	@$(RM) $@
-#	$(SGML2LATEX) -m --output=ps $<
+%,ps : %.sgml
+	@$(RM) $@
+	$(SGML2LATEX) -m --output=ps $<
 
 %.html : %.sgml
 	@$(RM) $@
@@ -222,197 +219,17 @@ SRC_HC_PRE  += $(HC_PRE__)
 #-----------------------------------------------------------------------------
 # Literate suffix rules
 
-# ToDo: somehow macroize this lot. (if only!)
-
-%.itxi : %.lit
-	@$(RM) $@
-	$(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.txt : %.lit
-	@$(RM) $@
-	$(LIT2TEXT) $(LIT2TEXT_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.ihtml : %.lit
-	@$(RM) $@
-	$(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.itex : %.lit
-	@$(RM) $@
-	$(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
-	@chmod 444 $@
-
-#
-# Produce stand-alone TEX documents
-#
-%.tex : %.itex
-	@$(RM) $@
-	$(LIT2LATEX) -S $(LIT2LATEX_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.tex : %.lhs
-	@$(RM) $@
-	$(LIT2LATEX) -S $(LIT2LATEX_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.texi : %.lhs
-	@$(RM) $@
-	$(LIT2TEXI) -S $(LIT2TEXI_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.html : %.lhs
-	@$(RM) $@ 
-	$(LIT2TEXI) $(LIT2TEXI_OPTS) -o $(patsubst %.html,%.texi,$@) $<
-	$(TEXI2HTML) $(TEXI2HTML_OPTS) $(patsubst %.lhs,%.texi,$<) 
-	@touch $@
-
-%.info:: %.texi
-	@$(RM) $@
-	$(MAKEINFO) $(MAKEINFO_OPTS) $< && $(POSTMAKEINFO) $@
-
-%.hs : %.lhs
-	@$(RM) $@
-	$(LIT2PGM) $(LIT2PGM_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.itxi : %.lhs
-	@$(RM) $@
-	$(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.ihtml : %.lhs
-	@$(RM) $@
-	$(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.itex : %.lhs
-	@$(RM) $@
-	$(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.tex : %.lhs
-	$(LIT2LATEX) -S -c $(LIT2LATEX_OPTS) -o $@ $<
-	$(HC) $(HC_OPTS) -c $< -o $@
-
-
-%.itxi : %.lhc
-	@$(RM) $@
-	$(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.ihtml : %.lhc
-	@$(RM) $@
-	$(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.itex : %.lhc
-	@$(RM) $@
-	$(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
-	@chmod 444 $@
-
-#
-# Temporary, until either unlit is lifted out of ghc/
-# or literate is properly set up locally -- SOF
-#
 %.prl : %.lprl
 	@$(RM) $@
 	$(UNLIT) $(UNLIT_OPTS) $< $@
 	@chmod 444 $@
 
-%.itxi : %.lprl
-	@$(RM) $@
-	$(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.ihtml : %.lprl
-	@$(RM) $@
-	$(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.itex : %.lprl
-	@$(RM) $@
-	$(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.sh : %.lsh
-	@$(RM) $@
-	$(LIT2PGM) $(LIT2PGM_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.itxi : %.lsh
-	@$(RM) $@
-	$(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.ihtml : %.lsh
-	@$(RM) $@
-	$(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.itex : %.lsh
-	@$(RM) $@
-	$(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
-	@chmod 444 $@
-
 %.c : %.lc
 	@$(RM) $@
 	$(UNLIT) $< $@
 	@chmod 444 $@
 
-%.itxi : %.lc
-	@$(RM) $@
-	$(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.ihtml : %.lc
-	@$(RM) $@
-	$(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.itex : %.lc
-	@$(RM) $@
-	$(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
-	@chmod 444 $@
-
 %.h : %.lh
 	@$(RM) $@
 	$(UNLIT) $< $@
 	@chmod 444 $@
-
-%.itxi : %.lh
-	@$(RM) $@
-	$(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.ihtml : %.lh
-	@$(RM) $@
-	$(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.itex : %.lh
-	@$(RM) $@
-	$(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.flex : %.lflex
-	@$(RM) $@
-	$(LIT2PGM) $(LIT2PGM_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.itxi : %.lflex
-	@$(RM) $@
-	$(LIT2TEXI) -c $(LIT2TEXI_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.ihtml : %.lflex
-	@$(RM) $@
-	$(LIT2HTML) -c $(LIT2HTML_OPTS) -o $@ $<
-	@chmod 444 $@
-
-%.itex : %.lflex
-	@$(RM) $@
-	$(LIT2LATEX) -c $(LIT2LATEX_OPTS) -o $@ $<
-	@chmod 444 $@
-
diff --git a/mk/target.mk b/mk/target.mk
index c46d23d57933..5474bb8db112 100644
--- a/mk/target.mk
+++ b/mk/target.mk
@@ -806,86 +806,50 @@ endif
 show:
 	@echo '$(VALUE)=$($(VALUE))'
 
-#------------------------------------------------------------
-# 			Documentation
-
+#--------------------------------------------------------------------------
+# SGML Documentation
+#
 .PHONY: dvi ps html info txt
 
-info:: $(DOC_INFO)
-dvi:: $(DOC_DVI)
-ps::  $(DOC_PS)
-html:: $(DOC_HTML)
-texi:: $(DOC_TEXI)
-txt:: $(DOC_TEXT)
-
-#
-# Building literate root documents requires extra treatment,
-# as the root files need to be processed different from other
-# literate files (`compile' them into .itex with the -S (standalone)
-# option) and then link together a master TeX document with
-# a -S option.
-#
-$(filter %.tex,$(patsubst %.lit,%.tex,$(DOC_SRCS))) :
-	@$(RM) $@
-	$(LIT2LATEX) -S -c $(LIT2LATEX_OPTS) -o $(patsubst %.tex,%.itex,$@) $(addsuffix .lit,$(basename $@))
-	$(LIT2LATEX) -S $(LIT2LATEX_OPTS) -o $@ $(addsuffix .itex,$(basename $@))
-	@chmod 444 $@
-#
-# Ditto for texi and html
-#
-$(filter %.texi,$(patsubst %.lit,%.texi,$(DOC_SRCS))) :
-	@$(RM) $@
-	$(LIT2TEXI) -S -c $(LIT2TEXI_OPTS) -o $(patsubst %.texi,%.itxi,$@) $(addsuffix .lit,$(basename $@))
-	$(LIT2TEXI) -S $(LIT2TEXI_OPTS) -o $@ $(addsuffix .itxi,$(basename $@))
-	@chmod 444 $@
-#
-# Rather than using lit2html, we opt for the lit-texi-html route,
-# and use texi2html as our HTML backend.
-# (Note: we need to change mkdependlit to get this really off the ground)
-#
-# If the generated html representation is split up into a myriad of files,
-# put the files in a subdirectory html/, if a monolith is created, park
-# the generated file in the same dir as the .lit file.
-#
-$(filter %.html,$(patsubst %.lit,%.html,$(DOC_SRCS))) : $(filter %.lit,$(DOC_SRCS))
-	$(RM) $@ $(patsubst %.html,%.texi,$@) $(patsubst %.html,%.itxi,$@)
-ifneq "$(filter -monolithic,$(TEXI2HTML_OPTS))" ""
-	$(LIT2TEXI) -S -c $(LIT2TEXI_OPTS) -o $(patsubst %.html,%.itxi,$@) $(addsuffix .lit,$(basename $@))
-	$(LIT2TEXI) -S $(LIT2TEXI_OPTS) -o $(patsubst %.html,%.texi,$@) $(addsuffix .itxi,$(basename $@))
-	$(TEXI2HTML) $(TEXI2HTML_OPTS) $(patsubst %.html,%.texi,$@)
-	cp $(TEXI2HTML_PREFIX)invisible.xbm .
+ifneq "$(SGML_DOC)" ""
+
+# multi-file SGML document: main document name is specified in $(SGML_DOC),
+# sub-documents (.sgml files) listed in $(SGML_SRCS).
+
+$(SGML_DOC).sgml : $(SGML_SRCS)
+	cat $(SGML_SRCS) > $(SGML_DOC).sgml
+
+SGML_DVI  = $(SGML_DOC).dvi
+SGML_PS   = $(SGML_DOC).ps
+SGML_INFO = $(SGML_DOC).info
+SGML_HTML = $(SGML_DOC).html
+SGML_TEXT = $(SGML_DOC).txt
+
+else # no SGML_DOC
+
+VSGML_SRCS = $(wildcard *.vsgml)
+
+ifneq "$(VSGML_SRCS)" ""
+SGML_SRCS  = $(addsuffix .sgml, $(basename $(VSGML_SRCS)))
 else
-	$(RM) html/$(basename $@)*
-	$(MKDIRHIER) html
-	$(LIT2TEXI) -S -c $(LIT2TEXI_OPTS) -o $(patsubst %.html,%.itxi,$@) $(addsuffix .lit,$(basename $@))
-	$(LIT2TEXI) -S $(LIT2TEXI_OPTS) -o html/$(patsubst %.html,%.texi,$@) $(addsuffix .itxi,$(basename $@))
-	(cd html; ../$(TEXI2HTML) $(TEXI2HTML_OPTS) $(patsubst %.html,%.texi,$@); cd ..)
-	cp $(TEXI2HTML_PREFIX)invisible.xbm html/
-	@touch $@
+SGML_SRCS  = $(wildcard *.sgml)
 endif
 
-#--------------------------------------------------------------------------
-# SGML Documentation
-#
-# This will eventually replace the literate stuff for documentation
-
-SGML_SRCS = $(wildcard    *.sgml *.vsgml)
 SGML_DVI  = $(addsuffix  .dvi, $(basename $(SGML_SRCS)))
 SGML_PS   = $(addsuffix   .ps, $(basename $(SGML_SRCS)))
-SGML_TEXI = $(addsuffix .texi, $(basename $(SGML_SRCS)))
 SGML_INFO = $(addsuffix .info, $(basename $(SGML_SRCS)))
 SGML_HTML = $(addsuffix .html, $(basename $(SGML_SRCS)))
 SGML_TEXT = $(addsuffix  .txt, $(basename $(SGML_SRCS)))
 
+endif # SGML_DOC
+
 dvi  :: $(SGML_DVI)
 info :: $(SGML_INFO)
 html :: $(SGML_HTML)
 txt  :: $(SGML_TXT)
 ps   :: $(SGML_PS)
 
-CLEAN_FILES += $(SGML_TEXT) $(SGML_HTML) $(SGML_TEXI) $(SGML_PS) $(SGML_DVI)
-
-# suffix rules should handle the rest (for single-file docs at least).
+CLEAN_FILES += $(SGML_TEXT) $(SGML_HTML) $(SGML_PS) $(SGML_DVI)
 
 ###########################################
 #
-- 
GitLab