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
20 GETTEXT_PACKAGE = @GETTEXT_PACKAGE@
21 PACKAGE = @PACKAGE@
22 VERSION = @VERSION@
24 SHELL = /bin/sh
26 srcdir = @srcdir@
27 top_srcdir = @top_srcdir@
28 top_builddir = @top_builddir@
29 VPATH = @srcdir@
31 prefix = @prefix@
32 exec_prefix = @exec_prefix@
33 datadir = @datadir@
34 datarootdir = @datarootdir@
35 libdir = @libdir@
36 DATADIRNAME = @DATADIRNAME@
37 itlocaledir = $(prefix)/$(DATADIRNAME)/locale
38 subdir = po
39 install_sh = @install_sh@
40 # Automake >= 1.8 provides @mkdir_p@.
41 # Until it can be supposed, use the safe fallback:
42 mkdir_p = $(install_sh) -d
44 INSTALL = @INSTALL@
45 INSTALL_DATA = @INSTALL_DATA@
47 GMSGFMT = @GMSGFMT@
48 MSGFMT = @MSGFMT@
49 XGETTEXT = @XGETTEXT@
50 INTLTOOL_UPDATE = @INTLTOOL_UPDATE@
51 INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@
52 MSGMERGE = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --dist
53 GENPOT = INTLTOOL_EXTRACT=$(INTLTOOL_EXTRACT) srcdir=$(srcdir) $(INTLTOOL_UPDATE) --gettext-package $(GETTEXT_PACKAGE) --pot
55 ALL_LINGUAS = @ALL_LINGUAS@
57 PO_LINGUAS=$(shell if test -r $(srcdir)/LINGUAS; then grep -v "^\#" $(srcdir)/LINGUAS; fi)
59 USER_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)
61 USE_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)
63 POFILES=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.po "; done)
65 DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(POFILES)
66 EXTRA_DISTFILES = POTFILES.skip Makevars LINGUAS
68 POTFILES = \
69 # This comment gets stripped out
71 CATALOGS=$(shell LINGUAS="$(USE_LINGUAS)"; for lang in $$LINGUAS; do printf "$$lang.gmo "; done)
73 .SUFFIXES:
74 .SUFFIXES: .po .pox .gmo .mo .msg .cat
76 .po.pox:
77 $(MAKE) $(GETTEXT_PACKAGE).pot
78 $(MSGMERGE) $< $(GETTEXT_PACKAGE).pot -o $*.pox
80 .po.mo:
81 $(MSGFMT) -o $@ $<
83 .po.gmo:
84 file=`echo $* | sed 's,.*/,,'`.gmo \
85 && rm -f $$file && $(GMSGFMT) -o $$file $<
87 .po.cat:
88 sed -f ../intl/po2msg.sed < $< > $*.msg \
89 && rm -f $@ && gencat $@ $*.msg
92 all: all-@USE_NLS@
94 all-yes: $(CATALOGS)
95 all-no:
97 $(GETTEXT_PACKAGE).pot: $(POTFILES)
98 $(GENPOT)
100 install: install-data
101 install-data: install-data-@USE_NLS@
102 install-data-no: all
103 install-data-yes: all
104 $(mkdir_p) $(DESTDIR)$(itlocaledir)
105 linguas="$(USE_LINGUAS)"; \
106 for lang in $$linguas; do \
107 dir=$(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES; \
108 $(mkdir_p) $$dir; \
109 if test -r $$lang.gmo; then \
110 $(INSTALL_DATA) $$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
111 echo "installing $$lang.gmo as $$dir/$(GETTEXT_PACKAGE).mo"; \
112 else \
113 $(INSTALL_DATA) $(srcdir)/$$lang.gmo $$dir/$(GETTEXT_PACKAGE).mo; \
114 echo "installing $(srcdir)/$$lang.gmo as" \
115 "$$dir/$(GETTEXT_PACKAGE).mo"; \
116 fi; \
117 if test -r $$lang.gmo.m; then \
118 $(INSTALL_DATA) $$lang.gmo.m $$dir/$(GETTEXT_PACKAGE).mo.m; \
119 echo "installing $$lang.gmo.m as $$dir/$(GETTEXT_PACKAGE).mo.m"; \
120 else \
121 if test -r $(srcdir)/$$lang.gmo.m ; then \
122 $(INSTALL_DATA) $(srcdir)/$$lang.gmo.m \
123 $$dir/$(GETTEXT_PACKAGE).mo.m; \
124 echo "installing $(srcdir)/$$lang.gmo.m as" \
125 "$$dir/$(GETTEXT_PACKAGE).mo.m"; \
126 else \
127 true; \
128 fi; \
129 fi; \
130 done
132 # Empty stubs to satisfy archaic automake needs
133 dvi info tags TAGS ID:
135 # Define this as empty until I found a useful application.
136 install-exec installcheck:
138 uninstall:
139 linguas="$(USE_LINGUAS)"; \
140 for lang in $$linguas; do \
141 rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo; \
142 rm -f $(DESTDIR)$(itlocaledir)/$$lang/LC_MESSAGES/$(GETTEXT_PACKAGE).mo.m; \
143 done
145 check: all $(GETTEXT_PACKAGE).pot
146 rm -f missing notexist
147 srcdir=$(srcdir) $(INTLTOOL_UPDATE) -m
148 if [ -r missing -o -r notexist ]; then \
149 exit 1; \
150 fi
152 mostlyclean:
153 rm -f *.pox $(GETTEXT_PACKAGE).pot *.old.po cat-id-tbl.tmp
154 rm -f .intltool-merge-cache
156 clean: mostlyclean
158 distclean: clean
159 rm -f Makefile Makefile.in POTFILES stamp-it
160 rm -f *.mo *.msg *.cat *.cat.m *.gmo
162 maintainer-clean: distclean
163 @echo "This command is intended for maintainers to use;"
164 @echo "it deletes files that may require special tools to rebuild."
165 rm -f Makefile.in.in
167 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
168 dist distdir: $(DISTFILES)
169 dists="$(DISTFILES)"; \
170 extra_dists="$(EXTRA_DISTFILES)"; \
171 for file in $$extra_dists; do \
172 test -f $(srcdir)/$$file && dists="$$dists $(srcdir)/$$file"; \
173 done; \
174 for file in $$dists; do \
175 test -f $$file || file="$(srcdir)/$$file"; \
176 ln $$file $(distdir) 2> /dev/null \
177 || cp -p $$file $(distdir); \
178 done
180 update-po: Makefile
181 $(MAKE) $(GETTEXT_PACKAGE).pot
182 tmpdir=`pwd`; \
183 linguas="$(USE_LINGUAS)"; \
184 for lang in $$linguas; do \
185 echo "$$lang:"; \
186 result="`$(MSGMERGE) -o $$tmpdir/$$lang.new.po $$lang`"; \
187 if $$result; then \
188 if cmp $(srcdir)/$$lang.po $$tmpdir/$$lang.new.po >/dev/null 2>&1; then \
189 rm -f $$tmpdir/$$lang.new.po; \
190 else \
191 if mv -f $$tmpdir/$$lang.new.po $$lang.po; then \
192 :; \
193 else \
194 echo "msgmerge for $$lang.po failed: cannot move $$tmpdir/$$lang.new.po to $$lang.po" 1>&2; \
195 rm -f $$tmpdir/$$lang.new.po; \
196 exit 1; \
197 fi; \
198 fi; \
199 else \
200 echo "msgmerge for $$lang.gmo failed!"; \
201 rm -f $$tmpdir/$$lang.new.po; \
202 fi; \
203 done
205 Makefile POTFILES: stamp-it
206 @if test ! -f $@; then \
207 rm -f stamp-it; \
208 $(MAKE) stamp-it; \
209 fi
211 stamp-it: Makefile.in.in $(top_builddir)/config.status POTFILES.in
212 cd $(top_builddir) \
213 && CONFIG_FILES=$(subdir)/Makefile.in CONFIG_HEADERS= CONFIG_LINKS= \
214 $(SHELL) ./config.status
216 # Tell versions [3.59,3.63) of GNU make not to export all variables.
217 # Otherwise a system limit (for SysV at least) may be exceeded.
218 .NOEXPORT: