Makefile.in.in 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  1. # Makefile for PO directory in any package using GNU gettext.
  2. # Copyright (C) 1995-1997, 2000-2006 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.15
  12. PACKAGE = @PACKAGE@
  13. VERSION = @VERSION@
  14. PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
  15. SHELL = /bin/sh
  16. @SET_MAKE@
  17. srcdir = @srcdir@
  18. top_srcdir = @top_srcdir@
  19. VPATH = @srcdir@
  20. prefix = @prefix@
  21. exec_prefix = @exec_prefix@
  22. datarootdir = @datarootdir@
  23. datadir = @datadir@
  24. localedir = @localedir@
  25. gettextsrcdir = $(datadir)/gettext/po
  26. INSTALL = @INSTALL@
  27. INSTALL_DATA = @INSTALL_DATA@
  28. mkinstalldirs = $(SHELL) @install_sh@ -d
  29. mkdir_p = @mkdir_p@
  30. GMSGFMT_ = @GMSGFMT@
  31. GMSGFMT_no = @GMSGFMT@
  32. GMSGFMT_yes = @GMSGFMT_015@
  33. GMSGFMT = $(GMSGFMT_$(USE_MSGCTXT))
  34. MSGFMT_ = @MSGFMT@
  35. MSGFMT_no = @MSGFMT@
  36. MSGFMT_yes = @MSGFMT_015@
  37. MSGFMT = $(MSGFMT_$(USE_MSGCTXT))
  38. XGETTEXT_ = @XGETTEXT@
  39. XGETTEXT_no = @XGETTEXT@
  40. XGETTEXT_yes = @XGETTEXT_015@
  41. XGETTEXT = $(XGETTEXT_$(USE_MSGCTXT))
  42. MSGMERGE = msgmerge
  43. MSGMERGE_UPDATE = @MSGMERGE@ --update
  44. MSGATTRIB = msgattrib --no-obsolete
  45. MSGINIT = msginit
  46. MSGCONV = msgconv
  47. MSGFILTER = msgfilter
  48. POFILES = @POFILES@
  49. GMOFILES = @GMOFILES@
  50. UPDATEPOFILES = @UPDATEPOFILES@
  51. DUMMYPOFILES = @DUMMYPOFILES@
  52. DISTFILES.common = Makefile.in.in remove-potcdate.sin \
  53. $(DISTFILES.common.extra1) $(DISTFILES.common.extra2) $(DISTFILES.common.extra3)
  54. DISTFILES = $(DISTFILES.common) Makevars POTFILES.in \
  55. $(POFILES) $(GMOFILES) \
  56. $(DISTFILES.extra1) $(DISTFILES.extra2) $(DISTFILES.extra3)
  57. POTFILES = \
  58. CATALOGS = @CATALOGS@
  59. # Makevars gets inserted here. (Don't remove this line!)
  60. .SUFFIXES:
  61. .SUFFIXES: .po .gmo .mo .sed .sin .nop .po-create .po-update
  62. .po.mo:
  63. @echo "$(MSGFMT) -c -o $@ $<"; \
  64. $(MSGFMT) -c -o t-$@ $< && mv t-$@ $@
  65. .po.gmo:
  66. @lang=`echo $* | sed -e 's,.*/,,'`; \
  67. test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
  68. echo "$${cdcmd}rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o $${lang}.gmo $${lang}.po"; \
  69. cd $(srcdir) && rm -f $${lang}.gmo && $(GMSGFMT) -c --statistics -o t-$${lang}.gmo $${lang}.po && mv t-$${lang}.gmo $${lang}.gmo
  70. .sin.sed:
  71. sed -e '/^#/d' $< > t-$@
  72. mv t-$@ $@
  73. all: all-@USE_NLS@
  74. all-yes: stamp-po
  75. all-no:
  76. # $(srcdir)/$(DOMAIN).pot is only created when needed. When xgettext finds no
  77. # internationalized messages, no $(srcdir)/$(DOMAIN).pot is created (because
  78. # we don't want to bother translators with empty POT files). We assume that
  79. # LINGUAS is empty in this case, i.e. $(POFILES) and $(GMOFILES) are empty.
  80. # In this case, stamp-po is a nop (i.e. a phony target).
  81. # stamp-po is a timestamp denoting the last time at which the CATALOGS have
  82. # been loosely updated. Its purpose is that when a developer or translator
  83. # checks out the package via CVS, and the $(DOMAIN).pot file is not in CVS,
  84. # "make" will update the $(DOMAIN).pot and the $(CATALOGS), but subsequent
  85. # invocations of "make" will do nothing. This timestamp would not be necessary
  86. # if updating the $(CATALOGS) would always touch them; however, the rule for
  87. # $(POFILES) has been designed to not touch files that don't need to be
  88. # changed.
  89. stamp-po: $(srcdir)/$(DOMAIN).pot
  90. test ! -f $(srcdir)/$(DOMAIN).pot || \
  91. test -z "$(GMOFILES)" || $(MAKE) $(GMOFILES)
  92. @test ! -f $(srcdir)/$(DOMAIN).pot || { \
  93. echo "touch stamp-po" && \
  94. echo timestamp > stamp-poT && \
  95. mv stamp-poT stamp-po; \
  96. }
  97. # Note: Target 'all' must not depend on target '$(DOMAIN).pot-update',
  98. # otherwise packages like GCC can not be built if only parts of the source
  99. # have been downloaded.
  100. # This target rebuilds $(DOMAIN).pot; it is an expensive operation.
  101. # Note that $(DOMAIN).pot is not touched if it doesn't need to be changed.
  102. $(DOMAIN).pot-update: $(POTFILES) $(srcdir)/POTFILES.in remove-potcdate.sed
  103. if test -n '$(MSGID_BUGS_ADDRESS)' || test '$(PACKAGE_BUGREPORT)' = '@'PACKAGE_BUGREPORT'@'; then \
  104. msgid_bugs_address='$(MSGID_BUGS_ADDRESS)'; \
  105. else \
  106. msgid_bugs_address='$(PACKAGE_BUGREPORT)'; \
  107. fi; \
  108. $(XGETTEXT) --default-domain=$(DOMAIN) --directory=$(top_srcdir) \
  109. --add-comments=TRANSLATORS: $(XGETTEXT_OPTIONS) \
  110. --files-from=$(srcdir)/POTFILES.in \
  111. --copyright-holder='$(COPYRIGHT_HOLDER)' \
  112. --msgid-bugs-address="$$msgid_bugs_address"
  113. test ! -f $(DOMAIN).po || { \
  114. if test -f $(srcdir)/$(DOMAIN).pot; then \
  115. sed -f remove-potcdate.sed < $(srcdir)/$(DOMAIN).pot > $(DOMAIN).1po && \
  116. sed -f remove-potcdate.sed < $(DOMAIN).po > $(DOMAIN).2po && \
  117. if cmp $(DOMAIN).1po $(DOMAIN).2po >/dev/null 2>&1; then \
  118. rm -f $(DOMAIN).1po $(DOMAIN).2po $(DOMAIN).po; \
  119. else \
  120. rm -f $(DOMAIN).1po $(DOMAIN).2po $(srcdir)/$(DOMAIN).pot && \
  121. mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
  122. fi; \
  123. else \
  124. mv $(DOMAIN).po $(srcdir)/$(DOMAIN).pot; \
  125. fi; \
  126. }
  127. # This rule has no dependencies: we don't need to update $(DOMAIN).pot at
  128. # every "make" invocation, only create it when it is missing.
  129. # Only "make $(DOMAIN).pot-update" or "make dist" will force an update.
  130. $(srcdir)/$(DOMAIN).pot:
  131. $(MAKE) $(DOMAIN).pot-update
  132. # This target rebuilds a PO file if $(DOMAIN).pot has changed.
  133. # Note that a PO file is not touched if it doesn't need to be changed.
  134. $(POFILES): $(srcdir)/$(DOMAIN).pot
  135. @lang=`echo $@ | sed -e 's,.*/,,' -e 's/\.po$$//'`; \
  136. if test -f "$(srcdir)/$${lang}.po"; then \
  137. test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
  138. echo "$${cdcmd}$(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot"; \
  139. cd $(srcdir) && $(MSGMERGE_UPDATE) $${lang}.po $(DOMAIN).pot; \
  140. echo "$(MSGATTRIB) -o $${lang}.po $${lang}.po"; \
  141. $(MSGATTRIB) -o $${lang}.po $${lang}.po; \
  142. else \
  143. $(MAKE) $${lang}.po-create; \
  144. fi
  145. install: install-exec install-data
  146. install-exec:
  147. install-data: install-data-@USE_NLS@
  148. if test "$(PACKAGE)" = "gettext-tools"; then \
  149. $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
  150. for file in $(DISTFILES.common) Makevars.template; do \
  151. $(INSTALL_DATA) $(srcdir)/$$file \
  152. $(DESTDIR)$(gettextsrcdir)/$$file; \
  153. done; \
  154. for file in Makevars; do \
  155. rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
  156. done; \
  157. else \
  158. : ; \
  159. fi
  160. install-data-no: all
  161. install-data-yes: all
  162. $(mkdir_p) $(DESTDIR)$(datadir)
  163. @catalogs='$(CATALOGS)'; \
  164. for cat in $$catalogs; do \
  165. cat=`basename $$cat`; \
  166. lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
  167. dir=$(localedir)/$$lang/LC_MESSAGES; \
  168. $(mkdir_p) $(DESTDIR)$$dir; \
  169. if test -r $$cat; then realcat=$$cat; else realcat=$(srcdir)/$$cat; fi; \
  170. $(INSTALL_DATA) $$realcat $(DESTDIR)$$dir/$(DOMAIN).mo; \
  171. echo "installing $$realcat as $(DESTDIR)$$dir/$(DOMAIN).mo"; \
  172. for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
  173. if test -n "$$lc"; then \
  174. if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
  175. link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
  176. mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
  177. mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
  178. (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
  179. for file in *; do \
  180. if test -f $$file; then \
  181. ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
  182. fi; \
  183. done); \
  184. rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
  185. else \
  186. if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
  187. :; \
  188. else \
  189. rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
  190. mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
  191. fi; \
  192. fi; \
  193. rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
  194. ln -s ../LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
  195. ln $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo 2>/dev/null || \
  196. cp -p $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(DOMAIN).mo $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
  197. echo "installing $$realcat link as $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo"; \
  198. fi; \
  199. done; \
  200. done
  201. install-strip: install
  202. installdirs: installdirs-exec installdirs-data
  203. installdirs-exec:
  204. installdirs-data: installdirs-data-@USE_NLS@
  205. if test "$(PACKAGE)" = "gettext-tools"; then \
  206. $(mkdir_p) $(DESTDIR)$(gettextsrcdir); \
  207. else \
  208. : ; \
  209. fi
  210. installdirs-data-no:
  211. installdirs-data-yes:
  212. $(mkdir_p) $(DESTDIR)$(datadir)
  213. @catalogs='$(CATALOGS)'; \
  214. for cat in $$catalogs; do \
  215. cat=`basename $$cat`; \
  216. lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
  217. dir=$(localedir)/$$lang/LC_MESSAGES; \
  218. $(mkdir_p) $(DESTDIR)$$dir; \
  219. for lc in '' $(EXTRA_LOCALE_CATEGORIES); do \
  220. if test -n "$$lc"; then \
  221. if (cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc 2>/dev/null) | grep ' -> ' >/dev/null; then \
  222. link=`cd $(DESTDIR)$(localedir)/$$lang && LC_ALL=C ls -l -d $$lc | sed -e 's/^.* -> //'`; \
  223. mv $(DESTDIR)$(localedir)/$$lang/$$lc $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
  224. mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
  225. (cd $(DESTDIR)$(localedir)/$$lang/$$lc.old && \
  226. for file in *; do \
  227. if test -f $$file; then \
  228. ln -s ../$$link/$$file $(DESTDIR)$(localedir)/$$lang/$$lc/$$file; \
  229. fi; \
  230. done); \
  231. rm -f $(DESTDIR)$(localedir)/$$lang/$$lc.old; \
  232. else \
  233. if test -d $(DESTDIR)$(localedir)/$$lang/$$lc; then \
  234. :; \
  235. else \
  236. rm -f $(DESTDIR)$(localedir)/$$lang/$$lc; \
  237. mkdir $(DESTDIR)$(localedir)/$$lang/$$lc; \
  238. fi; \
  239. fi; \
  240. fi; \
  241. done; \
  242. done
  243. # Define this as empty until I found a useful application.
  244. installcheck:
  245. uninstall: uninstall-exec uninstall-data
  246. uninstall-exec:
  247. uninstall-data: uninstall-data-@USE_NLS@
  248. if test "$(PACKAGE)" = "gettext-tools"; then \
  249. for file in $(DISTFILES.common) Makevars.template; do \
  250. rm -f $(DESTDIR)$(gettextsrcdir)/$$file; \
  251. done; \
  252. else \
  253. : ; \
  254. fi
  255. uninstall-data-no:
  256. uninstall-data-yes:
  257. catalogs='$(CATALOGS)'; \
  258. for cat in $$catalogs; do \
  259. cat=`basename $$cat`; \
  260. lang=`echo $$cat | sed -e 's/\.gmo$$//'`; \
  261. for lc in LC_MESSAGES $(EXTRA_LOCALE_CATEGORIES); do \
  262. rm -f $(DESTDIR)$(localedir)/$$lang/$$lc/$(DOMAIN).mo; \
  263. done; \
  264. done
  265. check: all
  266. info dvi ps pdf html tags TAGS ctags CTAGS ID:
  267. mostlyclean:
  268. rm -f remove-potcdate.sed
  269. rm -f stamp-poT
  270. rm -f core core.* $(DOMAIN).po $(DOMAIN).1po $(DOMAIN).2po *.new.po
  271. rm -fr *.o
  272. clean: mostlyclean
  273. distclean: clean
  274. rm -f Makefile Makefile.in POTFILES *.mo
  275. maintainer-clean: distclean
  276. @echo "This command is intended for maintainers to use;"
  277. @echo "it deletes files that may require special tools to rebuild."
  278. rm -f stamp-po $(GMOFILES)
  279. distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
  280. dist distdir:
  281. $(MAKE) update-po
  282. @$(MAKE) dist2
  283. # This is a separate target because 'update-po' must be executed before.
  284. dist2: stamp-po $(DISTFILES)
  285. dists="$(DISTFILES)"; \
  286. if test "$(PACKAGE)" = "gettext-tools"; then \
  287. dists="$$dists Makevars.template"; \
  288. fi; \
  289. if test -f $(srcdir)/$(DOMAIN).pot; then \
  290. dists="$$dists $(DOMAIN).pot stamp-po"; \
  291. fi; \
  292. if test -f $(srcdir)/ChangeLog; then \
  293. dists="$$dists ChangeLog"; \
  294. fi; \
  295. for i in 0 1 2 3 4 5 6 7 8 9; do \
  296. if test -f $(srcdir)/ChangeLog.$$i; then \
  297. dists="$$dists ChangeLog.$$i"; \
  298. fi; \
  299. done; \
  300. if test -f $(srcdir)/LINGUAS; then dists="$$dists LINGUAS"; fi; \
  301. for file in $$dists; do \
  302. if test -f $$file; then \
  303. cp -p $$file $(distdir) || exit 1; \
  304. else \
  305. cp -p $(srcdir)/$$file $(distdir) || exit 1; \
  306. fi; \
  307. done
  308. update-po: Makefile
  309. $(MAKE) $(DOMAIN).pot-update
  310. test -z "$(UPDATEPOFILES)" || $(MAKE) $(UPDATEPOFILES)
  311. $(MAKE) update-gmo
  312. # General rule for creating PO files.
  313. .nop.po-create:
  314. @lang=`echo $@ | sed -e 's/\.po-create$$//'`; \
  315. echo "File $$lang.po does not exist. If you are a translator, you can create it through 'msginit'." 1>&2; \
  316. exit 1
  317. # General rule for updating PO files.
  318. .nop.po-update:
  319. @lang=`echo $@ | sed -e 's/\.po-update$$//'`; \
  320. if test "$(PACKAGE)" = "gettext-tools"; then PATH=`pwd`/../src:$$PATH; fi; \
  321. tmpdir=`pwd`; \
  322. echo "$$lang:"; \
  323. test "$(srcdir)" = . && cdcmd="" || cdcmd="cd $(srcdir) && "; \
  324. echo "$${cdcmd}$(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$lang.new.po"; \
  325. cd $(srcdir); \
  326. if $(MSGMERGE) $$lang.po $(DOMAIN).pot -o $$tmpdir/$$lang.new.po; then \
  327. if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
  328. rm -f $$tmpdir/$$lang.new.po; \
  329. else \
  330. if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
  331. :; \
  332. else \
  333. echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
  334. exit 1; \
  335. fi; \
  336. fi; \
  337. else \
  338. echo "msgmerge for $$lang.po failed!" 1>&2; \
  339. rm -f $$tmpdir/$$lang.new.po; \
  340. fi
  341. $(DUMMYPOFILES):
  342. update-gmo: Makefile $(GMOFILES)
  343. @:
  344. Makefile: Makefile.in.in Makevars $(top_builddir)/config.status @POMAKEFILEDEPS@
  345. cd $(top_builddir) \
  346. && $(SHELL) ./config.status $(subdir)/$@.in po-directories
  347. force:
  348. # Tell versions [3.59,3.63) of GNU make not to export all variables.
  349. # Otherwise a system limit (for SysV at least) may be exceeded.
  350. .NOEXPORT: