Makefile
1 | # keep po files, even if they are sometimes generated, and keep downloaded dictionaries around |
2 | .PRECIOUS: po/%.po dictionaries/% |
3 | |
4 | all: site |
5 | |
6 | # To be filled by included files |
7 | # DICOS is the list of generated dictionaries |
8 | # DOWNLOADS is the list of downloaded files |
9 | DICOS= |
10 | DOWNLOADS= |
11 | |
12 | include radicals.mk |
13 | include wadoku.mk |
14 | include jmdict.mk |
15 | include jibiki.mk |
16 | |
17 | # Files that constitute the website |
18 | PAGES=blog.scm data.scm documentation.scm e404.scm feeds.scm index.scm mentions.scm |
19 | HAUNT_FILES= haunt.scm $(addprefix pages/, $(PAGES)) \ |
20 | tools/i18n.scm tools/theme.scm |
21 | SHA_DICOS=$(addsuffix .sha256, $(DICOS)) |
22 | WEB_FILES= $(HAUNT_FILES) \ |
23 | $(shell find css) $(shell find images) $(DICOS) $(SHA_DICOS) \ |
24 | dicos/list |
25 | |
26 | # Guile modules used to build dictionaries |
27 | DICO_MODULES= \ |
28 | modules/nani/encoding/huffman.scm \ |
29 | modules/nani/encoding/parse.scm \ |
30 | modules/nani/encoding/serialize.scm \ |
31 | modules/nani/encoding/trie.scm \ |
32 | modules/nani/kanji/radk.scm \ |
33 | modules/nani/pitch/pitch.scm \ |
34 | modules/nani/pitch/wadoku.scm \ |
35 | modules/nani/result/frequency.scm \ |
36 | modules/nani/result/result.scm \ |
37 | modules/nani/result/jibiki.scm \ |
38 | modules/nani/result/jmdict.scm \ |
39 | modules/nani/result/wadoku.scm \ |
40 | |
41 | # Available languages |
42 | LANGS=fr uk zh_CN |
43 | MOFILES=$(addprefix po/, $(addsuffix /LC_MESSAGES/nani.mo, $(LANGS))) |
44 | |
45 | dicos: $(DICOS) $(SHA_DICOS) dicos/list |
46 | |
47 | site: $(MOFILES) $(WEB_FILES) |
48 | haunt build |
49 | rm -rf public.bak |
50 | mv public public.bak |
51 | mv site public |
52 | touch site |
53 | |
54 | download: |
55 | @rm -f dictionaries/* |
56 | @$(MAKE) $(DOWNLOADS) |
57 | |
58 | po/%/LC_MESSAGES/nani.mo: po/%.po |
59 | @mkdir -p $$(dirname $@) |
60 | msgfmt --output-file=$@ $< |
61 | |
62 | po/%.po: po/nani.pot |
63 | if [ -f $@ ]; then \ |
64 | msgmerge --update $@ $< ;\ |
65 | else \ |
66 | msginit --input=$< --locale=$$(printf $$(basename $@) | sed 's|.po$$||') --output=$@ ;\ |
67 | fi |
68 | |
69 | po/nani.pot: $(HAUNT_FILES) tools/list.scm |
70 | xgettext --keyword=_ --language=scheme --add-comments --sort-output --from-code UTF-8 -o $@ $^ |
71 | |
72 | %.sha256: % |
73 | sha256sum $< | cut -f1 -d' ' > $@ |
74 | |
75 | dicos/list: $(DICOS) tools/list.scm $(MOFILES) |
76 | guile -L modules -L . tools/list.scm $@ $(DICOS) |
77 |