Makefile
1 | .PRECIOUS: po/%.po dictionaries/% |
2 | |
3 | JMDICT_LANGS=dut fre ger hun rus slv spa swe |
4 | |
5 | DICOS=dicos/JMdict_e.nani $(addprefix dicos/JMdict_, $(addsuffix .nani, $(JMDICT_LANGS))) |
6 | |
7 | PAGES=blog.scm e404.scm feeds.scm index.scm mentions.scm |
8 | |
9 | HAUNT_FILES= haunt.scm $(addprefix pages/, $(PAGES)) \ |
10 | tools/i18n.scm tools/theme.scm |
11 | |
12 | WEB_FILES= $(HAUNT_FILES) \ |
13 | $(shell find css) $(shell find images) $(DICOS) \ |
14 | |
15 | DICO_MODULES=modules/nani/trie.scm modules/nani/result.scm modules/nani/jmdict/trie.scm \ |
16 | modules/nani/jmdict/serialize.scm modules/nani/jmdict/xml.scm \ |
17 | modules/nani/jmdict/entities.scm |
18 | |
19 | all: po/fr/LC_MESSAGES/nani.mo po/eo/LC_MESSAGES/nani.mo $(WEB_FILES) |
20 | haunt build |
21 | rm -rf public.bak |
22 | mv public public.bak |
23 | mv site public |
24 | touch all |
25 | |
26 | download: |
27 | @rm -f dictionaries/* |
28 | @$(MAKE) dictionaries/JMdic_e.xml dictionaries/JMdic.xml |
29 | |
30 | dictionaries/%.xml: |
31 | wget http://ftp.monash.edu/pub/nihongo/$(shell basename $<).gz -O $<.gz |
32 | gunzip $<.gz |
33 | sed -i -e 's|<|\&\<;|g' -e 's|>|\&\>;|g' $< |
34 | sed -i -e 's|&\([^;]\+\);|\1|g' $< |
35 | cp $< $@ |
36 | |
37 | dictionaries/%.sxml: dictionaries/%.xml tools/jmdict.scm |
38 | guile -L modules tools/jmdict.scm convert $< nolang $@ |
39 | |
40 | dicos/JMdict_%.nani: dictionaries/JMdict.sxml tools/jmdict.scm $(DICO_MODULES) |
41 | guile -L modules tools/jmdict.scm build \ |
42 | $< $(shell echo $@ | sed 's|^.*_\([^.]*\)\..*$$|\1|g') $@ |
43 | |
44 | dicos/JMdict_e.nani: dictionaries/JMdict_e.sxml tools/jmdict.scm $(DICO_MODULES) |
45 | guile -L modules tools/jmdict.scm build $< e $@ |
46 | |
47 | po/%/LC_MESSAGES/nani.mo: po/%.po |
48 | @mkdir -p $$(dirname $@) |
49 | msgfmt --output-file=$@ $< |
50 | |
51 | po/%.po: po/nani.pot |
52 | if [ -f $@ ]; then \ |
53 | msgmerge --update $@ $< ;\ |
54 | else \ |
55 | msginit --input=$< --locale=$$(printf $$(basename $@) | sed 's|.po$$||') --output=$@ ;\ |
56 | fi |
57 | |
58 | po/nani.pot: $(HAUNT_FILES) |
59 | xgettext --keyword=_ --language=scheme --add-comments --sort-output --from-code UTF-8 -o $@ $^ |
60 |