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