Rev 56 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 56 | Rev 189 | ||
|---|---|---|---|
| 1 | # Makefile for various po files. |
1 | # Makefile for various po files. |
| 2 | 2 | ||
| 3 | srcdir = . |
3 | srcdir = . |
| 4 | libdir = .. |
4 | targetdir= ./LocaleData |
| 5 | 5 | ||
| 6 | #CATALOGS = $(addsuffix .po, LINGUAS) |
6 | #CATALOGS = $(addsuffix .po, LINGUAS) |
| 7 | CATALOGS = $(LINGUAS) |
7 | CATALOGS = $(LINGUAS) |
| 8 | MO_FILES = $(addsuffix .mo, $(LINGUAS)) |
8 | MO_FILES = $(addsuffix .mo, $(LINGUAS)) |
| 9 | 9 | ||
| 10 | MSGMERGE = msgmerge |
10 | MSGMERGE = msgmerge |
| 11 | MSGFMT = msgfmt |
11 | MSGFMT = msgfmt |
| 12 | XGETTEXT = xgettext |
12 | XGETTEXT = xgettext |
| 13 | CATOBJEXT = .po |
13 | CATOBJEXT = .po |
| 14 | 14 | ||
| 15 | include PACKAGE |
15 | include PACKAGE |
| 16 | 16 | ||
| 17 | TD = $(strip $(TEXTDOMAIN)) |
17 | TD = $(strip $(TEXTDOMAIN)) |
| 18 | 18 | ||
| 19 | default: help |
19 | default: help |
| 20 | 20 | ||
| 21 | all: $(TD).pot update-po update-mo install |
21 | all: $(TD).pot update-po update-mo install |
| 22 | 22 | ||
| 23 | help: |
23 | help: |
| 24 | @echo "Available targets:" |
24 | @echo "Available targets:" |
| 25 | @echo " pot - remake master catalog" |
25 | @echo " pot - remake master catalog" |
| 26 | @echo " update-po - merge po files" |
26 | @echo " update-po - merge po files" |
| 27 | @echo " update-mo - regenerate mo files" |
27 | @echo " update-mo - regenerate mo files" |
| 28 | @echo " install - install mo files" |
28 | @echo " install - install mo files" |
| 29 | @echo " all - all of the above" |
29 | @echo " all - all of the above" |
| 30 | 30 | ||
| 31 | POTFILES = $(srcdir)/POTFILES.in \ |
31 | POTFILES = $(srcdir)/POTFILES.in \ |
| 32 | $(shell cat $(srcdir)/POTFILES.in) |
32 | $(shell cat $(srcdir)/POTFILES.in) |
| 33 | 33 | ||
| 34 | pot: $(TD).pot |
34 | pot: $(TD).pot |
| 35 | 35 | ||
| 36 | clean: |
36 | clean: |
| 37 | rm -f *~ *.bak *.mo |
37 | rm -f *~ *.bak *.mo |
| 38 | 38 | ||
| 39 | # FIXME: The parameter --from-code is only needed if your sources contain |
39 | # FIXME: The parameter --from-code is only needed if your sources contain |
| 40 | # any 8 bit data (even in comments). UTF-8 is only a guess here, but it |
40 | # any 8 bit data (even in comments). UTF-8 is only a guess here, but it |
| 41 | # will at least accept any 8 bit data. |
41 | # will at least accept any 8 bit data. |
| 42 | # |
42 | # |
| 43 | # The parameter "--language=perl" is not strictly needed because the |
43 | # The parameter "--language=perl" is not strictly needed because the |
| 44 | # source language of all our files will be auto-detected by xgettext |
44 | # source language of all our files will be auto-detected by xgettext |
| 45 | # by their filename extension. You should even avoid this parameter |
45 | # by their filename extension. You should even avoid this parameter |
| 46 | # if you want to extract strings from multiple source languages. |
46 | # if you want to extract strings from multiple source languages. |
| 47 | # --keyword --keyword='_' --keyword='$$__' --keyword=__ --keyword=__x \ |
47 | # --keyword --keyword='_' --keyword='$$__' --keyword=__ --keyword=__x \ |
| 48 | # --keyword=__n:1,2 --keyword=__nx:1,2 --keyword=__xn:1,2 \ |
48 | # --keyword=__n:1,2 --keyword=__nx:1,2 --keyword=__xn:1,2 \ |
| 49 | # --keyword=__p:1c,2 --keyword=__np:1c,2,3 \ |
49 | # --keyword=__p:1c,2 --keyword=__np:1c,2,3 \ |
| 50 | # --keyword=__npx:1c,2,3 --keyword=N__ --keyword=N__n:1,2 \ |
50 | # --keyword=__npx:1c,2,3 --keyword=N__ --keyword=N__n:1,2 \ |
| 51 | # --keyword=N__p:1c,2 --keyword=N__np:1c,2,3 --keyword=%__ \ |
51 | # --keyword=N__p:1c,2 --keyword=N__np:1c,2,3 --keyword=%__ \ |
| 52 | $(TD).pot: $(POTFILES) |
52 | $(TD).pot: $(POTFILES) |
| 53 | $(XGETTEXT) --output=$(srcdir)/$(TD).pox --from-code=utf-8 \ |
53 | $(XGETTEXT) --output=$(srcdir)/$(TD).pox --from-code=utf-8 \ |
| 54 | --add-comments=TRANSLATORS: --files-from=$(srcdir)/POTFILES.in \ |
54 | --add-comments=TRANSLATORS: --files-from=$(srcdir)/POTFILES.in \ |
| 55 | --package-name="$(PACKAGE_NAME)" \ |
55 | --package-name="$(PACKAGE_NAME)" \ |
| 56 | --package-version="$(PACKAGE_VERSION)" \ |
56 | --package-version="$(PACKAGE_VERSION)" \ |
| 57 | --copyright-holder="$(COPYRIGHT_HOLDER)" \ |
57 | --copyright-holder="$(COPYRIGHT_HOLDER)" \ |
| 58 | --msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \ |
58 | --msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \ |
| 59 | rm -f $@ && mv $(TD).pox $@ |
59 | rm -f $@ && mv $(TD).pox $@ |
| 60 | 60 | ||
| 61 | install: $(MO_FILES) |
61 | install: $(MO_FILES) |
| 62 | cd $(srcdir); \ |
62 | cd $(srcdir); \ |
| 63 | targetdir='$(libdir)/LocaleData'; \ |
63 | targetdir='$(targetdir)'; \ |
| 64 | languages='$(LINGUAS)'; \ |
64 | languages='$(LINGUAS)'; \ |
| 65 | for lang in $$languages; do \ |
65 | for lang in $$languages; do \ |
| 66 | mkdir -p "$$targetdir/$$lang/LC_MESSAGES" || exit 1; \ |
66 | mkdir -p "$$targetdir/$$lang/LC_MESSAGES" || exit 1; \ |
| 67 | dest="$$targetdir/$$lang/LC_MESSAGES/$(TD).mo"; \ |
67 | dest="$$targetdir/$$lang/LC_MESSAGES/$(TD).mo"; \ |
| 68 | cat="$$lang.mo"; \ |
68 | cat="$$lang.mo"; \ |
| 69 | echo "installing $$cat as $$dest"; \ |
69 | echo "installing $$cat as $$dest"; \ |
| 70 | cp -f $$cat $$dest && chmod 644 $$dest || exit 1; \ |
70 | cp -f $$cat $$dest && chmod 644 $$dest || exit 1; \ |
| 71 | done |
71 | done |
| 72 | 72 | ||
| 73 | update-mo: $(MO_FILES) |
73 | update-mo: $(MO_FILES) |
| 74 | 74 | ||
| 75 | update-po: |
75 | update-po: |
| 76 | $(MAKE) $(TD).pot |
76 | $(MAKE) $(TD).pot |
| 77 | cd $(srcdir); \ |
77 | cd $(srcdir); \ |
| 78 | catalogs='$(CATALOGS)'; \ |
78 | catalogs='$(CATALOGS)'; \ |
| 79 | for cat in $$catalogs; do \ |
79 | for cat in $$catalogs; do \ |
| 80 | cat=`basename $$cat`; \ |
80 | cat=`basename $$cat`; \ |
| 81 | lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ |
81 | lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ |
| 82 | mv $$lang.po $$lang.old.po; \ |
82 | mv $$lang.po $$lang.old.po; \ |
| 83 | echo "$$lang:"; \ |
83 | echo "$$lang:"; \ |
| 84 | if $(MSGMERGE) $$lang.old.po $(TD).pot -o $$lang.po; then \ |
84 | if $(MSGMERGE) $$lang.old.po $(TD).pot -o $$lang.po; then \ |
| 85 | rm -f $$lang.old.po; \ |
85 | rm -f $$lang.old.po; \ |
| 86 | else \ |
86 | else \ |
| 87 | echo "msgmerge for $$cat failed!"; \ |
87 | echo "msgmerge for $$cat failed!"; \ |
| 88 | rm -f $$lang.po; \ |
88 | rm -f $$lang.po; \ |
| 89 | mv $$lang.old.po $$lang.po; \ |
89 | mv $$lang.old.po $$lang.po; \ |
| 90 | fi; \ |
90 | fi; \ |
| 91 | done |
91 | done |
| 92 | 92 | ||
| 93 | .SUFFIXES: |
93 | .SUFFIXES: |
| 94 | .SUFFIXES: .po .mo |
94 | .SUFFIXES: .po .mo |
| 95 | 95 | ||
| 96 | .po.mo: |
96 | .po.mo: |
| 97 | $(MSGFMT) --check --statistics --verbose -o $@ $< |
97 | $(MSGFMT) --check --statistics --verbose -o $@ $< |
| 98 | 98 | ||