This custom makefile was used to create this presentation. XMake converts %.mks files to %.mko, expanding all occurences of $(CURDIR). Most source files are plain text, converted to HTML using the 't2h' XMExtension. Makefile macros are used to pass custom parameters to a single PHP template, producing several static HTML output files. This illustrates an alternative to the usual one-to-one source => output file relationship.
OUTPUT_DIR:=$(CURDIR)/..

MAKEFILE:=$(CURDIR)/XMakefile.mko

# automate testing of script, using various languages:
BUILD_EXAMPLE_LANGS:=en es pt fr
# we know that japanese is not supported and will fail
# uncomment the following line to generate errors:
# BUILD_EXAMPLE_LANGS:=en es pt fr jp
# try to build these target languages
BUILD_EXAMPLE_OUTFILES:=$(patsubst \
%,$(CURDIR)/build-versus-run-time.body.%,$(BUILD_EXAMPLE_LANGS))

# files already formatted as HTML, manually, by .phpc,
# .phps or .t2h go here:
# these files should only have contents of <body>; no
# <body>, <html>, <head>, etc.
BODY_HTML_DOCS:=\
$(BUILD_EXAMPLE_OUTFILES) \
$(CURDIR)/cost.comparisons.body \
$(CURDIR)/globals.body \


# php sources needing syntax highlighting
PHP_DOCS:=\
$(CURDIR)/template.php\
$(CURDIR)/build-versus-run-time.php.phpc \
$(CURDIR)/build-versus-run-time.php \
$(CURDIR)/error-handling.php.body \
$(CURDIR)/phpc.inc.body \
$(CURDIR)/phpc.global.inc \
$(CURDIR)/globals.body.phpc \


# formatted plain text to be contained in <pre>
# html special characters will be encoded
PRE_TEXT_DOCS:=\
$(CURDIR)/xmake.help \
$(CURDIR)/xmakep.help \


# HTML to be contained in <pre>, to preserve leading tabs
# Use for bulleted lists created by t2h XMExtension
# shell scripts and command ouput saved as .t2h go here
PRE_HTML_DOCS:=\
$(CURDIR)/intro.body \
$(CURDIR)/features.body \
$(CURDIR)/system.body \
$(CURDIR)/installation.body \
$(CURDIR)/basics.xmake.php.body \
$(CURDIR)/execution.environ.body \
$(CURDIR)/security.body \
$(CURDIR)/source.security.body \
$(CURDIR)/XMakefile.mks.body \
$(CURDIR)/build-versus.example.XMakefile.mks.body \
$(CURDIR)/site.management.body \
$(CURDIR)/XMake.conf.body \
$(CURDIR)/build-versus-run-time.php.phpc.mkdo.body \
$(CURDIR)/c.mkh.body \
$(CURDIR)/c.mkr.body \
$(CURDIR)/phpc.mkh.body\
$(CURDIR)/XMake.conf.abbrev.body \
$(CURDIR)/build-versus-run-time.php.xmake.php.lint \
$(CURDIR)/build-versus-run-time.php.xmake.error \
$(CURDIR)/build-versus-run-time.php.xmake.XM.reqs \


PRE_TEXT_DOCS_OUT:=$(patsubst %,%.html,$(PRE_TEXT_DOCS))
PRE_HTML_DOCS_OUT:=$(patsubst %,%.html,$(PRE_HTML_DOCS))
BODY_HTML_DOCS_OUT:=$(patsubst \
%,%.html,$(BODY_HTML_DOCS))
PHP_DOCS_OUT:=$(patsubst %,%.html,$(PHP_DOCS))

# files that simply need to be copied to OUTPUT_DIR
COPY_ONLY_FILES:=$(CURDIR)/style.css $(CURDIR)/images

FINAL_OUTFILES:=\
$(PRE_TEXT_DOCS_OUT) \
$(PRE_HTML_DOCS_OUT) \
$(BODY_HTML_DOCS_OUT) \
$(PHP_DOCS_OUT) \
$(BUILD_EXAMPLE_OUTFILES) \
$(CURDIR)/index.html \


# these aren't included in FINAL_DOCS
INTERMEDIATE_T2H_FILES:=\
$(CURDIR)/XMakefile.mks.body.t2h \
$(CURDIR)/build-versus-run-time.php.phpc.mkdo.body.t2h \

# these files are global makefiles, external to this
# project; copied here
INTERMEDIATE_XME_T2H_FILES:=\
$(CURDIR)/c.mkh.body.t2h\
$(CURDIR)/c.mkr.body.t2h\
$(CURDIR)/phpc.mkh.body.t2h\


FINAL_DOCS:=\
$(patsubst $(CURDIR)/%,$(OUTPUT_DIR)/%,\
$(FINAL_OUTFILES) $(COPY_ONLY_FILES))

$(eval $(call XM_append,XM_outfiles,\
$(FINAL_OUTFILES) \
$(INTERMEDIATE_XME_T2H_FILES) \
$(INTERMEDIATE_T2H_FILES) \
$(FINAL_DOCS)\
$(CURDIR)/phpc.inc.body\
))

######## RULES
# ################################################
DOC_PREREQUISITES:=\
$(CURDIR)/template.php \
$(CURDIR)/list.php  \
$(CURDIR)/navbar.php \
$(CURDIR)/header.php \
$(CURDIR)/footer.php \
$(MAKEFILE)

$(eval $(call XM_dependencyRule,\
$(PRE_TEXT_DOCS_OUT) \
$(PRE_HTML_DOCS_OUT) \
$(PHP_DOCS_OUT) \
$(BODY_HTML_DOCS_OUT)\
$(CURDIR)/index.html \
,$(DOC_PREREQUISITES)))

$(TEXT_DOCS_OUT):%.html:%
	@$(call \
	XME_phpc_outfileMacro,$(CURDIR)/template.php,$$source_file="$(notdir \
	$<)"; $$is_text_file=true;,$@)

$(PRE_TEXT_DOCS_OUT):%.html:%
	@$(call \
	XME_phpc_outfileMacro,$(CURDIR)/template.php,$$source_file="$(notdir \
	$<)"; $$is_text_file=true; $$is_preformatted=true;,$@)

$(PRE_HTML_DOCS_OUT):%.html:%
	@$(call \
	XME_phpc_outfileMacro,$(CURDIR)/template.php,$$source_file="$(notdir \
	$<)"; $$is_html_file=true; $$is_preformatted=true;,$@)

$(BODY_HTML_DOCS_OUT):%.html:%
	@$(call \
	XME_phpc_outfileMacro,$(CURDIR)/template.php,$$source_file="$(notdir \
	$<)"; $$is_html_file=true;,$@)

$(PHP_DOCS_OUT):%.html:%
	@$(call \
	XME_phpc_outfileMacro,$(CURDIR)/template.php,$$source_file="$(notdir \
	$<)"; $$is_php_file=true;,$@)


# special rule for this file since it has no title in
# list.php; manually set $title
$(CURDIR)/index.html:%.html:%
	@$(call \
	XME_phpc_outfileMacro,$(CURDIR)/template.php,$$title="Contents"; \
	$$source_file="$(notdir $<)"; $$is_html_file=true;,$@)

# custom pattern rule to create files %.body.html from
# %.body.html.t2h sources
# configuration file replaces '*' with <img .../>, etc.:
t2h_conf:=$(CURDIR)/t2h.conf
# $(eval $(call
# XME_patternRule,$(ext),$(prerequisites),$(cmdOptions)))
$(eval $(call XME_patternRule,t2h,$(t2h_conf),-b "" -f \
$(t2h_conf)))

T2H_NO_WRAP:=
#$(CURDIR)/XMake.conf.body.t2h
# static rule for processing SOME .t2h sources without
# wrapping:
# -w 0
# $(eval $(call
# XME_staticRule,$(ext),$(srcfiles),$(prerequisites),$(cmdOptions)))
#$(eval $(call
# XME_staticRule,t2h,$(T2H_NO_WRAP),$(t2h_conf),-w 0 -f
# $(t2h_conf)))

# files listed here should also appear above, in
# PRE_HTML_DOCS,
# without the final .t2h extension
T2H_MAKEFILE:=\
$(CURDIR)/XMake.conf.body.t2h \
$(CURDIR)/XMakefile.mks.body.t2h \
$(CURDIR)/execution.environ.body.t2h \
$(CURDIR)/site.management.body.t2h \
$(CURDIR)/build-versus-run-time.php.phpc.mkdo.body.t2h \
$(CURDIR)/c.mkh.body.t2h\
$(CURDIR)/c.mkr.body.t2h\
$(CURDIR)/phpc.mkh.body.t2h\
$(CURDIR)/XMake.conf.abbrev.body.t2h \
$(CURDIR)/build-versus.example.XMakefile.mks.body.t2h
# This rule works best for makefiles:
# use <pre> to preserve leading tab;
# highlight comments; wrap lines using "\"; no nl2br
# substitution
t2h_makefile_conf:=$(CURDIR)/t2h.mk.conf
# $(eval $(call
# XME_staticRule,$(ext),$(srcfiles),$(prerequisites),$(cmdOptions)))
$(eval $(call \
XME_staticRule,t2h,$(T2H_MAKEFILE),$(t2h_makefile_conf),-f \
$(t2h_makefile_conf)))

# execute the build-versus-run-time example PHP script
# test by passing in a set of runtime parameters
$(BUILD_EXAMPLE_OUTFILES): \
$(CURDIR)/build-versus-run-time.body.% \
:$(CURDIR)/build-versus-run-time.php
	@$(call \
	XME_phpc_outfileMacro,$(CURDIR)/build-versus-run-time.php,$$user="greg"; \
	$$lang="$*";,$@)

# generate a source for formatting by t2h
$(INTERMEDIATE_T2H_FILES):%.body.t2h:%
	@cp $< $@

# these files are global makefiles, external to this
# project
$(INTERMEDIATE_XME_T2H_FILES):$(CURDIR)/%.body.t2h:$(XMAKE_HOME)/config/XMExtensions/%
	@cp $< $@

# this file requires a special rule
$(CURDIR)/phpc.inc.body:$(CURDIR)/%.body:$(XMAKE_HOME)/config/XMExtensions/%
	@cp $< $@

# copy output files to output directory
$(FINAL_DOCS): $(OUTPUT_DIR)/% : $(CURDIR)/%
	@cp -rf  $< $@

#highlighted_source:=$(XMAKE_HOME)/config/XMExtensions/phpc.inc
#$(PHP_DOCS)
#$(eval $(call
# XME_phpc_highlight_file,$(highlighted_source),$(CURDIR)/phpc.inc.test))
#$(eval $(call
# XME_phpc_highlight_files,$(highlighted_sources),.test))