cvsimport
[fvwm.git] / po / Makefile.am
blob85907aa714a7c8181b604aa92323875670037798
2 localedir = @LOCALEDIR@
4 FVWM_POT_FILES = \
5      ../fvwm/fvwm.c \
6      ../fvwm/expand.c \
7      ../fvwm/windowlist.c \
8      ../fvwm/virtual.c \
9      ../fvwm/menus.c
11 FVWMRC_POT_FILES = \
12      ../fvwm/ConfigFvwmSetup \
13      ../modules/FvwmForm/FvwmForm-Setup.in
15 FVWMTASKBAR_POT_FILES = \
16         ../modules/FvwmTaskBar/Goodies.c \
17         ../modules/FvwmTaskBar/FvwmTaskBar.c
19 FVWMSCRIPT_POT_FILES = \
20         ../modules/FvwmScript/Scripts/FvwmScript-BellSetup \
21         ../modules/FvwmScript/Scripts/FvwmScript-KeyboardSetup \
22         ../modules/FvwmScript/Scripts/FvwmScript-PointerSetup \
23         ../modules/FvwmScript/Scripts/FvwmScript-ScreenSetup \
24         ../modules/FvwmScript/Scripts/FvwmScript-FileBrowser
26 EXTRA_DIST = \
27         @POFILES@ @GMOFILES@ fvwm.pot FvwmTaskBar.pot FvwmScript.pot \
28         remove-potcdate.sed remove-potcdate.sin
30 COPYRIGHT_HOLDER = fvwm workers
32 # These options get passed to xgettext.
33 XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
35 # This is the list of locale categories, beyond LC_MESSAGES, for which the
36 # message catalogs shall be used.  It is usually empty.
37 EXTRA_LOCALE_CATEGORIES =
39 MSGMERGE_UPDATE = @MSGMERGE@ --update
41 SUFFIXES = .po .gmo .mo .sed .sin .nop .po-update
43 .po.mo:
44         @echo "$(MSGFMT) -c -o $@ $<"; \
45         $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
47 .po.gmo:
48         @lang=`echo $* | sed -e 's,.*/,,'`; \
49         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
50         if test -f $${lang}.po; then \
51           echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
52           cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo; \
53         fi
55 .sin.sed:
56         sed -e '/^#/d' $< > t-$@
57         mv t-$@ $@
60 all-local: all-local-@USE_NLS@
62 # make [all] should do nothing ...
63 #all-local-yes: $(CATALOGS)
64 all-local-yes:
65 all-local-no:
67 catalogs: $(CATALOGS)
69 maintainer-clean-local:
70         rm -f $(GMOFILES)
72 $(FVWM_DOMAIN).pot-update: $(FVWM_POT_FILES) \
73         $(FVWMRC_POT_FILES) \
74         remove-potcdate.sed
75         rm -f fvwmrc.pot; \
76         rcpotfiles='$(FVWMRC_POT_FILES)'; \
77         rm -f duplicate; \
78         for file in $$rcpotfiles; do \
79           perl -ne 's/\[gt\.((\\.|.)+?)\]/ print \
80           "\#$$ARGV: line $$.\n"."msgid \"$$1\"\n"."msgstr \"\"\n\n"/ge' \
81           $$file >> duplicate; \
82         done; \
83         msguniq duplicate > fvwmrc.pot;
84         rm -f duplicate; \
85         potfiles='$(FVWM_POT_FILES)'; \
86         $(XGETTEXT) \
87           --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) -o $(FVWM_DOMAIN).po \
88           --copyright-holder='$(COPYRIGHT_HOLDER)' $$potfiles; \
89         test ! -f $(FVWM_DOMAIN).po || { \
90           if test -f $(srcdir)/$(FVWM_DOMAIN).pot; then \
91             sed -f remove-potcdate.sed < $(srcdir)/$(FVWM_DOMAIN).pot > $(FVWM_DOMAIN).1po && \
92             sed -f remove-potcdate.sed < $(FVWM_DOMAIN).po > $(FVWM_DOMAIN).2po && \
93             if cmp $(FVWM_DOMAIN).1po $(FVWM_DOMAIN).2po >/dev/null 2>&1; then \
94               rm -f $(FVWM_DOMAIN).1po $(FVWM_DOMAIN).2po $(FVWM_DOMAIN).po; \
95             else \
96               rm -f $(FVWM_DOMAIN).1po $(FVWM_DOMAIN).2po $(srcdir)/$(FVWM_DOMAIN).pot && \
97               mv $(FVWM_DOMAIN).po $(srcdir)/$(FVWM_DOMAIN).pot; \
98             fi; \
99           else \
100             mv $(FVWM_DOMAIN).po $(srcdir)/$(FVWM_DOMAIN).pot; \
101           fi; \
102           mv $(FVWM_DOMAIN).pot duplicate.pot; \
103           cat fvwmrc.pot >> duplicate.pot; \
104           msguniq duplicate.pot  > $(FVWM_DOMAIN).pot; \
105           rm -f duplicate.pot fvwmrc.pot; \
106         }
108 $(srcdir)/$(FVWM_DOMAIN).pot:
109         $(MAKE) $(FVWM_DOMAIN).pot-update
111 $(FVWMTASKBAR_DOMAIN).pot-update: $(FVWMTASKBAR_POT_FILES) \
112         remove-potcdate.sed
113         potfiles='$(FVWMTASKBAR_POT_FILES)'; \
114         $(XGETTEXT) \
115           --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
116           -o $(FVWMTASKBAR_DOMAIN).po \
117           --copyright-holder='$(COPYRIGHT_HOLDER)' $$potfiles; \
118         test ! -f $(FVWMTASKBAR_DOMAIN).po || { \
119           if test -f $(srcdir)/$(FVWMTASKBAR_DOMAIN).pot; then \
120             sed -f remove-potcdate.sed < $(srcdir)/$(FVWMTASKBAR_DOMAIN).pot \
121             > $(FVWMTASKBAR_DOMAIN).1po && \
122             sed -f remove-potcdate.sed < $(FVWMTASKBAR_DOMAIN).po \
123             > $(FVWMTASKBAR_DOMAIN).2po && \
124             if cmp $(FVWMTASKBAR_DOMAIN).1po $(FVWMTASKBAR_DOMAIN).2po \
125             >/dev/null 2>&1; then \
126               rm -f $(FVWMTASKBAR_DOMAIN).1po $(FVWMTASKBAR_DOMAIN).2po \
127               $(FVWMTASKBAR_DOMAIN).po; \
128             else \
129               rm -f $(FVWMTASKBAR_DOMAIN).1po $(FVWMTASKBAR_DOMAIN).2po \
130               $(srcdir)/$(FVWMTASKBAR_DOMAIN).pot && \
131               mv $(FVWMTASKBAR_DOMAIN).po $(srcdir)/$(FVWMTASKBAR_DOMAIN).pot; \
132             fi; \
133           else \
134             mv $(FVWMTASKBAR_DOMAIN).po $(srcdir)/$(FVWMTASKBAR_DOMAIN).pot; \
135           fi; \
136         }
138 $(srcdir)/$(FVWMTASKBAR_DOMAIN).pot:
139         $(MAKE) $(FVWMTASKBAR_DOMAIN).pot-update
141 $(FVWMSCRIPT_DOMAIN).pot-update: $(FVWMSCRIPT_POT_FILES) \
142         remove-potcdate.sed
143         potfiles='$(FVWMSCRIPT_POT_FILES)'; \
144         rm -f duplicate; \
145         for file in $$potfiles; do \
146           perl -ne 's/LocaleTitle\s+\{((\\.|.)+?)\}/ print \
147           "\#$$ARGV: line $$.\n"."msgid \"$$1\"\n"."msgstr \"\"\n\n"/ge' \
148           $$file >> duplicate; \
149         done; \
150         msguniq duplicate > duplicate.pot; \
151         cat pot_head_sample >  $(FVWMSCRIPT_DOMAIN).pot; \
152         cat duplicate.pot >> $(FVWMSCRIPT_DOMAIN).pot; \
153         rm -f duplicate duplicate.pot;
155 $(srcdir)/$(FVWMSCRIPT_DOMAIN).pot:
156         $(MAKE) $(FVWMSCRIPT_DOMAIN).pot-update
158 $(POFILES): $(srcdir)/$(FVWM_DOMAIN).pot $(srcdir)/$(FVWMTASKBAR_DOMAIN).pot \
159         $(srcdir)/$(FVWMSCRIPT_DOMAIN).pot
160         dlang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
161         dom=`echo $$dlang | sed -e 's/\..*$$//'`; \
162         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
163         if test -f $${dlang}.po; then \
164           echo "$${cdcmd}$(MSGMERGE_UPDATE) $${dlang}.po $${dom}.pot"; \
165           cd $(srcdir) && $(MSGMERGE_UPDATE) $${dlang}.po $${dom}.pot; \
166         fi
168 #       @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
169 #       test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
170 #       echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(FVWM_DOMAIN).pot"; \
171 #       cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(FVWM_DOMAIN).pot
173 install-data-local: install-data-local-@USE_NLS@
174 install-data-local-no: all
175 install-data-local-yes: all
176         $(mkinstalldirs) $(DESTDIR)$(datadir)
177         @catalogs='$(CATALOGS)'; \
178         all_domains='$(ALL_DOMAINS)'; \
179         for dom in $$all_domains; do \
180           for cat in $$catalogs; do \
181             cat=`basename $$cat`; \
182             lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
183             cat="$$dom.$$cat"; \
184             dir=$(localedir)/$$lang/LC_MESSAGES; \
185             $(mkinstalldirs) $(DESTDIR)$$dir; \
186             if test -r $$cat; \
187               then realcat=$$cat; \
188             else realcat=$(srcdir)/$$cat; \
189             fi; \
190             if test -f $$realcat; then \
191               $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$$dom.mo; \
192               echo "installing $$realcat as $(DESTDIR)$$dir/$$dom.mo"; \
193               for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
194                 if test -n "$$lc"; then \
195                   if (cd $(DESTDIR)$(localedir)/$$lang && \
196                       LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' \
197                       >/dev/null; then \
198                     link=`cd $(DESTDIR)$(localedir)/$$lang && \
199                          LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
200                     mv $(DESTDIR)$(localedir)/$$lang/$$lc \
201                        $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
202                     mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
203                     (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
204                      for file in *; do \
205                        if test -f $$file; then \
206                          ln -s ../$$link/$$file \
207                                $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
208                        fi; \
209                      done); \
210                     rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
211                   else \
212                     if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
213                       :; \
214                     else \
215                       rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
216                       mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
217                     fi; \
218                   fi; \
219                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$$dom.mo; \
220                   ln -s ../LC_MESSAGES/$$dom.mo \
221                      $(DESTDIR)$(localedir)/$$lang/$$lc/$$dom.mo 2>/dev/null || \
222                   ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$$dom.mo \
223                      $(DESTDIR)$(localedir)/$$lang/$$lc/$$dom.mo 2>/dev/null || \
224                   cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$$dom.mo \
225                      $(DESTDIR)$(localedir)/$$lang/$$lc/$$dom.mo; \
226                   echo "installing $$realcat link as \
227                   $(DESTDIR)$(localedir)/$$lang/$$lc/$$dom.mo"; \
228                 fi; \
229               done; \
230             fi; \
231           done; \
232         done
235 installdirs-data: installdirs-data-local-@USE_NLS@
236 installdirs-data-local-no:
237 installdirs-data-local-yes:
238         $(mkinstalldirs) $(DESTDIR)$(datadir)
239         @catalogs='$(CATALOGS)'; \
240         all_domains='$(ALL_DOMAINS)'; \
241         for dom in $$all_domainss; do \
242           for cat in $$catalogs; do \
243             cat=`basename $$cat`; \
244             lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
245             dir=$(localedir)/$$lang/LC_MESSAGES; \
246             $(mkinstalldirs) $(DESTDIR)$$dir; \
247             for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
248               if test -n "$$lc"; then \
249                 if (cd $(DESTDIR)$(localedir)/$$lang && \
250                     LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' \
251                     >/dev/null; then \
252                   link=`cd $(DESTDIR)$(localedir)/$$lang && \
253                         LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
254                   mv $(DESTDIR)$(localedir)/$$lang/$$lc \
255                      $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
256                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
257                   (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
258                    for file in *; do \
259                      if test -f $$file; then \
260                        ln -s ../$$link/$$file \
261                              $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
262                      fi; \
263                    done); \
264                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
265                 else \
266                   if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
267                     :; \
268                   else \
269                     rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
270                     mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
271                   fi; \
272                 fi; \
273               fi; \
274             done; \
275           done; \
276         done
279 uninstall-local: uninstall-local-@USE_NLS@
280 uninstall-local-no:
281 uninstall-local-yes:
282         catalogs='$(CATALOGS)'; \
283         all_domains='$(ALL_DOMAINS)'; \
284         for dom in $$all_domains; do \
285           for cat in $$catalogs; do \
286             cat=`basename $$cat`; \
287             lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
288             for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
289               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$$dom.mo; \
290             done; \
291           done; \
292         done
294 update-po: Makefile
295         $(MAKE) $(FVWM_DOMAIN).pot-update
296         $(MAKE) $(FVWMTASKBAR_DOMAIN).pot-update
297         $(MAKE) $(FVWMSCRIPT_DOMAIN).pot-update
298         $(MAKE) $(UPDATEPOFILES)
299         $(MAKE) update-gmo
301 # General rule for updating PO files.
303 .nop.po-update:
304         dlang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po-update$$//'`; \
305         dom=`echo $$dlang | sed -e 's/\..*$$//'`; \
306         tmpdir=`pwd`; \
307         echo "$$dlang:"; \
308         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
309         echo "$${cdcmd}$(MSGMERGE) $$dlang.po $$dom.pot -o $$dlang.new.po"; \
310         cd $(srcdir); \
311         if $(MSGMERGE) $$dlang.po $$dom.pot -o $$tmpdir/$$dlang.new.po; then \
312           if cmp $$dlang.po $$tmpdir/$$dlang.new.po >/dev/null 2>&1; then \
313             rm -f $$tmpdir/$$dlang.new.po; \
314           else \
315             if mv -f $$tmpdir/$$dlang.new.po $$dlang.po; then \
316               :; \
317             else \
318               echo "msgmerge for $$dlang.po failed: cannot move \
319 $$tmpdir/$$dlang.new.po to $$dlang.po" 1>&2; \
320               exit 1; \
321             fi; \
322           fi; \
323         else \
324           echo "msgmerge for $$dlang.po failed!" 1>&2; \
325           rm -f $$tmpdir/$$dlang.new.po; \
326         fi
328 $(DUMMYPOFILES):
330 update-gmo: Makefile $(GMOFILES)
331         @: