Makefile.in.in 14 KB

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