diff -r 289e2fca4dd1 -r 1da4bd42ccb6 Local.rules.mk
--- a/Local.rules.mk	Mon Aug 19 17:09:55 2013 +0900
+++ b/Local.rules.mk	Mon Aug 19 17:28:27 2013 +0900
@@ -1,23 +1,9 @@
-#   Include file for Local.rules.
+#   Set up variable defaults to be overridden by Local.rules.
+#   This file should contain only Make variable assignments!
 
-#   Sanity checks:
-
-ifeq (${XEMACS_WEBSITE_BASE},)
-___:= $(error XEMACS_WEBSITE_BASE not defined??)
-endif
-
-___:= $(shell [ -f ${XEMACS_WEBSITE_BASE}/Local.rules ] && echo exists)
-
-Local.rules: ${XEMACS_WEBSITE_BASE}/Local.rules
-.PHONY: Local.rules
-
-${XEMACS_WEBSITE_BASE}/Local.rules: ${XEMACS_WEBSITE_BASE}/Local.rules.template
-ifneq (${___},exists)
-	command := $(shell cp -p $< $@)
-	$(error You must edit "$(notdir $@)" and customize it for this build host.)
-else
-	$(error "$(notdir $<)" has been updated or is newer than "$(notdir $@)".  Merge the changes into your "$(notdir $@)".)
-endif
+XEMACS_WEBSITE_BASE := $(shell pwd)
+# "hidden" directory to hold timestamps
+STAMPS=.stamps
 
 #   Default program settings for Unix.
 #   DON'T CHANGE THIS FILE.  Override them in Local.rules.
@@ -25,7 +11,7 @@
 #   reasonable defaults for windows.
 
 XEMACS=xemacs
-FLAGS=-eval '(kill-emacs 0)' -batch -q -no-site-file
+FLAGS= -batch -q -no-site-file
 
 FIND=find
 MKDIR=mkdir
@@ -35,6 +21,7 @@
 LINKLINT_CASE=
 #   Ignore checking of links into the XEmacs CVS repository via ViewCVS.
 #   These checks are expensive and links are correct by design.
+#   #### This is out of date!!
 LINKLINT_IGNORESET=-ignore http://cvs.xemacs.org/viewcvs.cgi/XEmacs/@
 
 #   mknmz command
@@ -46,5 +33,4 @@
 
 TEXI2HTML = texi2html
 
-# "hidden" directory to hold timestamps
-STAMPS=.stamps
+include Local.rules
diff -r 289e2fca4dd1 -r 1da4bd42ccb6 Local.rules.template
--- a/Local.rules.template	Mon Aug 19 17:09:55 2013 +0900
+++ b/Local.rules.template	Mon Aug 19 17:28:27 2013 +0900
@@ -1,16 +1,29 @@
-#   Local.rules - Site-Local definitions.
+##  Local.rules - Site-Local definitions.
 
 #   This is the local rules file for *nix.
-#   The default values are the same as in Local.rules.mk.
-#   Copy it to Local.rules.  Then make any necessary customizations,
-#   and uncomment them.
 #   If you are running Windows, you may find Local.rules.windows more useful.
 
+#   As distributed, this file is a no-op.
+#   To use, copy it to Local.rules.
+
+##  Targets
+#   Rules defined here should specify only dependencies.
+
 #   If uncommented, this will become the default target.
 
-#default: validate
+#default: validdocs
 
-#   Programs and their options
+##  Basic environment variables.
+#   If possible, it's best to fix problems without customizing these.
+
+#XEMACS_WEBSITE_BASE := $(shell pwd)
+#STAMPS=.stamps
+
+##  Programs and their options
+
+#   Make customizations to variables where needed, and uncomment them.
+#   If programs work with the default values, customization of the
+#   corresponding variables is unnecessary.
 
 #XEMACS=xemacs
 #FLAGS=-batch -vanilla
@@ -23,6 +36,7 @@
 #LINKLINT_CASE=
 #   Ignore checking of links into the XEmacs CVS repository via ViewCVS.
 #   These checks are expensive and links are correct by design.
+#   #### This is out of date!!
 #LINKLINT_IGNORESET=-ignore http://cvs.xemacs.org/viewcvs.cgi/XEmacs/@
 
 #   mknmz command
@@ -34,17 +48,16 @@
 
 #TEXI2HTML = texi2html
 
+##  Configurations used by XEmacs.org:
 #   www.xemacs.org:
 #TEXI2HTML = perl /web/http-xemacs/xemacsweb/Texi2html/texi2html
 #   www.sunsite.dk:
 #TEXI2HTML = perl /pack/ftp/projects/xemacs/xemacsweb/Texi2html/texi2html
-#   www.us.xemacs.org:
+#   www.us.xemacs.org (SourceForge):
 #TEXI2HTML = perl /home/groups/x/xe/xemacs/xemacsweb/Texi2html/texi2html
 #   TANG:
 #TEXI2HTML=perl "c:/Hacking/cvs.xemacs.org/XEmacs/xemacsweb/Texi2html/texi2html"
 
-#STAMPS=.stamps
-
 #
 #   Local Variables:
 #   mode: makefile
diff -r 289e2fca4dd1 -r 1da4bd42ccb6 Makefile
--- a/Makefile	Mon Aug 19 17:09:55 2013 +0900
+++ b/Makefile	Mon Aug 19 17:28:27 2013 +0900
@@ -1,22 +1,24 @@
-# -*-Makefile-*- Begin of xemacsweb Makefile
+# -*-Makefile-*-  for Unix and Windows NT.
 #
 # Adrian Aichner (APA), aichner@ecf.teradyne.com, Teradyne GmbH, 2000-07-29.
 # Stephen Turnbull (stephen), stephen@xemacs.org, 2008-02-02
 #
-# xemacsweb makefile for UNIX and Windows NT.
 # Requires GNU make, available on Windows NT via Cygwin and MSYS.
 # (This Makefile uses immediately-expanded assignments in an essential way.)
 #
+# You *must* provide a Local.rules file, but it can be a no-op.
+# Templates are provided in Local.rules.template and Local.rules.windows.
+#
 # Supported targets:
 #
-# all:              same as validate [default target]
-# everything:       validate + namazu-re-index + Download/win32
-# validate:         htdocs + validation of all .html files using XEmacs/PSGML
-# htdocs:           creation of .html from .content files using genpage
-# linklint:         run linklint on the tree, including remote links
-# namazu-re-index:  run the namazu indexer on the tree
-# Documentation:    make HTML documents from XEmacs 21.5 sources
-# Download/win32:   update Win32 download information
+# all:              Builtin default target.  Runs "make validdocs checkconfig".
+# everything:       validdocs + namazu-re-index + Download/win32
+# validdocs:        Generate all .html files, and validate them
+# linklint:         Run linklint on the tree, including remote links.
+# namazu-re-index:  Run the namazu indexer on the tree,
+# Documentation:    Make HTML documents from XEmacs 21.5 sources.
+# Download/win32:   Update Win32 download information,
+# checkconfig:	    Check for problems in environment and fix where possible.
 
 ################ Override variables in Local.rules. ################
 ################  No user-serviceable parts below.  ################
@@ -25,11 +27,20 @@
 .SUFFIXES: .content .html .el .elc # Define our suffix list
 .PHONY: namazu-re-index linklint Documentation Download/win32
 
-XEMACS_WEBSITE_BASE := $(shell pwd)
+#   Include the default configuration.
+#   Local.rules.mk includes Local.rules itself, and sanity checks the result.
+include Local.rules.mk
 
-# Prune directories where we won't find .content files
-# or HTML files requiring validation.
+# Define collections of files to process.
+# The *_FILES variables are computed when accessed.
 
+# These are recursively-expanded, because FIND is defined in Local.rules.
+CONTENT_FILES        = $(shell $(FIND) . $(PRUNES) -o -name "*.content" -print)
+GENERATED_HTML_FILES = $(CONTENT_FILES:.content=.html)
+VALIDATE_HTML_FILES  = $(shell $(FIND) . $(PRUNES) -o -name "*.html" -print) $(GENERATED_HTML_FILES)
+
+# Define directories to prune because we won't find .content files
+# or HTML files requiring validation in them.
 PRUNE_GENPAGE  := -path ./genpage -prune
 PRUNE_LINKLINT := -path "./linklint*" -prune
 PRUNE_215_TEXI := -path ./Documentation/21.5/html -prune
@@ -37,37 +48,19 @@
 PRUNES := $(PRUNE_GENPAGE) -o $(PRUNE_LINKLINT)
 PRUNES := \( $(PRUNES) -o $(PRUNE_215_TEXI) -o $(PRUNE_PKG_TEXI) \)
 
-# Define collections of files to process.
-
-# These must be recursively-expanded variables.  FIND is defined in Local.rules.
-CONTENT_FILES        = $(shell $(FIND) . $(PRUNES) -o -name "*.content" -print)
-GENERATED_HTML_FILES = $(CONTENT_FILES:.content=.html)
-VALIDATE_HTML_FILES  = $(shell $(FIND) . $(PRUNES) -o -name "*.html" -print) $(GENERATED_HTML_FILES)
-
 # Some prerequisites we use.
 
 GENPAGE_CONF := "genpage.conf"
 ELCS         := batch-psgml-validate.elc release-mail-to-html.elc
 
-#   Include the sanity checks and default program locations.
-
-include Local.rules.mk
-# Include any local overrides specified by the user.
--include Local.rules
-
-#   Targets
+#   Rules
 
 #   Default target; must come before other targets but after Local.rules.
-# all: validate
-# Just generate .html from .content without validate until validation
-# is working incrementally again.
-# APA: Must touch $(STAMPS)/htdocs as well since validation updates
-# dependencies of $(STAMPS)/htdocs
-all: FAQ Documentation validate namazu-re-index
+all: checkconfig validdocs
 
-everything: validate FAQ Documentation Download/win32 namazu-re-index
+validdocs: $(ELCS) htdocs $(STAMPS)/validate
 
-validate: htdocs $(ELCS) $(STAMPS)/validate
+everything: checkconfig validate FAQ Documentation Download/win32 namazu-re-index
 
 htdocs: $(STAMPS)/htdocs
 
@@ -87,27 +80,29 @@
 # Create directory for commit logs.
 # Create compatibility link faq.
 # configure and build Texi2html.
-# APA: Build the genpage documentation.  Maintain a timestamp to avoid
-# needless re-generation of genpage release documentation.
-# APA: The genpage/content/index.content is not the only dependency,
-# but any improvements should go into the genpage/Makefile itself and
-# be integrated with a genpage release.
-init:
-	if test ! -d $(STAMPS); then \
-	      $(MKDIR) $(STAMPS); \
-	fi;
-	if test ! -d logs; then \
-	      mkdir logs; \
-	fi;
-	if test ! -d $(LINKLINT_OUTDIR); then \
-	      mkdir $(LINKLINT_OUTDIR); \
-	fi;
-	if test ! -e faq; then \
-	      ln -s FAQ faq; \
-	fi;
+# Build the genpage documentation.
+checkconfig:
+	if test ! -d $(STAMPS); then $(MKDIR) $(STAMPS); fi
+	if test ! -d logs; then mkdir logs; fi
+	if test ! -d $(LINKLINT_OUTDIR); then mkdir $(LINKLINT_OUTDIR); fi
+	if test ! -e faq; then ln -s FAQ faq; fi
 	cd genpage; $(MAKE) gp
-	cd Texi2html; bash configure; make
+	cd Texi2html; \
+	if test configure -nt Makefile; then bash configure; fi; \
+	$(MAKE)
 	cd FAQ; $(MAKE)
+	@if test -z "${XEMACS_WEBSITE_BASE}"; then \
+	  echo Computation of XEMACS_WEBSITE_BASE failed.; \
+	  echo You may want to define XEMACS_WEBSITE_BASE in Local.rules.; \
+	  exit -10; \
+	fi
+	make Local.rules
+
+Local.rules: ${XEMACS_WEBSITE_BASE}/Local.rules
+.PHONY: Local.rules
+
+${XEMACS_WEBSITE_BASE}/Local.rules: ${XEMACS_WEBSITE_BASE}/Local.rules.template
+	$(error Your "$(notdir $@)" is out-of-date or non-existent.)
 
 # APA: When contentdir and outputdir are the same then, and only then,
 # genpage depends only on content files.  Copying of all other files
@@ -148,11 +143,10 @@
 	for i in $?; do \
 		echo $$i >> VALIDATE_HTML_FILES.txt; \
 	done
-	cat VALIDATE_HTML_FILES.txt | xargs --max-chars=1000 $(XEMACS) \
-	$(FLAGS) -l ./batch-psgml-validate.elc -f batch-psgml-validate
+	cat VALIDATE_HTML_FILES.txt | xargs $(XEMACS) $(FLAGS) \
+		-l ./batch-psgml-validate.elc -f batch-psgml-validate
 	touch $(STAMPS)/validate
 
-# PB: target for rebuilding the namazu index
 # APA: Touch index.html for index template files to be re-generated.
 # www.xemacs.org has a patched mknmz that will update index files,
 # unless they are newer than the associated template.
@@ -165,8 +159,7 @@
 	fi;
 	touch $(STAMPS)/namazu-re-index
 
-# APA: Remove all .html files (and backups) generated from .content
-# files.  Need to remove timestamp files as well!
+# APA: Need to remove timestamp files as well!
 clean:
 	$(FIND) . \( -name "*.content" -o -name "*~" \) -print | perl -ne "{ chomp; s/\.content/.html/; unlink; }"
 	rm -f $(STAMPS)/htdocs
@@ -181,14 +174,7 @@
 Download/win32:
 	cd $@ && $(MAKE)
 
-# APA: Compile any lisp file for performance (a bit simple-minded, maybe).
 %.elc: %.el
 	$(XEMACS) $(FLAGS) -f batch-byte-compile $<
 
-#    Scaffolding
-
-# APA: A directory as dependency will always trigger the rule (cygwin, linux).
-# $(STAMPS):
-# 	$(MKDIR) $(STAMPS)
-
 # End of xemacsweb Makefile
