Makefile.in.in 12 KB

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