index: release v1.18 with only altgr index linked
[sheet.git] / Makefile
1 all: sitemap.xml light.css plan.plp UPDATE data cache
2
3 .PHONY: force # applied to download after 2 hours
4 download := $(shell [ -z $$(find data/download -mmin -120) ] && (touch data/download && echo force))
5
6 # atomically create file by command
7 cmdsave = @echo '$1' $2 \>$@; mispipe '$1 $2' 'ifne sponge $@'
8 # download git checkout
9 gitsave = @if cd $@ 2>/dev/null; \
10         then echo git pull $@; git pull -q --ff-only || true; \
11         else echo git clone $1 $@; git clone -q --progress $1 $@; fi
12
13 sitemap.xml: tools/mksitemap
14         $(call cmdsave,$<)
15
16 light.css: tools/stripcss base.css
17         $(call cmdsave,$^)
18
19 plan.plp: TODO
20         kramdown $< >$@
21
22 UPDATE: $(download)
23         $(call cmdsave,git log -1 --date=short --pretty="%ad    %s")
24
25 cache: $(patsubst %.inc.pl,data/%.json,$(wildcard charset-*.inc.pl) $(wildcard keyboard/altgr/*.inc.pl) writing-latn.inc.pl)
26 word: word/put.min.js data/wordlist.en.json data/wordlist.nl.json data/wordlist.ru.json data/wordpairs.json
27
28 word/put.js: $(download)
29         tools/wget-ifmodified https://github.com/kriszyp/put-selector/raw/master/put.js $@
30 word/%.min.js: word/%.js
31         uglifyjs -m '' $< -o $@
32
33 data: data/digraphs.json data/unicode-cover.inc.pl data/countries.inc.pl data/browser data/termcol-xcolor.inc.pl data/digraphs-xorg.json data/unicode-sampler word
34
35 data/DerivedAge.txt: $(download)
36         tools/wget-ifmodified http://www.unicode.org/Public/UNIDATA/$(@F) $@
37
38 data/unicode-age.inc.pl: tools/mkcharver data/DerivedAge.txt
39         $(call cmdsave,$^)
40
41 data/rfc1345.txt: $(download)
42         tools/wget-ifmodified http://www.ietf.org/rfc/$(@F) $@
43
44 data/digraphs-rfc.inc.pl: tools/mkdigraphs-rfc data/rfc1345.txt
45         $(call cmdsave,$^)
46
47 data/digraphs-shiar.inc.pl: tools/mkdigraphs-shiar shiar.inc.txt
48         $(call cmdsave,$^)
49
50 data/xorg-compose: $(download)
51         tools/wget-ifmodified http://gitlab.freedesktop.org/xorg/lib/libx11/-/raw/master/nls/en_US.UTF-8/Compose.pre $@
52 data/keysymdef.h: $(download)
53         tools/wget-ifmodified http://gitlab.freedesktop.org/xorg/proto/xorgproto/-/raw/master/include/X11/$(@F) $@
54 data/keysymdef.json: tools/mkxkeysymdef data/keysymdef.h
55         $(call cmdsave,$^)
56 data/digraphs-xorg.json: tools/mkdigraphs-xorg data/xorg-compose data/keysymdef.json
57         $(call cmdsave,$^)
58
59 data/digraphs-vim.inc.pl: tools/mkdigraphs-vim
60         $(call cmdsave,$<)
61
62 data/digraphs-plan9.txt:
63         tools/wget-ifmodified https://9fans.github.io/usr/local/plan9/lib/keyboard $@
64 data/digraphs-plan9.inc.pl: tools/mkdigraphs-plan9 data/digraphs-plan9.txt
65         $(call cmdsave,$^)
66
67 data/digraphs.json: tools/mkdigraphlist data/digraphs-rfc.inc.pl data/digraphs-vim.inc.pl data/digraphs-shiar.inc.pl data/unicode-char.inc.pl
68         $(call cmdsave,$<)
69
70 data/unicode-char.inc.pl: tools/mkcharinfo data/digraphs-rfc.inc.pl data/digraphs-shiar.inc.pl data/unicode-age.inc.pl unicode-table.inc.pl
71         $(call cmdsave,$<)
72
73 data/font/%.inc.pl: tools/mkttfinfo data/font/%.ttf #TODO ttc
74         $(call cmdsave,$^) || true
75
76 data/unicode-sampler: $(download)
77         $(call gitsave,git://git.shiar.nl/unicode-sampler)
78
79 data/xcolors/themes: data/xcolors
80 data/xcolors: $(download)
81         $(call gitsave,https://github.com/tlatsas/xcolors)
82
83 data/termcol-xcolor.inc.pl: tools/mktermcol-xcolor data/xcolors/themes
84         $(call cmdsave,$^/*)
85
86 data/wordlist.version.txt: force
87         @[ -e $@ ] || date -Is >$@
88         tools/lastword $@ || true
89
90 data/wordlist.%.inc.pl: tools/mkwordlist data/wordlist.version.txt
91         $(call cmdsave,$< $*)
92 data/word%.json: data/word%.inc.pl
93         $(call cmdsave,tools/mkjson $<)
94 data/%.json: %.inc.pl
95         $(call cmdsave,tools/mkjson $<)
96
97 data/wordpairs.inc.pl: data/wordlist.version.txt
98         tools/wordpairs >$@
99
100 .SECONDARY: data/font/%.ttf
101 data/font/%.ttf:
102         find /usr/share/fonts/truetype/ ~/.fonts/ -iname "$(@F)" | head -1 | xargs -i ln -sf {} $@
103 data/font/%.win2k.ttf:
104         find /usr/share/fonts/truetype/msttcorefonts/ -iname "$(*F).ttf" | head -1 | xargs -i ln -sf {} $@
105 data/font/dv%.ttf:
106         find /usr/share/fonts/truetype/dejavu/ -iname "DejaVu*$(*F).ttf" | head -1 | xargs -i ln -sf {} $@
107 data/font/droid%.ttf:
108         find /usr/share/fonts/truetype/droid/ -iname "Droid*$(*F).ttf" | head -1 | xargs -i ln -sf {} $@
109 data/font/droidserif.ttf:
110         ln -sf /usr/share/fonts/truetype/droid/DroidSerif-Regular.ttf $@
111 data/font/free%.ttf:
112         find /usr/share/fonts/truetype/freefont/ -iname "$(@F)" | head -1 | xargs -i ln -sf {} $@
113 data/font/roboto.ttf:
114         ln -sf /usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Regular.ttf $@
115 data/font/noto%.ttf:
116         find /usr/share/fonts/truetype/noto/ -iname "Noto$(*F)-Regular.ttf" | head -1 | xargs -i ln -sf {} $@
117
118 data/font: tools/mkttfinfo
119         mkdir -p $@
120         $(MAKE) data/font/all
121         touch $@
122
123 data/font/all: data/font/all-win2k data/font/all-dejavu data/font/all-google data/font/all-other
124 data/font/all-win2k: data/font/verdana.win2k.inc.pl data/font/times.win2k.inc.pl data/font/arial.win2k.inc.pl data/font/cour.win2k.inc.pl data/font/comic.win2k.inc.pl data/font/georgia.win2k.inc.pl data/font/arialuni.inc.pl
125 data/font/all-dejavu: data/font/dvsans.inc.pl data/font/dvserif.inc.pl data/font/dvmono.inc.pl
126 data/font/all-google: data/font/droidsans.inc.pl data/font/droidserif.inc.pl data/font/droidmono.inc.pl data/font/roboto.inc.pl data/font/notosans.inc.pl data/font/notoserif.inc.pl
127 data/font/all-other: data/font/unifont.inc.pl data/font/code2000.inc.pl data/font/freesans.inc.pl data/font/freeserif.inc.pl
128
129 #data/font/unifont.inc.pl: tools/mkttfinfo
130 #       $< unifont.ttf $@
131 #       $< --headless unifont_upper.ttf >>$@
132
133 data/unicode-cover.inc.pl: tools/mkfontinfo data/font # $(wildcard data/font/*.inc.pl)
134         $(call cmdsave,$<)
135
136 data/countryInfo.txt: $(download)
137         tools/wget-ifmodified http://download.geonames.org/export/dump/$(@F) $@
138
139 data/countries.inc.pl: tools/mkcountries-geonames data/countryInfo.txt
140         $(call cmdsave,$^)
141
142 data/browser: data/browser/support.inc.pl data/browser/usage-wm.inc.pl
143
144 data/browser/caniuse/fulldata-json/data-2.0.json: data/browser/caniuse
145 data/browser/caniuse/data.json: data/browser/caniuse
146 data/browser/caniuse: $(download)
147         $(call gitsave,https://github.com/Fyrd/caniuse.git)
148
149 data/browser/support.inc.pl: tools/mkcaniuse data/browser/caniuse/fulldata-json/data-2.0.json
150         $(call cmdsave,$^)
151
152 data/browser/usage-wm.tsv: $(download)
153         tools/wget-ifmodified https://analytics.wikimedia.org/datasets/periodic/reports/metrics/browser/all_sites_by_browser_family_and_major_percent.tsv $@
154
155 data/browser/usage-wm.inc.pl: tools/mkusage-wikimedia data/browser/usage-wm.tsv
156         $(call cmdsave,$^)
157
158 clean:
159         -rm data/digraphs.json
160         -rm data/unicode-char.inc.pl
161         -rm data/unicode-age.inc.pl
162         -rm -rf data/font/
163         -rm data/unicode-cover.inc.pl
164         -rm data/browser/support.inc.pl
165         -rm data/browser/usage-wm.inc.pl
166