Makefile.in.in 13 KB

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