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>
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.
12 # These two variables depend on the location of this directory.
20 top_srcdir = @top_srcdir@
24 exec_prefix = @exec_prefix@
26 localedir = $(datadir)/locale
27 gettextsrcdir = $(datadir)/gettext/po
30 INSTALL_DATA = @INSTALL_DATA@
31 MKINSTALLDIRS = @MKINSTALLDIRS@
32 mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
44 INCLUDES = -I.. -I$(top_srcdir)/intl
46 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
50 DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
51 $(POFILES) $(GMOFILES) xforms_l10n.pot qt_l10n.pot layouts_l10n.pot \
52 languages_l10n.pot ui_l10n.pot
54 POTFILE_IN_DEPS = $(shell find $(top_srcdir)/src -name Makefile.am)
61 .SUFFIXES: .c .o .po .pox .gmo .mo
67 $(MAKE) $(srcdir)/$(PACKAGE).pot
68 $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
74 file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
75 && case "$(GMSGFMT)" in \
76 */msgfmt) rm -f $$file && $(GMSGFMT) --statistics -o $$file $<;; \
86 # Note: Target 'all' must not depend on target '$(srcdir)/$(PACKAGE).pot',
87 # otherwise packages like GCC can not be built if only parts of the source
88 # have been downloaded.
90 $(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in l10n_pots
91 $(XGETTEXT) --join-existing --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
92 --escape --add-comments --keyword=_ --keyword=N_ \
93 --keyword=qt_ --files-from=$(srcdir)/POTFILES.in \
94 && test ! -f $(PACKAGE).po \
95 || ( rm -f $(srcdir)/$(PACKAGE).pot \
96 && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot || true)
98 install: install-exec install-data
100 install-data: install-data-@USE_NLS@
101 if test "$(PACKAGE)" = "gettext"; then \
102 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
103 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
104 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
109 install-data-yes: all
110 $(mkinstalldirs) $(DESTDIR)$(datadir)
111 @catalogs='$(CATALOGS)'; \
112 for cat in $$catalogs; do \
113 cat=`basename $$cat`; \
114 lang=`echo $$cat | sed 's/\.gmo$$//'`; \
115 dir=$(localedir)/$$lang/LC_MESSAGES; \
116 $(mkinstalldirs) $(DESTDIR)$$dir; \
117 if test -r $$cat; then \
118 $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
119 echo "installing $$cat as $(DESTDIR)$$dir/$(PACKAGE).mo"; \
121 $(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
122 echo "installing $(srcdir)/$$cat as" \
123 "$(DESTDIR)$$dir/$(PACKAGE).mo"; \
127 # Define this as empty until I found a useful application.
131 catalogs='$(CATALOGS)'; \
132 for cat in $$catalogs; do \
133 cat=`basename $$cat`; \
134 lang=`echo $$cat | sed 's/\.gmo$$//'`; \
135 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
137 if test "$(PACKAGE)" = "gettext"; then \
138 rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
145 dvi info tags TAGS ID:
148 rm -f core core.* *.pox $(PACKAGE).po *.new.po
154 rm -f Makefile Makefile.in POTFILES *.mo
156 maintainer-clean: distclean
157 @echo "This command is intended for maintainers to use;"
158 @echo "it deletes files that may require special tools to rebuild."
161 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
165 # This is a separate target because 'update-po' must be executed before.
167 dists="$(DISTFILES)"; \
168 for file in $$dists; do \
169 if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
170 cp -p $$dir/$$file $(distdir); \
174 $(MAKE) $(PACKAGE).pot
175 if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
177 catalogs='$(GMOFILES)'; \
178 for cat in $$catalogs; do \
179 cat=`basename $$cat`; \
180 lang=`echo $$cat | sed 's/\.gmo$$//'`; \
182 if $(MSGMERGE) $$lang.po $(PACKAGE).pot -o $$lang.new.po; then \
183 mv -f $$lang.new.po $$lang.po; \
185 echo "msgmerge for $$cat failed!"; \
186 rm -f $$lang.new.po; \
191 update-gmo: Makefile $(GMOFILES)
194 Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
196 && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
197 $(SHELL) ./config.status
199 ${srcdir}/POTFILES.in: $(POTFILE_IN_DEPS)
200 LC_ALL=C ; export LC_ALL ; \
202 && ( cd $(top_srcdir); \
203 grep -l "_(\".*\")" `find src -name \*.[hHC] -print` |\
204 sed -e '/xforms.forms/d' | \
205 sort | uniq ) > $@-t \
209 l10n_pots: $(srcdir)/xforms_l10n.pot $(srcdir)/qt_l10n.pot $(srcdir)/layouts_l10n.pot $(srcdir)/languages_l10n.pot $(srcdir)/ui_l10n.pot
210 cat $(srcdir)/xforms_l10n.pot $(srcdir)/qt_l10n.pot $(srcdir)/layouts_l10n.pot $(srcdir)/languages_l10n.pot $(srcdir)/ui_l10n.pot | \
211 msguniq -o $(PACKAGE).po
213 $(srcdir)/xforms_l10n.pot: $(top_srcdir)/src/frontends/xforms/forms/*.fd
215 LC_ALL=C ; export LC_ALL ; \
219 print "msgid \"\""; \
220 print "msgstr \"\""; \
221 print "\"Content-Type: text/plain; charset=ISO-8859-1\\n\""; \
222 print "\"Content-Transfer-Encoding: 8bit\\n\""; \
230 if (NF > 1 && skip == 0) { \
232 sub(/label: /,"",line);\
233 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", FILENAME, FNR, line);\
237 ../src/frontends/xforms/forms/*.fd > xforms_l10n.pot
239 $(srcdir)/qt_l10n.pot: $(top_srcdir)/src/frontends/qt2/ui/*.ui
241 LC_ALL=C ; export LC_ALL ; \
245 sub(/.*<string>/, "", line); \
246 sub(/<\/string>.*/, "", line); \
247 gsub(/&/, "\\&", line); \
248 gsub(/</, "<", line); \
249 gsub(/>/, ">", line); \
250 gsub(/\"/, "\\\"", line); \
251 if (length(line) > 0) \
252 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n",\
253 FILENAME, FNR, line); \
255 ../src/frontends/qt2/ui/*.ui > qt_l10n.pot
257 $(srcdir)/layouts_l10n.pot: $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc
259 LC_ALL=C ; export LC_ALL ; \
263 sub(/Style /, "", line); \
264 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
265 FILENAME, FNR, line); \
269 sub(/[[:space:]]*GuiName[[:space:]]*/, "", line); \
270 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
271 FILENAME, FNR, line); \
273 ' ../lib/layouts/*.layout ../lib/layouts/*.inc > layouts_l10n.pot
275 $(srcdir)/languages_l10n.pot: $(top_srcdir)/lib/languages
282 match($$0,"\"[^\"]*\""); \
283 lang=substr($$0,RSTART,RLENGTH); \
284 gsub(/\"/, "", lang); \
285 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
286 FILENAME, FNR, lang); \
288 ' ../lib/languages > languages_l10n.pot
290 $(srcdir)/ui_l10n.pot: $(top_srcdir)/lib/ui/*.ui
292 LC_ALL=C ; export LC_ALL ; \
296 sub(/[^"]*"/, "", line); \
297 sub(/".*/, "", line); \
298 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
299 FILENAME, FNR, line); \
303 sub(/[^"]*"/, "", line); \
304 sub(/".*/, "", line); \
305 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
306 FILENAME, FNR, line); \
310 sub(/[^"]*"/, "", line); \
311 sub(/".*/, "", line); \
312 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
313 FILENAME, FNR, line); \
315 ' ../lib/ui/*.ui > ui_l10n.pot
317 # Tell versions [3.59,3.63) of GNU make not to export all variables.
318 # Otherwise a system limit (for SysV at least) may be exceeded.