summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--OMakefile34
-rw-r--r--doc/OMakefile41
2 files changed, 68 insertions, 7 deletions
diff --git a/OMakefile b/OMakefile
index 00955a3..45f3ad2 100644
--- a/OMakefile
+++ b/OMakefile
@@ -14,8 +14,11 @@ misc_dir = ./misc
lua_src[] = $(glob $(src_dir)/rst_*.lua)
tex_src = $(src_dir)/t-rst.mkiv
script_src = $(src_dir)/mtx-t-rst.lua
+ifc_src = $(misc_dir)/t-rst.xml
-doc_src[] = $(glob $(doc_dir)/*)
+meta_files[] = README.rst COPYING
+build_files[] = OMakeroot OMakefile $(doc_dir)/OMakefile
+doc_src[] = $(filter-out OMakefile, $(glob $(doc_dir)/*))
###############################################################################
# DIRECTORIES
@@ -27,10 +30,12 @@ doc_src[] = $(glob $(doc_dir)/*)
build_root = ./build
doc_tree = $(build_root)/doc/context/third/$(name)
tex_tree = $(build_root)/tex/context/third/$(name)
+ifc_tree = $(build_root)/tex/context/interface/third
+src_tree = $(build_root)/source/context/$(name)/
script_tree = $(build_root)/scripts/context/lua/third/$(name)
ctan_root = $(build_root)/$(name)
doc_tmpdir = $(build_root)/doc-tmp
-tds_hier[] = $(doc_tree) $(tex_tree) $(script_tree)
+tds_hier[] = $(doc_tree) $(tex_tree) $(script_tree) $(ifc_tree) $(src_tree)
tds_dirnames[] = doc scripts tex
tds_dirs[] = $(addprefix $(build_root)/,$(tds_dirnames))
@@ -43,6 +48,9 @@ dirs[] = $(build_root) $(ctan_root) $(tds_hier)
ctan_zipfile = $(name).zip
tds_zipfile = $(name).tds.zip
+manual_name = manual
+manual_pdf = $(doc_tmpdir)/$(manual_name).pdf
+
ctan_zip = $(build_root)/$(ctan_zipfile)
tds_zip = $(build_root)/$(tds_zipfile)
pkgs = $(ctan_zip) $(tds_zip)
@@ -56,10 +64,15 @@ section
usage:
echo "****************************** $(name) ******************************"
echo
+ echo " $(name) is distributed under the 2-clause BSD license. See the file"
+ echo " COPYING in the root tree of this repository for details."
+ echo
echo "defined targets:"
echo " ctan package for CTAN"
echo " tds package as TDS directory hierarchy"
echo
+ echo " doc create module manual"
+ echo
echo " clean remove temporary files"
echo " nuke remove all created files"
echo
@@ -90,12 +103,16 @@ ctan: $(ctan_zip)
## PDF documentation
doc: .PHONY/$(doc_tmpdir)/manual
-$(tds_zip): tds-hier
+$(tds_zip): doc tds-hier
$(echo $(name)> packaging as $@ with TDS directories)
- cp($(lua_src) $(tex_tree))
- cp($(tex_src) $(tex_tree))
- cp($(script_src) $(script_tree))
- cp($(doc_src) $(doc_tree))
+ cp($(lua_src) $(tex_tree))
+ cp($(tex_src) $(tex_tree))
+ cp($(script_src) $(script_tree))
+ cp($(doc_src) $(doc_tree))
+ cp($(manual_pdf) $(doc_tree))
+ cp($(ifc_src) $(ifc_tree))
+ cp($(meta_files) $(src_tree))
+ cp($(build_files) $(src_tree))
cd $(build_root) && zip -9 -r ./$(tds_zipfile) $(tds_dirnames)
$(ctan_zip): ctan-root $(tds_zip)
@@ -104,6 +121,9 @@ $(ctan_zip): ctan-root $(tds_zip)
cp($(script_src) $(ctan_root))
cp($(tex_src) $(ctan_root))
cp($(doc_src) $(ctan_root))
+ cp($(manual_pdf) $(ctan_root))
+ cp($(ifc_src) $(ctan_root))
+ cp($(meta_files) $(ctan_root))
cd $(build_root) && zip -9 -r ./$(ctan_zipfile) $(name) $(tds_zipfile)
.DEFAULT: usage
diff --git a/doc/OMakefile b/doc/OMakefile
new file mode 100644
index 0000000..3de13bc
--- /dev/null
+++ b/doc/OMakefile
@@ -0,0 +1,41 @@
+## Subdirectory omake makefile for the reStructuredText module
+## for Context. See the root OMakefile for details.
+## https://bitbucket.org/phg/context-rst/src/tip/OMakefile
+.PHONY: manual clean nuke
+
+name = manual
+
+manual_src = $(name).tex
+manual_rst = documentation.rst
+manual_pdf = $(name).pdf
+manual_tmp = doc.tex
+manual_junk[] = $(addprefix $(name), .tuc .log)
+manual_spam = $(name)-termout.log
+
+## The manual is itself written in reStructuredText. This leads to
+## a precarious situation: the module is required to be present in
+## order for the manual to be built. We’re going to have to find
+## some solution for smooth bootstrapping, but at the moment that’s
+## a low priority goal.
+$(manual_pdf): :effects: $(manual_tmp) $(manual_junk) $(manual_spam)
+ rm -rf -- $(manual_spam)
+ echo ":: creating $(manual_tmp) from $(manual_rst)"
+ mtxrun --script rst \
+ --if=$(file $(manual_rst)) \
+ --of=$(manual_tmp) \
+ &> $(manual_spam)
+ echo ":: creating $@ from $(manual_src) and $(manual_tmp)"
+ context $(file $(manual_src)) &>> $(manual_spam)
+
+manual: $(manual_pdf)
+
+clean:
+ rm -rf -- $(manual_junk) $(manual_tmp) $(manual_spam)
+
+nuke: clean
+ rm -rf -- $(manual_pdf)
+
+## note to self: default targets in subdirectories will
+## lead to those targets being built whenever omake is
+## invoked without arguments from the root tree as well.
+#.DEFAULT: manual