Makefile.in.in 13 KB

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