-
Notifications
You must be signed in to change notification settings - Fork 55
/
Makefile
executable file
·68 lines (49 loc) · 2.04 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/make -f
# Makefile to build translations
# Languages which we translate
LANGUAGES=bn it pl ja fr cs gl sv nl ka tr fi ca hr hu nb es de lt ro mn pt_BR pt_PT zh_CN zh_TW hy en_GB rcf si sk sl el da ar bs az et fy sq eo id ko uk ru mk vi
# Documentation source dir
SOURCE_DIR=phpmyadmin/docs/
SPHINXOPTS=
# Names of pages, this is hardcoded to allow ordering
SOURCES=$(wildcard $(SOURCE_DIR)*.rst)
PAGES=$(basename $(notdir $(SOURCES)))
# Name of Gettext templates
TEMPLATES=$(addprefix locale/,$(addsuffix .pot,$(PAGES)))
# Symlinked fake mo files
FAKE_MOFILES=$(foreach lang,$(LANGUAGES),$(addsuffix .mo, $(addprefix translated/$(lang)/LC_MESSAGES/, $(PAGES))))
POFILES=$(addsuffix .po, $(addprefix po/,$(LANGUAGES)))
MOFILES=$(addsuffix .mo, $(addprefix po/,$(LANGUAGES)))
INDEXFILES=$(addsuffix /index.html, $(addprefix output/,$(LANGUAGES)))
CONFIGS=$(addsuffix /conf.py, $(addprefix docs/,$(LANGUAGES)))
all: $(FAKE_MOFILES) $(MOFILES) $(CONFIGS)
SECONDARY: $(POFILES) $(INDEXFILES)
.phony: all html $(addprefix html-,$(LANGUAGES))
docs/%/conf.py: $(SOURCE_DIR)conf.py Makefile $(SOURCES)
@mkdir -p docs/$*
@cd docs/$* && ln -sf ../../$(SOURCE_DIR)* .
@rm -f $@
@sed 's/#language = None/language = "$*"\nlocale_dirs = ["..\/..\/translated\/"]/' $< > $@
locale/%.pot: $(SOURCES)
@make -C $(SOURCE_DIR) gettext BUILDDIR=`pwd`
po/documentation.pot: $(TEMPLATES)
@echo "UPDATE $@"
@msgcat -o $@ $(TEMPLATES)
@sed -i 's/Report-Msgid-Bugs-To: [^"]*/Report-Msgid-Bugs-To: [email protected]\\n/' $@
po/%.po: po/documentation.pot phpmyadmin/po/%.po
@echo "UPDATE $@"
@if [ ! -f $@ ] ; then msginit --no-translator -i $< -o $@ ; fi
@msgmerge --previous -U $@ -C phpmyadmin/$@ $<
po/%.mo: po/%.po
@echo "GEN $@"
@msgfmt $< -o $@
translated/%.mo:
@mkdir -p $(dir $@)
@ln -sf ../../../po/`echo $@ | sed 's@translated/\(.*\)/LC_MESSAGES.*@\1@'`.mo $@
html: $(addprefix html-,$(LANGUAGES))
html-%: output/%/index.html
@echo -n
output/%/index.html: po/%.mo
@echo "HTML $*"
@mkdir -p "output/$*"
@sphinx-build $(SPHINXOPTS) docs/$*/ output/$*