Debian Codegraph @

build/makefiles/gettext.am

raw
1 include $(top_srcdir)/doc/files.am
2 include $(top_srcdir)/build/makefiles/sphinx-build.am
3
4 CLEANFILES =
5
6 EXTRA_DIST += \
7 $(po_files)
8
9 if DOCUMENT_AVAILABLE
10 EXTRA_DIST += \
11 $(mo_files)
12 endif
13
14 if DOCUMENT_BUILDABLE
15 BUILT_SOURCES += \
16 mo-build-stamp
17 CLEANFILES += \
18 pot-build-stamp \
19 edit-po-build-stamp \
20 mo-build-stamp
21 endif
22
23 SUFFIXES += .pot .po .mo .edit
24
25 .PHONY: gettext update build
26
27 .pot.edit:
28 if test -f $(srcdir)/$*.po; then \
29 msgmerge \
30 --quiet \
31 --sort-by-file \
32 [email protected] \
33 --no-wrap \
34 $(srcdir)/$*.po \
35 $<; \
36 else \
37 msginit \
38 --input=$< \
39 [email protected] \
40 --locale=$(LOCALE) \
41 --no-translator \
42 --no-wrap; \
43 fi
44 (echo "# -*- po -*-"; \
45 GREP_OPTIONS= grep -v '^# -\*- po -\*-' [email protected] | \
46 GREP_OPTIONS= grep -v '^"POT-Creation-Date:') > $@
47 rm [email protected]
48
49 .edit.po:
50 grep -v '^#~' $< > $<.no-comment
51 mkdir -p $$(dirname $(srcdir)/$@)
52 msgattrib --no-fuzzy --no-location --no-wrap --output $(srcdir)/$@ $<.no-comment
53 rm $<.no-comment
54
55 .po.mo:
56 msgfmt -o $@ $(srcdir)/$<
57
58 if DOCUMENT_BUILDABLE
59 update: edit-po-build-stamp
60 build: mo-build-stamp
61 else
62 update:
63 build:
64 endif
65
66 html: build
67 text: build
68 markdown: build
69
70 gettext:
71 rm *.pot || true
72 $(SPHINX_BUILD_COMMAND) -d doctrees -b gettext $(ALLSPHINXOPTS) .
73 xgettext --language Python --output conf.pot \
74 $(top_srcdir)/doc/source/conf.py
75
76 pot-build-stamp: $(absolute_source_files)
77 $(MAKE) gettext
78 @touch $@
79
80 edit-po-build-stamp: pot-build-stamp
81 $(MAKE) $(edit_po_files)
82 @touch $@
83
84 mo_build_stamp_dependencies = edit-po-build-stamp
85 if DOCUMENT_BUILDABLE
86 mo_build_stamp_dependencies += $(edit_po_files)
87 endif
88
89 mo-build-stamp: $(mo_build_stamp_dependencies)
90 $(MAKE) $(mo_files)
91 @touch $@