merge the autotools branch
[super-star-trek.git] / po / Makefile
1 # Makefile for PO directory in any package using GNU gettext.
2 # Copyright (C) 1995-1997, 2000-2005 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
3 #
4 # This file can be copied and used freely without restrictions.  It can
5 # be used in projects which are not available under the GNU General Public
6 # License but which still want to provide support for the GNU gettext
7 # functionality.
8 # Please note that the actual code of GNU gettext is covered by the GNU
9 # General Public License and is *not* in the public domain.
10 #
11 # Origin: gettext-0.14.4
12
13 PACKAGE = sst
14 VERSION = 2.0
15 PACKAGE_BUGREPORT = stsp
16
17 SHELL = /bin/sh
18
19
20 srcdir = .
21 top_srcdir = ..
22
23
24 prefix = /usr/local
25 exec_prefix = ${prefix}
26 datadir = ${prefix}/share
27 localedir = $(datadir)/locale
28 gettextsrcdir = $(datadir)/gettext/po
29
30 INSTALL = /usr/bin/install -c
31 INSTALL_DATA = ${INSTALL} -m 644
32 MKINSTALLDIRS = $(top_builddir)/./mkinstalldirs
33 mkinstalldirs = $(SHELL) $(MKINSTALLDIRS)
34
35 GMSGFMT = /usr/bin/msgfmt
36 MSGFMT = /usr/bin/msgfmt
37 XGETTEXT = /usr/bin/xgettext
38 MSGMERGE = msgmerge
39 MSGMERGE_UPDATE = /usr/bin/msgmerge --update
40 MSGINIT = msginit
41 MSGCONV = msgconv
42 MSGFILTER = msgfilter
43
44 POFILES = 
45 GMOFILES = 
46 UPDATEPOFILES = 
47 DUMMYPOFILES = 
48 DISTFILES.common = Makefile.in.in remove-potcdate.sin \
49 $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
50 DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
51 $(POFILES) $(GMOFILES) \
52 $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
53
54 POTFILES = \
55
56 CATALOGS = 
57
58 # Makevars gets inserted here. (Don't remove this line!)
59 # Makefile variables for PO directory in any package using GNU gettext.
60
61 # Usually the message domain is the same as the package name.
62 DOMAIN = $(PACKAGE)
63
64 # These two variables depend on the location of this directory.
65 subdir = po
66 top_builddir = ..
67
68 # These options get passed to xgettext.
69 XGETTEXT_OPTIONS = --keyword=_ --keyword=N_
70
71 # This is the copyright holder that gets inserted into the header of the
72 # $(DOMAIN).pot file.  Set this to the copyright holder of the surrounding
73 # package.  (Note that the msgstr strings, extracted from the package's
74 # sources, belong to the copyright holder of the package.)  Translators are
75 # expected to transfer the copyright for their translations to this person
76 # or entity, or to disclaim their copyright.  The empty string stands for
77 # the public domain; in this case the translators are expected to disclaim
78 # their copyright.
79 COPYRIGHT_HOLDER = Free Software Foundation, Inc.
80
81 # This is the email address or URL to which the translators shall report
82 # bugs in the untranslated strings:
83 # - Strings which are not entire sentences, see the maintainer guidelines
84 #   in the GNU gettext documentation, section 'Preparing Strings'.
85 # - Strings which use unclear terms or require additional context to be
86 #   understood.
87 # - Strings which make invalid assumptions about notation of date, time or
88 #   money.
89 # - Pluralisation problems.
90 # - Incorrect English spelling.
91 # - Incorrect formatting.
92 # It can be your email address, or a mailing list address where translators
93 # can write to without being subscribed, or the URL of a web page through
94 # which the translators can contact you.
95 MSGID_BUGS_ADDRESS =
96
97 # This is the list of locale categories, beyond LC_MESSAGES, for which the
98 # message catalogs shall be used.  It is usually empty.
99 EXTRA_LOCALE_CATEGORIES =
100
101 .SUFFIXES:
102 .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
103
104 .po.mo:
105         @echo "$(MSGFMT) -c -o $@ $<"; \
106         $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
107
108 .po.gmo:
109         @lang=`echo $* | sed -e 's,.*/,,'`; \
110         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
111         echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
112         cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
113
114 .sin.sed:
115         sed -e '/^#/d' $< > t-$@
116         mv t-$@ $@
117
118
119 all: all-yes
120
121 all-yes: stamp-po
122 all-no:
123
124 # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
125 # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
126 # we don't want to bother translators with empty POT files). We assume that
127 # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
128 # In this case, stamp-po is a nop (i.e. a phony target).
129
130 # stamp-po is a timestamp denoting the last time at which the CATALOGS have
131 # been loosely updated. Its purpose is that when a developer or translator
132 # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
133 # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
134 # invocations of "make" will do nothing. This timestamp would not be necessary
135 # if updating the $(CATALOGS) would always touch them; however, the rule for
136 # $(POFILES) has been designed to not touch files that don't need to be
137 # changed.
138 stamp-po: $(srcdir)/$(DOMAIN).pot
139         test ! -f $(srcdir)/$(DOMAIN).pot || \
140           test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
141         @test ! -f $(srcdir)/$(DOMAIN).pot || { \
142           echo "touch stamp-po" && \
143           echo timestamp > stamp-poT && \
144           mv stamp-poT stamp-po; \
145         }
146
147 # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
148 # otherwise packages like GCC can not be built if only parts of the source
149 # have been downloaded.
150
151 # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
152 # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
153 $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
154         if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
155           msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
156         else \
157           msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
158         fi; \
159         $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
160           --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
161           --files-from=$(srcdir)/POTFILES.in \
162           --copyright-holder='$(COPYRIGHT_HOLDER)' \
163           --msgid-bugs-address="$$msgid_bugs_address"
164         test ! -f $(DOMAIN).po || { \
165           if test -f $(srcdir)/$(DOMAIN).pot; then \
166             sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
167             sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
168             if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
169               rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
170             else \
171               rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
172               mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
173             fi; \
174           else \
175             mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
176           fi; \
177         }
178
179 # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
180 # every "make" invocation, only create it when it is missing.
181 # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
182 $(srcdir)/$(DOMAIN).pot:
183         $(MAKE) $(DOMAIN).pot-update
184
185 # This target rebuilds a PO file if $(DOMAIN).pot has changed.
186 # Note that a PO file is not touched if it doesn't need to be changed.
187 $(POFILES): $(srcdir)/$(DOMAIN).pot
188         @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
189         if test -f "$(srcdir)/$${lang}.po"; then \
190           test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
191           echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
192           cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
193         else \
194           $(MAKE) $${lang}.po-create; \
195         fi
196
197
198 install: install-exec install-data
199 install-exec:
200 install-data: install-data-yes
201         if test "$(PACKAGE)" = "gettext-tools"; then \
202           $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
203           for file in $(DISTFILES.common) Makevars.template; do \
204             $(INSTALL_DATA) $(srcdir)/$$file \
205                             $(DESTDIR)$(gettextsrcdir)/$$file; \
206           done; \
207           for file in Makevars; do \
208             rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
209           done; \
210         else \
211           : ; \
212         fi
213 install-data-no: all
214 install-data-yes: all
215         $(mkinstalldirs) $(DESTDIR)$(datadir)
216         @catalogs='$(CATALOGS)'; \
217         for cat in $$catalogs; do \
218           cat=`basename $$cat`; \
219           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
220           dir=$(localedir)/$$lang/LC_MESSAGES; \
221           $(mkinstalldirs) $(DESTDIR)$$dir; \
222           if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
223           $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
224           echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
225           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
226             if test -n "$$lc"; then \
227               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
228                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
229                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
230                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
231                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
232                  for file in *; do \
233                    if test -f $$file; then \
234                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
235                    fi; \
236                  done); \
237                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
238               else \
239                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
240                   :; \
241                 else \
242                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
243                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
244                 fi; \
245               fi; \
246               rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
247               ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
248               ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
249               cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
250               echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
251             fi; \
252           done; \
253         done
254
255 install-strip: install
256
257 installdirs: installdirs-exec installdirs-data
258 installdirs-exec:
259 installdirs-data: installdirs-data-yes
260         if test "$(PACKAGE)" = "gettext-tools"; then \
261           $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
262         else \
263           : ; \
264         fi
265 installdirs-data-no:
266 installdirs-data-yes:
267         $(mkinstalldirs) $(DESTDIR)$(datadir)
268         @catalogs='$(CATALOGS)'; \
269         for cat in $$catalogs; do \
270           cat=`basename $$cat`; \
271           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
272           dir=$(localedir)/$$lang/LC_MESSAGES; \
273           $(mkinstalldirs) $(DESTDIR)$$dir; \
274           for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
275             if test -n "$$lc"; then \
276               if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
277                 link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
278                 mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
279                 mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
280                 (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
281                  for file in *; do \
282                    if test -f $$file; then \
283                      ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
284                    fi; \
285                  done); \
286                 rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
287               else \
288                 if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
289                   :; \
290                 else \
291                   rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
292                   mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
293                 fi; \
294               fi; \
295             fi; \
296           done; \
297         done
298
299 # Define this as empty until I found a useful application.
300 installcheck:
301
302 uninstall: uninstall-exec uninstall-data
303 uninstall-exec:
304 uninstall-data: uninstall-data-yes
305         if test "$(PACKAGE)" = "gettext-tools"; then \
306           for file in $(DISTFILES.common) Makevars.template; do \
307             rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
308           done; \
309         else \
310           : ; \
311         fi
312 uninstall-data-no:
313 uninstall-data-yes:
314         catalogs='$(CATALOGS)'; \
315         for cat in $$catalogs; do \
316           cat=`basename $$cat`; \
317           lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
318           for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
319             rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
320           done; \
321         done
322
323 check: all
324
325 info dvi ps pdf html tags TAGS ctags CTAGS ID:
326
327 mostlyclean:
328         rm -f remove-potcdate.sed
329         rm -f stamp-poT
330         rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
331         rm -fr *.o
332
333 clean: mostlyclean
334
335 distclean: clean
336         rm -f Makefile Makefile.in POTFILES *.mo
337
338 maintainer-clean: distclean
339         @echo "This command is intended for maintainers to use;"
340         @echo "it deletes files that may require special tools to rebuild."
341         rm -f stamp-po $(GMOFILES)
342
343 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
344 dist distdir:
345         $(MAKE) update-po
346         @$(MAKE) dist2
347 # This is a separate target because 'update-po' must be executed before.
348 dist2: stamp-po $(DISTFILES)
349         dists="$(DISTFILES)"; \
350         if test "$(PACKAGE)" = "gettext-tools"; then \
351           dists="$$dists Makevars.template"; \
352         fi; \
353         if test -f $(srcdir)/$(DOMAIN).pot; then \
354           dists="$$dists $(DOMAIN).pot stamp-po"; \
355         fi; \
356         if test -f $(srcdir)/ChangeLog; then \
357           dists="$$dists ChangeLog"; \
358         fi; \
359         for i in 0 1 2 3 4 5 6 7 8 9; do \
360           if test -f $(srcdir)/ChangeLog.$$i; then \
361             dists="$$dists ChangeLog.$$i"; \
362           fi; \
363         done; \
364         if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
365         for file in $$dists; do \
366           if test -f $$file; then \
367             cp -p $$file $(distdir) || exit 1; \
368           else \
369             cp -p $(srcdir)/$$file $(distdir) || exit 1; \
370           fi; \
371         done
372
373 update-po: Makefile
374         $(MAKE) $(DOMAIN).pot-update
375         test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
376         $(MAKE) update-gmo
377
378 # General rule for creating PO files.
379
380 .nop.po-create:
381         @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
382         echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
383         exit 1
384
385 # General rule for updating PO files.
386
387 .nop.po-update:
388         @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
389         if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
390         tmpdir=`pwd`; \
391         echo "$$lang:"; \
392         test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
393         echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
394         cd $(srcdir); \
395         if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
396           if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
397             rm -f $$tmpdir/$$lang.new.po; \
398           else \
399             if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
400               :; \
401             else \
402               echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
403               exit 1; \
404             fi; \
405           fi; \
406         else \
407           echo "msgmerge for $$lang.po failed!" 1>&2; \
408           rm -f $$tmpdir/$$lang.new.po; \
409         fi
410
411 $(DUMMYPOFILES):
412
413 update-gmo: Makefile $(GMOFILES)
414         @:
415
416 Makefile: Makefile.in.in Makevars $(top_builddir)/config.status POTFILES.in
417         cd $(top_builddir) \
418           && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
419                $(SHELL) ./config.status
420
421 force:
422
423 # Tell versions [3.59,3.63) of GNU make not to export all variables.
424 # Otherwise a system limit (for SysV at least) may be exceeded.
425 .NOEXPORT:
426 # Special Makefile rules for English message catalogs with quotation marks.
427
428 DISTFILES.common.extra1 = quot.sed boldquot.sed en@quot.header en@boldquot.header insert-header.sin Rules-quot
429
430 .SUFFIXES: .insert-header .po-update-en
431
432 en@quot.po-create:
433         $(MAKE) en@quot.po-update
434 en@boldquot.po-create:
435         $(MAKE) en@boldquot.po-update
436
437 en@quot.po-update: en@quot.po-update-en
438 en@boldquot.po-update: en@boldquot.po-update-en
439
440 .insert-header.po-update-en:
441         @lang=`echo $@ | sed -e 's/\.po-update-en$$//'`; \
442         if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; GETTEXTLIBDIR=`cd $(top_srcdir)/src && pwd`; export GETTEXTLIBDIR; fi; \
443         tmpdir=`pwd`; \
444         echo "$$lang:"; \
445         ll=`echo $$lang | sed -e 's/@.*//'`; \
446         LC_ALL=C; export LC_ALL; \
447         cd $(srcdir); \
448         if $(MSGINIT) -i $(DOMAIN).pot --no-translator -l $$ll -o - 2>/dev/null | sed -f $$tmpdir/$$lang.insert-header | $(MSGCONV) -t UTF-8 | $(MSGFILTER) sed -f `echo $$lang | sed -e 's/.*@//'`.sed 2>/dev/null > $$tmpdir/$$lang.new.po; then \
449           if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
450             rm -f $$tmpdir/$$lang.new.po; \
451           else \
452             if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
453               :; \
454             else \
455               echo "creation of $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
456               exit 1; \
457             fi; \
458           fi; \
459         else \
460           echo "creation of $$lang.po failed!" 1>&2; \
461           rm -f $$tmpdir/$$lang.new.po; \
462         fi
463
464 en@quot.insert-header: insert-header.sin
465         sed -e '/^#/d' -e 's/HEADER/en@quot.header/g' $(srcdir)/insert-header.sin > en@quot.insert-header
466
467 en@boldquot.insert-header: insert-header.sin
468         sed -e '/^#/d' -e 's/HEADER/en@boldquot.header/g' $(srcdir)/insert-header.sin > en@boldquot.insert-header
469
470 mostlyclean: mostlyclean-quot
471 mostlyclean-quot:
472         rm -f *.insert-header