aboutsummaryrefslogtreecommitdiff
path: root/Makefile.common
diff options
context:
space:
mode:
authorFelix Hanley <felix@userspace.com.au>2016-01-26 15:45:03 +0000
committerFelix Hanley <felix@userspace.com.au>2016-01-26 15:45:03 +0000
commit9badee896f1e4257e12393019720dc3e33b5ef06 (patch)
tree6faba8bc3b994ff85d81320dca3e987ba6547e5a /Makefile.common
parentb39283c2419d947a2e662cd347e0987a401c1d28 (diff)
downloadlahu-dictionary-9badee896f1e4257e12393019720dc3e33b5ef06.tar.gz
lahu-dictionary-9badee896f1e4257e12393019720dc3e33b5ef06.tar.bz2
Clean up XSLT files so I can read them. Add Makefiles
Diffstat (limited to 'Makefile.common')
-rw-r--r--Makefile.common46
1 files changed, 46 insertions, 0 deletions
diff --git a/Makefile.common b/Makefile.common
new file mode 100644
index 0000000..e697f31
--- /dev/null
+++ b/Makefile.common
@@ -0,0 +1,46 @@
+xsldir ?= $(BASEDIR)/xsl
+
+DICTFMTFLAGS += --utf8
+XSLTPROCESSOR ?= xsltproc -novalid
+
+SHELL=bash
+
+date=$(shell date +%G-%m-%d)
+
+empty:=
+space:= $(empty) $(empty)
+version1 := $(shell sed -e '100q;/<edition>/!d;s/.*<edition>\(.*\)<\/edition>.*/\1/;q'\
+ $(wildcard $(dictname).tei*))
+version := $(subst $(space),_,$(version1))
+
+all:
+ $(MAKE) dict
+
+sorted.tei: $(dictname).tei $(xsldir)/sort.xsl
+ $(XSLTPROCESSOR) $(xsldir)/sort.xsl $< >$@
+
+$(dictname).c5: sorted.tei $(xsldir)/tei2c5.xsl \
+ $(xsldir)/inc/teientry2txt.xsl \
+ $(xsldir)/inc/teiheader2txt.xsl \
+ $(xsldir)/inc/indent.xsl
+ $(XSLTPROCESSOR) --xinclude --stringparam current-date $(date) $(xsldir)/tei2c5.xsl $< >$@
+
+%.dict %.index: %.c5
+ dictfmt -t --headword-separator %%% $(DICTFMTFLAGS) $* <$<
+
+%.dz: %
+ dictzip -k $<
+
+%.tar.gz: %.dict.dz %.index
+ tar czf $*.tar.gz $*.dict.dz $*.index
+
+dict: $(dictname).tar.gz
+
+clean:
+ rm -f $(dictname).index $(dictname).dict
+ rm -f $(dictname).c5 $(dictname).dict.dz
+ rm -f $(dictname).tar.gz sorted.tei
+
+.DELETE_ON_ERROR:
+
+.PHONY: all clean