Makefile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. # Makefile for program source directory in GNU NLS utilities package.
  2. # Copyright (C) 1995-1997, 2000, 2001 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
  3. #
  4. # This file file be copied and used freely without restrictions. It can
  5. # be used in projects which are not available under the GNU Public License
  6. # but which still want to provide support for the GNU gettext functionality.
  7. # Please note that the actual code is *not* freely available.
  8. include ../common.mk
  9. prefix = /usr
  10. exec_prefix = ${prefix}
  11. datadir = $(prefix)/share
  12. localedir = $(datadir)/locale
  13. gettextsrcdir = $(prefix)/share/gettext/po
  14. subdir = po
  15. srcdir = .
  16. INSTALL = /usr/bin/install -c
  17. MSGFMT = /usr/bin/msgfmt --statistics
  18. XGETTEXT = /usr/bin/xgettext
  19. MSGMERGE = msgmerge
  20. MSGFMT = msgfmt
  21. POFILES = $(wildcard *.po)
  22. MOFILES = $(patsubst %.po,%.mo,$(POFILES))
  23. SRCFILES = ../apt-listchanges.py $(wildcard ../apt-listchanges/*.py) \
  24. ../apt-listchanges/apt-listchanges.ui
  25. all: $(PACKAGE).pot $(MOFILES)
  26. .SUFFIXES: .po .mo
  27. .po.mo:
  28. $(MSGFMT) -o $@ $<
  29. $(PACKAGE).pot: $(SRCFILES)
  30. if test -f $(XGETTEXT); then \
  31. $(XGETTEXT) $(XGETTEXT_COMMON_OPTIONS) \
  32. -k_ $(SRCFILES) -o$@; \
  33. else \
  34. echo "Warning: $@ is not updated"; \
  35. touch $@; \
  36. fi
  37. install: all
  38. for file in $(MOFILES); do \
  39. lang=`echo $$file | sed 's/\.mo//'`; \
  40. install -d $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/; \
  41. install -m 0644 $$file $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
  42. done
  43. clean:
  44. rm -f core core.* *.pox $(PACKAGE).po *.new.po
  45. rm -fr *.o *.mo
  46. distclean: clean
  47. rm -f $(PACKAGE).pot
  48. update-po: Makefile
  49. rm -f $(PACKAGE).pot
  50. $(MAKE) $(PACKAGE).pot
  51. if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
  52. cd $(srcdir); \
  53. catalogs='$(MOFILES)'; \
  54. for cat in $$catalogs; do \
  55. cat=`basename $$cat`; \
  56. lang=`echo $$cat | sed 's/\.mo$$//'`; \
  57. echo "$$lang:"; \
  58. if $(MSGMERGE) --previous $$lang.po $(PACKAGE).pot -o $$lang.new.po; then \
  59. mv -f $$lang.new.po $$lang.po; \
  60. $(MSGFMT) --statistics $$lang.po; rm -f messages.mo; \
  61. else \
  62. echo "msgmerge for $$cat failed!"; \
  63. rm -f $$lang.new.po; \
  64. fi; \
  65. done