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 po/nani.pot |
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 jibiki.mk |
13 | include jmdict.mk |
14 | include kanjidic.mk |
15 | include kanjivg.mk |
16 | include radicals.mk |
17 | include wadoku.mk |
18 | |
19 | # Files that constitute the website |
20 | PAGES=blog.scm data.scm documentation.scm e404.scm feeds.scm index.scm mentions.scm |
21 | HAUNT_FILES= haunt.scm $(addprefix pages/, $(PAGES)) \ |
22 | tools/i18n.scm tools/theme.scm |
23 | SHA_DICOS=$(addsuffix .sha256, $(DICOS)) |
24 | WEB_FILES= $(HAUNT_FILES) \ |
25 | $(shell find css) $(shell find images) $(DICOS) $(SHA_DICOS) \ |
26 | dicos/list |
27 | |
28 | # Guile modules used to build dictionaries |
29 | DICO_MODULES= \ |
30 | modules/nani/encoding/huffman.scm \ |
31 | modules/nani/encoding/parse.scm \ |
32 | modules/nani/encoding/serialize.scm \ |
33 | modules/nani/encoding/trie.scm \ |
34 | modules/nani/kanji/radk.scm \ |
35 | modules/nani/pitch/pitch.scm \ |
36 | modules/nani/pitch/wadoku.scm \ |
37 | modules/nani/result/frequency.scm \ |
38 | modules/nani/result/result.scm \ |
39 | modules/nani/result/jibiki.scm \ |
40 | modules/nani/result/jmdict.scm \ |
41 | modules/nani/result/wadoku.scm \ |
42 | |
43 | # Available languages |
44 | LANGS=fr uk zh_CN |
45 | MOFILES=$(addprefix po/, $(addsuffix /LC_MESSAGES/nani.mo, $(LANGS))) |
46 | |
47 | dicos: $(DICOS) $(SHA_DICOS) dicos/list |
48 | |
49 | site: $(MOFILES) $(WEB_FILES) |
50 | haunt build |
51 | rm -rf public.bak |
52 | mv public public.bak |
53 | mv site public |
54 | touch site |
55 | |
56 | download: |
57 | @rm -f dictionaries/* |
58 | @$(MAKE) $(DOWNLOADS) |
59 | |
60 | po/%/LC_MESSAGES/nani.mo: po/%.po |
61 | @mkdir -p $$(dirname $@) |
62 | msgfmt --output-file=$@ $< |
63 | |
64 | po/nani.pot: $(HAUNT_FILES) tools/list.scm |
65 | xgettext --keyword=_ --language=scheme --add-comments --sort-output --from-code UTF-8 -o $@ $^ |
66 | |
67 | %.sha256: % |
68 | sha256sum $< | cut -f1 -d' ' > $@ |
69 | |
70 | dicos/list: $(DICOS) tools/list.scm $(MOFILES) |
71 | rm -f $@ |
72 | guile -L modules -L . tools/list.scm $@ $(DICOS) |
73 |