Newer
Older
XML / Makefile
################################################################################
#
# File: $Id$
#
# Makefile for building the INFO database courses XML formatting stylesheets.
# (We really need a better name :)
#
################################################################################


SHELL=/bin/sh


################################################################################
#
# Required Environment Variables
#
# TEACHING_SHARED
#	This variable specifies the path to the top level of the teaching
#	shared directory hierarchy (e.g., /path/to/Teaching/Shared).
#
TEACHING_SHARED?=$(error The required environment variable TEACHING_SHARED has not been defined. It should point to the root level of the shared teaching directory (e.g., /path/to/Teaching/Shared))


################################################################################
#
# Set up paths to makefile include directories.
#
# GLOBAL_HANDBOOK_INCLUDE is the global include directory in the "Shared"
# hierarchy, and is defined relative to the root of that hierarchy.
#
GLOBAL_HANDBOOK_INCLUDE?=$(TEACHING_SHARED)/Authoring/Handbook/make-includes


################################################################################
#
# Include local system-specific configuration.
#
include $(GLOBAL_HANDBOOK_INCLUDE)/local_configuration.make


################################################################################
#
# Include the XSLT processing functions. Note that we are assuming a fixed
# path relative to the current directory!
#
include $(GLOBAL_HANDBOOK_INCLUDE)/xslt_functions.make


.PHONY: all clean


MODULES:=$(shell $(FIND) modules -type f -name "*.xml" )


all: xml2html.xsl xml2xhtml.xsl xml2latex.xsl xml2xelatex.xsl oracle-docs.xsl modules/paper_calendar_dates.xml


xml2html.xsl xml2latex.xsl xml2xelatex.xsl: format-master.xml $(MODULES) xml2xslt.xsl oracle-docs.xsl Makefile
	$(call xslt,$<,xml2xslt.xsl,$(call xslt_parameter,target-format,$(@:xml2%.xsl=%))) > $@


# Since it seems impossible in XSLT to generate an xmlns attribute for the
# <html> element, we have to add the attribute after the fact :(.
xml2xhtml.xsl: format-master.xml $(MODULES) xml2xslt.xsl oracle-docs.xsl modules/paper_calendar_dates.xml Makefile
	$(call xslt,$<,xml2xslt.xsl,$(call xslt_parameter,target-format,$(@:xml2%.xsl=%))) > $@


format-master.xml: modules/paper_calendar_dates.xml


modules/paper_calendar_dates.xml: generate_calendar_dates.php
	php $< > $@


oracle-docs.xsl: oracle-docs.perl
	perl $< '.*' xslt > $@


clean:
	rm -f xml2html.xsl xml2xhtml.xsl xml2latex.xsl xml2xelatex.xsl oracle-docs.xsl modules/paper_calendar_dates.xml