word/memory: card game to find matching pairs
[sheet.git] / Makefile
index be3a2d8a1c07ac52ecc7e5b9eab71a382de9dbb6..0742e97654e9cd629c1ef3f6c4ecf9f4b10511e3 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-all: sitemap.xml light.css data/digraphs.inc.pl data/unicode-cover.inc.pl data/countries.inc.pl data/browser data/termcol-xcolor.inc.pl data/digraphs-xorg.inc.pl
+all: sitemap.xml light.css data/digraphs.inc.pl data/unicode-cover.inc.pl data/countries.inc.pl data/browser data/termcol-xcolor.inc.pl data/digraphs-xorg.inc.pl word
 more: all
 
 .PHONY: force # applied to download after 2 hours
@@ -17,6 +17,11 @@ sitemap.xml: tools/mksitemap
 light.css: tools/stripcss base.css
        $(call cmdsave,$^)
 
+word: word/put.js data/wordlist.en.json data/wordlist.nl.json data/wordlist.ru.json data/wordpairs.json
+
+word/put.js: $(download)
+       tools/wget-ifmodified https://github.com/kriszyp/put-selector/raw/master/put.js $@
+
 data/DerivedAge.txt: $(download)
        tools/wget-ifmodified http://www.unicode.org/Public/UNIDATA/$(@F) $@
 
@@ -68,6 +73,11 @@ data/wordlist.en.inc.pl: tools/mkwordlist data/wordlist.version.txt
        $(call cmdsave,$<)
 data/wordlist.%.inc.pl: tools/mkwordlist data/wordlist.version.txt
        $(call cmdsave,$< $*)
+data/word%.json: data/word%.inc.pl
+       $(call cmdsave,perl -MJSON=encode_json -E "print encode_json(do \$$ARGV[0])" ./$<)
+
+data/wordpairs.inc.pl: data/wordlist.version.txt
+       @perl -I. -MShiar_Sheet::DB -MData::Dump=pp -E 'say pp(Shiar_Sheet::DB->connect->select("word w JOIN word a ON w.id=a.ref" => "w.id, a.id", {"a.lang"=>undef})->map or exit 1)' >$@
 
 .SECONDARY: data/font/%.ttf
 data/font/%.ttf: