Makefile Overview

The Makefile is the central controller in the project. It includes other Makefiles as sub-components.

Different parts of the Makefile are called by cron at various intervals. cron runs as the user capitularia.

Manuscript filespubl/mss/*.xmlManuscript filespubl/cache/mss/*.htmlExtracted chapterspubl/cache/collation/*.xmlListspubl/cache/lists/*Database(Postgres)Wordpress(mariadb)Full-text search(Solr)mss-header.xslmss-transcription.xslmss-footer.xslcapit-list.xslmss-key.xslchanges.xslcorpus.xsl...mss-extract-chapters.xslmss-extract-chapters-txt.xslimport_data.pyimport_solr.py

Makefile Overview

XSLT Dependencies

The section of the Makefile that deals with the dependencies between manuscripts, xslt stylesheets, and html files is generated by the Python script python/xslt_dep.py.

xslt_dep.py

Manage dependencies between XSL-Stylesheets.

This tool reads specially formatted metadata in the first comment of XSL-Stylesheets and generates one of:

  • a Makefile

  • a graphviz .dot file

  • an HTML table.

The generated Makefile is then included into the main Makefile.

It can also draw a dependency graph of XSL-Stylesheets by reading the <xsl:include> and <xsl:import> statements.

Internally uses a triple store for the relations between files.

Following “markup” is recognized in the first comment of XSL-Stylesheets:

Transforms: sources -> destinations [: comment]

Adds dependencies to the generated Makefile. Adds sources, xsl file, and destinations to the graph. The optional comment will be added to the arrow in the .dot file. If the comment is make=false no dependencies will be added to the Makefile.

Target: target destinations

Adds a target to the generated Makefile that depends on the destination files. Adds a group box to the graph that surrounds all destination files.

URL: destinations path

Graph only. Adds a box to the graph that shows the path from the web root where the destination files will be visible for the public.

Scrape: parameter sources

Graph only. Adds a drum to the graph that says: import_data.py --<parameter>. With that command you can import the the source file(s) into the Postgres database.

Example:

Transforms: $(CAPIT_DIR)/lists/capit_all.xml -> $(CACHE_DIR)/lists/capit-all.html     : type=all
Transforms: $(CAPIT_DIR)/lists/capit_all.xml -> $(CACHE_DIR)/lists/capit-pre814.html  : type=pre814
Transforms: $(CAPIT_DIR)/lists/capit_all.xml -> $(CACHE_DIR)/lists/capit-ldf.html     : type=ldf
Transforms: $(CAPIT_DIR)/lists/capit_all.xml -> $(CACHE_DIR)/lists/capit-post840.html : type=post840
Transforms: $(CAPIT_DIR)/lists/capit_all.xml -> $(CACHE_DIR)/lists/capit-undated.html : type=undated

URL: $(CACHE_DIR)/lists/capit-all.html     /capit/list/
URL: $(CACHE_DIR)/lists/capit-pre814.html  /capit/pre814/
URL: $(CACHE_DIR)/lists/capit-ldf.html     /capit/ldf/
URL: $(CACHE_DIR)/lists/capit-post840.html /capit/post840/
URL: $(CACHE_DIR)/lists/capit-undated.html /capit/undated/

Target: lists $(CACHE_DIR)/lists/capit-all.html
Target: lists $(CACHE_DIR)/lists/capit-pre814.html
Target: lists $(CACHE_DIR)/lists/capit-ldf.html
Target: lists $(CACHE_DIR)/lists/capit-post840.html
Target: lists $(CACHE_DIR)/lists/capit-undated.html

Scrape: cap-list $(CAPIT_DIR)/lists/capit_all.xml

The tool implements a ‘little language’ that reads a list of commands from stdin. Commands are separated by newlines.

read filename

scan an XSL-Stylesheet.

recurse

recursively scan all XSL-Stylesheets referenced in xsl:import and xsl:include statements

load filename

load a triple store in turtle format

save filename

saves a triple store in turtle format

io filename

adds transformations involving filename to the output

dep filename

adds stylesheet dependencies of filename to the output

make filename

outputs a Makefile dependencies

dot filename

outputs a graphviz dot file

html filename

outputs a HTML table

Examples:

read my-style.xsl
recurse
dep *.xsl
dot output-graph.dot
read my-style.xsl
read my-styles-*.xsl
read my-extended-styles-*.xsl
save styles.ttl
load styles.ttl
io my-style.xsl
io my-styles-first.xsl
io my-styles-second.xsl
dot output-graph.dot
usage: xslt_dep.py [-h] [-e E]
-h, --help

show this help message and exit

-e <e>

Commands to be executed, separated by ‘;’. Default: read commands from stdin, separated by newlines.