Makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. NAME=vbootstrap
  2. GETTEXT_PACKAGE = ${NAME}
  3. srcdir = .
  4. top_srcdir = ..
  5. prefix = /usr
  6. datadir = ${prefix}/share
  7. gnulocaledir = $(datadir)/locale
  8. DESTDIR=
  9. GMSGFMT = /usr/bin/msgfmt
  10. XGETTEXT = /usr/bin/xgettext
  11. MSGMERGE = msgmerge
  12. LANGS=ja
  13. POFILES=$(shell for lang in "$(LANGS)"; do printf "$$lang.po "; done)
  14. GMOFILES=$(shell for lang in "$(LANGS)"; do printf "$$lang.gmo "; done;)
  15. CATALOGS=$(GMOFILES)
  16. CATOBJEXT = .gmo
  17. INSTOBJEXT = .mo
  18. .SUFFIXES: .po .pox .gmo .mo .msg .cat
  19. .po.pox:
  20. $(MAKE) $(GETTEXT_PACKAGE).pot
  21. $(MSGMERGE) $< $(srcdir)/$(GETTEXT_PACKAGE).pot -o $*.pox
  22. .po.gmo:
  23. file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
  24. && rm -f $$file && $(GMSGFMT) -c -o $$file $<
  25. all: $(CATALOGS)
  26. $(GETTEXT_PACKAGE).pot: $(srcdir)/$(GETTEXT_PACKAGE).pot
  27. $(srcdir)/$(GETTEXT_PACKAGE).pot:
  28. $(XGETTEXT) --default-domain=$(GETTEXT_PACKAGE) --directory=$(top_srcdir) \
  29. --add-comments --from-code=UTF-8 --keyword=_ --keyword=N_ \
  30. --flag=g_strdup_printf:1:c-format \
  31. --flag=g_string_printf:2:c-format \
  32. --flag=g_string_append_printf:2:c-format \
  33. --flag=g_error_new:3:c-format \
  34. --flag=g_set_error:4:c-format \
  35. --flag=g_markup_printf_escaped:1:c-format \
  36. --flag=g_log:3:c-format \
  37. --flag=g_print:1:c-format \
  38. --flag=g_printerr:1:c-format \
  39. --flag=g_printf:1:c-format \
  40. --flag=g_fprintf:2:c-format \
  41. --flag=g_sprintf:2:c-format \
  42. --flag=g_snprintf:3:c-format \
  43. --flag=g_scanner_error:2:c-format \
  44. --flag=g_scanner_warn:2:c-format \
  45. --files-from=$(srcdir)/POTFILES.in \
  46. && test ! -f $(GETTEXT_PACKAGE).po \
  47. || ( rm -f $(srcdir)/$(GETTEXT_PACKAGE).pot \
  48. && mv $(GETTEXT_PACKAGE).po $(srcdir)/$(GETTEXT_PACKAGE).pot )
  49. install: all
  50. @mkdir -p $(DESTDIR)$(datadir)
  51. @catalogs='$(CATALOGS)'; \
  52. for cat in $$catalogs; do \
  53. cat=`basename $$cat`; \
  54. destdir=$(gnulocaledir); \
  55. lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
  56. dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
  57. mkdir -p $$dir; \
  58. install -m0644 $$cat $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT); \
  59. echo "installing $$cat as $$dir/$(GETTEXT_PACKAGE)$(INSTOBJEXT)"; \
  60. done
  61. update-po: Makefile
  62. $(MAKE) $(GETTEXT_PACKAGE).pot
  63. tmpdir=`pwd`; \
  64. cd $(srcdir); \
  65. catalogs='$(CATALOGS)'; \
  66. for cat in $$catalogs; do \
  67. cat=`basename $$cat`; \
  68. lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
  69. echo "$$lang:"; \
  70. if $(MSGMERGE) $$lang.po $(GETTEXT_PACKAGE).pot -o $$tmpdir/$$lang.new.po; then \
  71. if cmp $$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
  72. rm -f $$tmpdir/$$lang.new.po; \
  73. else \
  74. if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
  75. :; \
  76. else \
  77. echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
  78. rm -f $$tmpdir/$$lang.new.po; \
  79. exit 1; \
  80. fi; \
  81. fi; \
  82. else \
  83. echo "msgmerge for $$cat failed!"; \
  84. rm -f $$tmpdir/$$lang.new.po; \
  85. fi; \
  86. done
  87. clean:
  88. rm -f *~ *.gmo