Makefile.in.in 12 KB

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