1# Makefile for program source directory in GNU NLS utilities package.
2# Copyright (C) 1995, 1996, 1997 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#
9# - Modified by Owen Taylor <otaylor@redhat.com> to use GETTEXT_PACKAGE
10#   instead of PACKAGE and to look for po2tbl in ./ not in intl/
11#
12# - Modified by jacob berkman <jacob@ximian.com> to install
13#   Makefile.in.in and po2tbl.sed.in for use with glib-gettextize
14#
15# - Modified by Rodney Dawes <dobey@novell.com> for use with intltool
16#
17# We have the following line for use by intltoolize:
18# INTLTOOL_MAKEFILE
19
20GETTEXT_PACKAGE = @GETTEXT_PACKAGE@-libgimp
21XGETTEXT_KEYWORDS=--keyword=_ --keyword=N_ --keyword=Q_:1g --keyword=C_:1c,2 --keyword=NC_:1c,2
22
23PACKAGE = @PACKAGE@
24VERSION = @VERSION@
25
26SHELL = /bin/sh
27
28srcdir = @srcdir@
29top_srcdir = @top_srcdir@
30top_builddir = @top_builddir@
31VPATH = @srcdir@
32
33prefix = @prefix@
34exec_prefix = @exec_prefix@
35datadir = @datadir@
36datarootdir = @datarootdir@
37libdir = @libdir@
38DATADIRNAME = @DATADIRNAME@
39itlocaledir = $(prefix)/$(DATADIRNAME)/locale
40subdir = po-libgimp
41install_sh = @install_sh@
42# Automake >= 1.8 provides @mkdir_p@.
43# Until it can be supposed, use the safe fallback:
44mkdir_p = $(install_sh) -d
45
46INSTALL = @INSTALL@
47INSTALL_DATA = @INSTALL_DATA@
48
49GMSGFMT = @GMSGFMT@
50MSGFMT = @MSGFMT@
51XGETTEXT = @XGETTEXT@
52INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
53INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
54MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
55GENPOT   = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
56
57ALL_LINGUAS = @ALL_LINGUAS@
58
59PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; fi)
60
61USER_LINGUAS=$(shell if test -n "$(LINGUAS)"; then LLINGUAS="$(LINGUAS)"; ALINGUAS="$(ALL_LINGUAS)"; for lang in $$LLINGUAS; do if test -n "`grep ^$$lang$$ $(srcdir)/LINGUAS`" -o -n "`echo $$ALINGUAS|grep ' ?$$lang ?'`"; then printf "$$lang "; fi; done; fi)
62
63USE_LINGUAS=$(shell if test -n "$(USER_LINGUAS)"; then LLINGUAS="$(USER_LINGUAS)"; else if test -n "$(PO_LINGUAS)"; then LLINGUAS="$(PO_LINGUAS)"; else LLINGUAS="$(ALL_LINGUAS)"; fi; fi; for lang in $$LLINGUAS; do printf "$$lang "; done)
64
65POFILES=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
66
67DISTFILES = Makefile.in.in POTFILES.in $(POFILES)
68EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS
69
70POTFILES = \
71# This comment gets stripped out
72
73CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
74
75.SUFFIXES:
76.SUFFIXES: .po .pox .gmo .mo .msg .cat
77
78.po.pox:
79	$(MAKE) $(GETTEXT_PACKAGE).pot
80	$(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
81
82.po.mo:
83	$(MSGFMT) -o $@ $<
84
85.po.gmo:
86	file=`echo $* | sed 's,.*/,,'`.gmo \
87	  && rm -f $$file && $(GMSGFMT) -o $$file $<
88
89.po.cat:
90	sed -f ../intl/po2msg.sed < $< > $*.msg \
91	  && rm -f $@ && gencat $@ $*.msg
92
93
94all: all-@USE_NLS@
95
96all-yes: $(CATALOGS)
97all-no:
98
99$(GETTEXT_PACKAGE).pot: $(POTFILES)
100	$(GENPOT)
101
102install: install-data
103install-data: install-data-@USE_NLS@
104install-data-no: all
105install-data-yes: all
106	$(mkdir_p) $(DESTDIR)$(itlocaledir)
107	linguas="$(USE_LINGUAS)"; \
108	for lang in $$linguas; do \
109	  dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
110	  $(mkdir_p) $$dir; \
111	  if test -r $$lang.gmo; then \
112	    $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
113	    echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
114	  else \
115	    $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
116	    echo "installing $(srcdir)/$$lang.gmo as" \
117		 "$$dir/$(GETTEXT_PACKAGE).mo"; \
118	  fi; \
119	  if test -r $$lang.gmo.m; then \
120	    $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
121	    echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
122	  else \
123	    if test -r $(srcdir)/$$lang.gmo.m ; then \
124	      $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \
125		$$dir/$(GETTEXT_PACKAGE).mo.m; \
126	      echo "installing $(srcdir)/$$lang.gmo.m as" \
127		   "$$dir/$(GETTEXT_PACKAGE).mo.m"; \
128	    else \
129	      true; \
130	    fi; \
131	  fi; \
132	done
133
134# Empty stubs to satisfy archaic automake needs
135dvi info tags TAGS ID:
136
137# Define this as empty until I found a useful application.
138install-exec installcheck:
139
140uninstall:
141	linguas="$(USE_LINGUAS)"; \
142	for lang in $$linguas; do \
143	  rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
144	  rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
145	done
146
147check: all $(GETTEXT_PACKAGE).pot
148	rm -f missing notexist
149	srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m
150	if [ -r missing -o -r notexist ]; then \
151	  exit 1; \
152	fi
153
154mostlyclean:
155	rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
156	rm -f .intltool-merge-cache
157
158clean: mostlyclean
159
160distclean: clean
161	rm -f Makefile Makefile.in POTFILES stamp-it
162	rm -f *.mo *.msg *.cat *.cat.m *.gmo
163
164maintainer-clean: distclean
165	@echo "This command is intended for maintainers to use;"
166	@echo "it deletes files that may require special tools to rebuild."
167	rm -f Makefile.in.in
168
169distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
170dist distdir: $(DISTFILES)
171	dists="$(DISTFILES)"; \
172	extra_dists="$(EXTRA_DISTFILES)"; \
173	for file in $$extra_dists; do \
174	  test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \
175	done; \
176	for file in $$dists; do \
177	  test -f $$file || file="$(srcdir)/$$file"; \
178	  ln $$file $(distdir) 2> /dev/null \
179	    || cp -p $$file $(distdir); \
180	done
181
182update-po: Makefile
183	$(MAKE) $(GETTEXT_PACKAGE).pot
184	tmpdir=`pwd`; \
185	linguas="$(USE_LINGUAS)"; \
186	for lang in $$linguas; do \
187	  echo "$$lang:"; \
188	  result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
189	  if $$result; then \
190	    if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
191	      rm -f $$tmpdir/$$lang.new.po; \
192            else \
193	      if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
194	        :; \
195	      else \
196	        echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
197	        rm -f $$tmpdir/$$lang.new.po; \
198	        exit 1; \
199	      fi; \
200	    fi; \
201	  else \
202	    echo "msgmerge for $$lang.gmo failed!"; \
203	    rm -f $$tmpdir/$$lang.new.po; \
204	  fi; \
205	done
206
207Makefile POTFILES: stamp-it
208	@if test ! -f $@; then \
209	  rm -f stamp-it; \
210	  $(MAKE) stamp-it; \
211	fi
212
213stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in
214	cd $(top_builddir) \
215	  && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \
216	       $(SHELL) ./config.status
217
218# Tell versions [3.59,3.63) of GNU make not to export all variables.
219# Otherwise a system limit (for SysV at least) may be exceeded.
220.NOEXPORT:
221