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