Makefile.in.in 15 KB

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