1 # Makefile for PO directory in any package using GNU gettext.
3 # Usually the message domain is the same as the package name.
5 MAINTAINER_EMAIL = support@zmanda.com
7 POFILES = $(wildcard *.po)
8 #MOFILES = $(patsubst %.po,%.mo,$(POFILES))
11 CFILES = $(wildcard $(top_srcdir)/*/*.[ch])
12 PLFILES = $(wildcard $(top_srcdir)/*/*.pl.in)
13 SHFILES = $(wildcard $(top_srcdir)/*/*.sh.in)
14 ALLFILES = $(CFILES) $(PLFILES) $(SHFILES)
16 # This variable depends on the location of this directory.
18 localedir=$(datadir)/locale
20 # These options get passed to xgettext.
21 XGETTEXT_OPTIONS = --keyword=_ --keyword=_T
23 # This is the list of locale categories, beyond LC_MESSAGES, for which the
24 # message catalogs shall be used. It is usually empty.
25 EXTRA_LOCALE_CATEGORIES =
32 MSGMERGE_UPDATE = msgmerge --update
50 SUFFIXES = .po .mo .sed .sin
53 sed -e '/^#/d' $< > t-$@
58 # This target rebuilds amanda.pot; it is an expensive operation.
59 # Note that amanda.pot is not touched if it doesn't need to be changed.
60 amanda.pot: $(ALLFILES)
61 @echo $(XGETTEXT) --language=C --output=amanda.pot ...
62 @$(XGETTEXT) --output=amanda.pot --default-domain=amanda \
63 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) --language=C \
65 @echo $(XGETTEXT) --language=Perl --join-existing --output=amanda.pot ...
66 @$(XGETTEXT) --output=amanda.pot --default-domain=amanda \
67 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) --language=Perl \
68 --join-existing $(PLFILES)
69 @echo $(XGETTEXT) --language=Shell --join-existing --output=amanda.pot ...
70 @$(XGETTEXT) --output=amanda.pot --default-domain=amanda \
71 --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) --language=Shell \
72 --join-existing $(SHFILES)
73 @test ! -f amanda.po || { \
74 if test -f $(srcdir)/amanda.pot; then \
75 sed -f remove-potcdate.sed < $(srcdir)/amanda.pot > amanda.1po && \
76 sed -f remove-potcdate.sed < amanda.po > amanda.2po && \
77 if cmp amanda.1po amanda.2po >/dev/null 2>&1; then \
78 rm -f amanda.1po amanda.2po amanda.po; \
80 rm -f amanda.1po amanda.2po $(srcdir)/amanda.pot && \
81 mv amanda.po $(srcdir)/amanda.pot; \
84 mv amanda.po $(srcdir)/amanda.pot; \
89 # This target rebuilds a PO file if amanda.pot has changed.
90 # Note that a PO file is not touched if it doesn't need to be changed.
92 @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
93 if test "$$lang" = "en_ZM"; then \
94 echo msgen -o en.po amanda.pot; \
95 msgen -o en.po amanda.pot; \
96 elif test -f "$(srcdir)/$${lang}.po"; then \
97 echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po amanda.pot"; \
98 cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po amanda.pot; \
100 echo $(MSGINIT) --locale=$${lang} --input=amanda.pot --output-file=$${lang}.po; \
101 $(MSGINIT) --no-translator --locale=$${lang} --input=amanda.pot --output-file=$${lang}.po; \
104 #en_ZM.po: en.po zlocale.pl ztranslation
105 # @chmod +x ./zlocale.pl
109 @echo "$(MSGFMT) -o $@ $<"; \
110 $(MSGFMT) -o t-$@ $< && mv t-$@ $@
112 install-data-hook: $(MOFILES)
113 @for cat in "" $(MOFILES); do \
114 if test -z "$$cat" -o "$$cat" = "en.mo"; then \
117 cat=`basename $$cat`; \
118 lang=`echo $$cat | sed -e 's/\.mo$$//'`; \
119 dir=$(localedir)/$$lang/LC_MESSAGES; \
120 $(mkdir_p) $(DESTDIR)$$dir; \
121 if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
122 $(INSTALL) $$realcat $(DESTDIR)$$dir/amanda.mo; \
123 echo "installing $$realcat as $(DESTDIR)$$dir/amanda.mo"; \
124 for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
125 if test -n "$$lc"; then \
126 if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
127 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
128 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
129 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
130 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
132 if test -f $$file; then \
133 ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
136 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
138 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
141 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
142 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
145 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/amanda.mo; \
146 ln -s ../LC_MESSAGES/amanda.mo $(DESTDIR)$(localedir)/$$lang/$$lc/amanda.mo 2>/dev/null || \
147 ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/amanda.mo $(DESTDIR)$(localedir)/$$lang/$$lc/amanda.mo 2>/dev/null || \
148 cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/amanda.mo $(DESTDIR)$(localedir)/$$lang/$$lc/amanda.mo; \
149 echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/amanda.mo"; \