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=modules/nani/trie.scm modules/nani/result.scm modules/nani/jmdict/trie.scm \ |
28 | modules/nani/jmdict/serialize.scm modules/nani/jmdict/xml.scm \ |
29 | modules/nani/jmdict/entities.scm modules/nani/frequency.scm \ |
30 | modules/nani/serialize.scm |
31 | |
32 | # Available languages |
33 | LANGS=fr uk |
34 | MOFILES=$(addprefix po/, $(addsuffix /LC_MESSAGES/nani.mo, $(LANGS))) |
35 | |
36 | dicos: $(DICOS) $(SHA_DICOS) dicos/list |
37 | |
38 | site: $(MOFILES) $(WEB_FILES) |
39 | haunt build |
40 | rm -rf public.bak |
41 | mv public public.bak |
42 | mv site public |
43 | touch site |
44 | |
45 | download: |
46 | @rm -f dictionaries/* |
47 | @$(MAKE) $(DOWNLOADS) |
48 | |
49 | po/%/LC_MESSAGES/nani.mo: po/%.po |
50 | @mkdir -p $$(dirname $@) |
51 | msgfmt --output-file=$@ $< |
52 | |
53 | po/%.po: po/nani.pot |
54 | if [ -f $@ ]; then \ |
55 | msgmerge --update $@ $< ;\ |
56 | else \ |
57 | msginit --input=$< --locale=$$(printf $$(basename $@) | sed 's|.po$$||') --output=$@ ;\ |
58 | fi |
59 | |
60 | po/nani.pot: $(HAUNT_FILES) tools/list.scm |
61 | xgettext --keyword=_ --language=scheme --add-comments --sort-output --from-code UTF-8 -o $@ $^ |
62 | |
63 | %.sha256: % |
64 | sha256sum $< | cut -f1 -d' ' > $@ |
65 | |
66 | dicos/list: $(DICOS) tools/list.scm $(MOFILES) |
67 | guile -L modules -L . tools/list.scm $@ $(DICOS) |
68 |