Subversion Repositories LCARS

Rev

Rev 38 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 38 Rev 56
1
# Makefile for various po files.
1
# Makefile for various po files.
2
2
3
srcdir = .
3
srcdir = .
4
libdir = ..
4
libdir = ..
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 \
-
 
48
#		--keyword=__n:1,2 --keyword=__nx:1,2 --keyword=__xn:1,2 \
-
 
49
#		--keyword=__p:1c,2 --keyword=__np:1c,2,3 \
-
 
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=%__ \
47
$(TD).pot: $(POTFILES)
52
$(TD).pot: $(POTFILES)
48
	$(XGETTEXT) --output=$(srcdir)/$(TD).pox --from-code=utf-8 \
53
	$(XGETTEXT) --output=$(srcdir)/$(TD).pox --from-code=utf-8 \
49
		--add-comments=TRANSLATORS: --files-from=$(srcdir)/POTFILES.in \
54
		--add-comments=TRANSLATORS: --files-from=$(srcdir)/POTFILES.in \
-
 
55
		--package-name="$(PACKAGE_NAME)" \
-
 
56
		--package-version="$(PACKAGE_VERSION)" \
50
		--copyright-holder="$(COPYRIGHT_HOLDER)" \
57
		--copyright-holder="$(COPYRIGHT_HOLDER)" \
51
		--msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \
58
		--msgid-bugs-address="$(MSGID_BUGS_ADDRESS)" \
52
		--keyword --keyword='_' --keyword='$$__' --keyword=__ --keyword=__x \
-
 
53
		--keyword=__n:1,2 --keyword=__nx:1,2 --keyword=__xn:1,2 \
-
 
54
		--keyword=__p:1c,2 --keyword=__np:1c,2,3 \
-
 
55
		--keyword=__npx:1c,2,3 --keyword=N__ --keyword=N__n:1,2 \
-
 
56
		--keyword=N__p:1c,2 --keyword=N__np:1c,2,3 --keyword=%__ \
-
 
57
	rm -f $@ && mv $(TD).pox $@
59
	rm -f $@ && mv $(TD).pox $@
58
60
59
install: $(MO_FILES)
61
install: $(MO_FILES)
60
	cd $(srcdir); \
62
	cd $(srcdir); \
61
	targetdir='$(libdir)/LocaleData'; \
63
	targetdir='$(libdir)/LocaleData'; \
62
	languages='$(LINGUAS)'; \
64
	languages='$(LINGUAS)'; \
63
	for lang in $$languages; do \
65
	for lang in $$languages; do \
64
		mkdir -p "$$targetdir/$$lang/LC_MESSAGES" || exit 1; \
66
		mkdir -p "$$targetdir/$$lang/LC_MESSAGES" || exit 1; \
65
		dest="$$targetdir/$$lang/LC_MESSAGES/$(TD).mo"; \
67
		dest="$$targetdir/$$lang/LC_MESSAGES/$(TD).mo"; \
66
		cat="$$lang.mo"; \
68
		cat="$$lang.mo"; \
67
		echo "installing $$cat as $$dest"; \
69
		echo "installing $$cat as $$dest"; \
68
		cp -f $$cat $$dest && chmod 644 $$dest || exit 1; \
70
		cp -f $$cat $$dest && chmod 644 $$dest || exit 1; \
69
	done
71
	done
70
72
71
update-mo: $(MO_FILES)
73
update-mo: $(MO_FILES)
72
74
73
update-po:
75
update-po:
74
	$(MAKE) $(TD).pot
76
	$(MAKE) $(TD).pot
75
	cd $(srcdir); \
77
	cd $(srcdir); \
76
        catalogs='$(CATALOGS)'; \
78
        catalogs='$(CATALOGS)'; \
77
        for cat in $$catalogs; do \
79
        for cat in $$catalogs; do \
78
          cat=`basename $$cat`; \
80
          cat=`basename $$cat`; \
79
          lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
81
          lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
80
          mv $$lang.po $$lang.old.po; \
82
          mv $$lang.po $$lang.old.po; \
81
          echo "$$lang:"; \
83
          echo "$$lang:"; \
82
          if $(MSGMERGE) $$lang.old.po $(TD).pot -o $$lang.po; then \
84
          if $(MSGMERGE) $$lang.old.po $(TD).pot -o $$lang.po; then \
83
            rm -f $$lang.old.po; \
85
            rm -f $$lang.old.po; \
84
          else \
86
          else \
85
            echo "msgmerge for $$cat failed!"; \
87
            echo "msgmerge for $$cat failed!"; \
86
            rm -f $$lang.po; \
88
            rm -f $$lang.po; \
87
            mv $$lang.old.po $$lang.po; \
89
            mv $$lang.old.po $$lang.po; \
88
          fi; \
90
          fi; \
89
        done
91
        done
90
92
91
.SUFFIXES:
93
.SUFFIXES:
92
.SUFFIXES: .po .mo
94
.SUFFIXES: .po .mo
93
95
94
.po.mo:
96
.po.mo:
95
	$(MSGFMT) --check --statistics --verbose -o $@ $<
97
	$(MSGFMT) --check --statistics --verbose -o $@ $<
96
98