summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.hgignore5
-rw-r--r--OMakefile106
-rw-r--r--OMakeroot9
3 files changed, 120 insertions, 0 deletions
diff --git a/.hgignore b/.hgignore
index 7874dae..e73cefe 100644
--- a/.hgignore
+++ b/.hgignore
@@ -37,8 +37,13 @@ syntax:glob
*.ted
*.bib
./testing/*
+./build
./tmp.tex
./doc/*
*–rst_temporary*
./tmp/*
./test/*
+.omakedb
+.omakedb.lock
+*.omc
+*.orig
diff --git a/OMakefile b/OMakefile
new file mode 100644
index 0000000..2fabca5
--- /dev/null
+++ b/OMakefile
@@ -0,0 +1,106 @@
+.PHONY: all install clean nuke buildenv ctan ctan-root tds tds-hier usage
+
+name = rst
+
+###############################################################################
+# SOURCE
+###############################################################################
+
+doc_dir = ./doc
+src_dir = ./src
+misc_dir = ./misc
+
+## input
+lua_src[] = $(glob $(src_dir)/rst_*.lua)
+tex_src = $(src_dir)/t-rst.mkiv
+script_src = $(src_dir)/mtx-t-rst.lua
+
+doc_src[] = $(glob $(doc_dir)/*)
+
+###############################################################################
+# DIRECTORIES
+###############################################################################
+
+## The CTAN guys prefer the zipball to extract to a source directory with a
+## flat structure containing all the files, and an accompanying TDS zipball
+## at the root.
+build_root = ./build
+doc_tree = $(build_root)/doc/context/third/$(name)
+tex_tree = $(build_root)/tex/context/third/$(name)
+script_tree = $(build_root)/scripts/context/lua/third/$(name)
+ctan_root = $(build_root)/$(name)
+tds_hier[] = $(doc_tree) $(tex_tree) $(script_tree)
+tds_dirnames[] = doc scripts tex
+tds_dirs[] = $(addprefix $(build_root)/,$(tds_dirnames))
+
+dirs[] = $(build_root) $(ctan_root) $(tds_hier)
+
+###############################################################################
+# GENERATED
+###############################################################################
+
+ctan_zipfile = $(name).zip
+tds_zipfile = $(name).tds.zip
+
+ctan_zip = $(build_root)/$(ctan_zipfile)
+tds_zip = $(build_root)/$(tds_zipfile)
+pkgs = $(ctan_zip) $(tds_zip)
+
+###############################################################################
+# TARGETS
+###############################################################################
+
+section
+ OMakeFlags(-s)
+ usage:
+ echo "****************************** $(name) ******************************"
+ echo
+ echo "defined targets:"
+ echo " ctan package for CTAN"
+ echo " tds package as TDS directory hierarchy"
+ echo
+ echo " clean remove temporary files"
+ echo " nuke remove all created files"
+ echo
+
+ctan-root:
+ mkdir(-p $(ctan_root))
+
+tds-hier:
+ #printvln(:: $(tds_hier))
+ mkdir(-p $(tds_hier))
+
+buildenv: ctan-root tds-hier
+
+## nuke -- remove the entire build directory and packaged files
+nuke:
+ $(rm -rf -- $(build_root) $(pkgs))
+
+## clean -- leave the build directory, documentation and tarballs intact
+clean:
+ $(rm -rf -- $(tds_dirs) $(ctan_root))
+
+## tds -- package according to TeX directory structure
+tds: $(tds_zip)
+
+## ctan -- package for CTAN upload
+ctan: $(ctan_zip)
+
+$(tds_zip): 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))
+ cd $(build_root) && zip -9 -r ./$(tds_zipfile) $(tds_dirnames)
+
+$(ctan_zip): ctan-root $(tds_zip)
+ $(echo $(name)> packaging as $@ for CTAN upload)
+ cp($(lua_src) $(ctan_root))
+ cp($(script_src) $(ctan_root))
+ cp($(tex_src) $(ctan_root))
+ cp($(doc_src) $(ctan_root))
+ cd $(build_root) && zip -9 -r ./$(ctan_zipfile) $(name) $(tds_zipfile)
+
+.DEFAULT: usage
+
diff --git a/OMakeroot b/OMakeroot
new file mode 100644
index 0000000..8addc9e
--- /dev/null
+++ b/OMakeroot
@@ -0,0 +1,9 @@
+# The command-line variables are defined *after* the
+# standard configuration has been loaded.
+#
+DefineCommandVars()
+
+#
+# Include the OMakefile in this directory.
+#
+.SUBDIRS: .