How the Guidelines (HTML version) are built

Intro
This is a page where I'm going to gather together notes on what I figure out about the Guidelines build process. I'm trying to change the generation of tehe index.html and index-toc.html pages, replacing the former with a new version of the latter, and the latter with a redirect for people with obsolete bookmarks. To do this I need to understand the build process, which is not uncomplicated, and it may help others to have my notes to start from if they're also working on the same code.

Makefile
The process is triggered by the P5/Makefile, specifically this target chain (AFAICS):


 * teiwebsiteguidelines, which calls
 * html-web, passing all languages as parameters, which calls check.stamp (checking for required tools), then
 * p5.xml, which generates all the schemas and the p5.xml file used as input, then
 * html-web.stamp, which runs a perl process which converts P5/guidelines.xsl.model to guidelines.xsl (don't know what the perl thing does yet), then uses it to generate the HTML version of the Guidelines in a directory called Guidelines-web/[language]/html

The initial teiwebsiteguidelines packages up the result into a zip file.