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
BUILD_EXAMPLE_LANGS:=en es pt fr
BUILD_EXAMPLE_OUTFILES:=$(patsubst \
%,$(CURDIR)/build-versus-run-time.body.%,$(BUILD_EXAMPLE_LANGS))
BODY_HTML_DOCS:=\
$(BUILD_EXAMPLE_OUTFILES) \
$(CURDIR)/cost.comparisons.body \
$(CURDIR)/globals.body \
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 \
PRE_TEXT_DOCS:=\
$(CURDIR)/xmake.help \
$(CURDIR)/xmakep.help \
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))
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 \
INTERMEDIATE_T2H_FILES:=\
$(CURDIR)/XMakefile.mks.body.t2h \
$(CURDIR)/build-versus-run-time.php.phpc.mkdo.body.t2h \
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\
))
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;,$@)
$(CURDIR)/index.html:%.html:%
@$(call \
XME_phpc_outfileMacro,$(CURDIR)/template.php,$$title="Contents"; \
$$source_file="$(notdir $<)"; $$is_html_file=true;,$@)
t2h_conf:=$(CURDIR)/t2h.conf
$(eval $(call XME_patternRule,t2h,$(t2h_conf),-b "" -f \
$(t2h_conf)))
T2H_NO_WRAP:=
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
t2h_makefile_conf:=$(CURDIR)/t2h.mk.conf
$(eval $(call \
XME_staticRule,t2h,$(T2H_MAKEFILE),$(t2h_makefile_conf),-f \
$(t2h_makefile_conf)))
$(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="$*";,$@)
$(INTERMEDIATE_T2H_FILES):%.body.t2h:%
@cp $< $@
$(INTERMEDIATE_XME_T2H_FILES):$(CURDIR)/%.body.t2h:$(XMAKE_HOME)/config/XMExtensions/%
@cp $< $@
$(CURDIR)/phpc.inc.body:$(CURDIR)/%.body:$(XMAKE_HOME)/config/XMExtensions/%
@cp $< $@
$(FINAL_DOCS): $(OUTPUT_DIR)/% : $(CURDIR)/%
@cp -rf $< $@