keyboard/altgr: atari graphics (atascii)
[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 keyboard/symbols/unigraph
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 keyboard/symbols/%: tools/mkxkbsymbols data/keyboard/altgr/%.eng.json
60         $(call cmdsave,$^)
61
62 data/digraphs-vim.inc.pl: tools/mkdigraphs-vim
63         $(call cmdsave,$<)
64
65 data/digraphs-plan9.txt:
66         tools/wget-ifmodified https://9fans.github.io/usr/local/plan9/lib/keyboard $@
67 data/digraphs-plan9.inc.pl: tools/mkdigraphs-plan9 data/digraphs-plan9.txt
68         $(call cmdsave,$^)
69
70 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
71         $(call cmdsave,$<)
72
73 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
74         $(call cmdsave,$<)
75
76 data/font/%.inc.pl: tools/mkttfinfo data/font/%.ttf #TODO ttc
77         $(call cmdsave,$^) || true
78
79 data/unicode-sampler: $(download)
80         $(call gitsave,git://git.shiar.nl/unicode-sampler)
81
82 data/xcolors/themes: data/xcolors
83 data/xcolors: $(download)
84         $(call gitsave,https://github.com/tlatsas/xcolors)
85
86 data/termcol-xcolor.inc.pl: tools/mktermcol-xcolor data/xcolors/themes
87         $(call cmdsave,$^/*)
88
89 data/wordlist.version.txt: force
90         @[ -e $@ ] || date -Is >$@
91         tools/lastword $@ || true
92
93 data/wordlist.%.inc.pl: tools/mkwordlist data/wordlist.version.txt
94         $(call cmdsave,$< $*)
95 data/word%.json: data/word%.inc.pl
96         $(call cmdsave,tools/mkjson $<)
97 data/%.json: %.inc.pl
98         $(call cmdsave,tools/mkjson $<)
99
100 data/wordpairs.inc.pl: data/wordlist.version.txt
101         tools/wordpairs >$@
102
103 .SECONDARY: data/font/%.ttf
104 data/font/%.ttf:
105         find /usr/share/fonts/truetype/ ~/.fonts/ -iname "$(@F)" | head -1 | xargs -i ln -sf {} $@
106 data/font/%.win2k.ttf:
107         find /usr/share/fonts/truetype/msttcorefonts/ -iname "$(*F).ttf" | head -1 | xargs -i ln -sf {} $@
108 data/font/dv%.ttf:
109         find /usr/share/fonts/truetype/dejavu/ -iname "DejaVu*$(*F).ttf" | head -1 | xargs -i ln -sf {} $@
110 data/font/droid%.ttf:
111         find /usr/share/fonts/truetype/droid/ -iname "Droid*$(*F).ttf" | head -1 | xargs -i ln -sf {} $@
112 data/font/droidserif.ttf:
113         ln -sf /usr/share/fonts/truetype/droid/DroidSerif-Regular.ttf $@
114 data/font/free%.ttf:
115         find /usr/share/fonts/truetype/freefont/ -iname "$(@F)" | head -1 | xargs -i ln -sf {} $@
116 data/font/roboto.ttf:
117         ln -sf /usr/share/fonts/truetype/roboto/unhinted/RobotoTTF/Roboto-Regular.ttf $@
118 data/font/noto%.ttf:
119         find /usr/share/fonts/truetype/noto/ -iname "Noto$(*F)-Regular.ttf" | head -1 | xargs -i ln -sf {} $@
120
121 data/font: tools/mkttfinfo
122         mkdir -p $@
123         $(MAKE) data/font/all
124         touch $@
125
126 data/font/all: data/font/all-win2k data/font/all-dejavu data/font/all-google data/font/all-other
127 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
128 data/font/all-dejavu: data/font/dvsans.inc.pl data/font/dvserif.inc.pl data/font/dvmono.inc.pl
129 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
130 data/font/all-other: data/font/unifont.inc.pl data/font/code2000.inc.pl data/font/freesans.inc.pl data/font/freeserif.inc.pl
131
132 #data/font/unifont.inc.pl: tools/mkttfinfo
133 #       $< unifont.ttf $@
134 #       $< --headless unifont_upper.ttf >>$@
135
136 data/unicode-cover.inc.pl: tools/mkfontinfo data/font # $(wildcard data/font/*.inc.pl)
137         $(call cmdsave,$<)
138
139 data/countryInfo.txt: $(download)
140         tools/wget-ifmodified http://download.geonames.org/export/dump/$(@F) $@
141
142 data/countries.inc.pl: tools/mkcountries-geonames data/countryInfo.txt
143         $(call cmdsave,$^)
144
145 data/browser: data/browser/support.inc.pl data/browser/usage-wm.inc.pl
146
147 data/browser/caniuse/fulldata-json/data-2.0.json: data/browser/caniuse
148 data/browser/caniuse/data.json: data/browser/caniuse
149 data/browser/caniuse: $(download)
150         $(call gitsave,https://github.com/Fyrd/caniuse.git)
151
152 data/browser/support.inc.pl: tools/mkcaniuse data/browser/caniuse/fulldata-json/data-2.0.json
153         $(call cmdsave,$^)
154
155 data/browser/usage-wm.tsv: $(download)
156         tools/wget-ifmodified https://analytics.wikimedia.org/datasets/periodic/reports/metrics/browser/all_sites_by_browser_family_and_major_percent.tsv $@
157
158 data/browser/usage-wm.inc.pl: tools/mkusage-wikimedia data/browser/usage-wm.tsv
159         $(call cmdsave,$^)
160
161 clean:
162         -rm data/digraphs.json
163         -rm data/unicode-char.inc.pl
164         -rm data/unicode-age.inc.pl
165         -rm -rf data/font/
166         -rm data/unicode-cover.inc.pl
167         -rm data/browser/support.inc.pl
168         -rm data/browser/usage-wm.inc.pl
169