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)
201 && ( cd $(top_srcdir); \
202 grep -l "_(\".*\")" `find src -name \*.[hHC] -print` |\
203 sed -e '/xforms.forms/d' | \
204 LC_COLLATE=C sort | uniq ) > $@-t \
208 l10n_pots: $(srcdir)/xforms_l10n.pot $(srcdir)/qt_l10n.pot $(srcdir)/layouts_l10n.pot $(srcdir)/languages_l10n.pot $(srcdir)/ui_l10n.pot
209 cat $(srcdir)/xforms_l10n.pot $(srcdir)/qt_l10n.pot $(srcdir)/layouts_l10n.pot $(srcdir)/languages_l10n.pot $(srcdir)/ui_l10n.pot | \
210 msguniq -o $(PACKAGE).po
212 $(srcdir)/xforms_l10n.pot: $(top_srcdir)/src/frontends/xforms/forms/*.fd
217 print "msgid \"\""; \
218 print "msgstr \"\""; \
219 print "\"Content-Type: text/plain; charset=ISO-8859-1\\n\""; \
220 print "\"Content-Transfer-Encoding: 8bit\\n\""; \
228 if (NF > 1 && skip == 0) { \
230 sub(/label: /,"",line);\
231 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", FILENAME, FNR, line);\
235 ../src/frontends/xforms/forms/*.fd > xforms_l10n.pot
237 $(srcdir)/qt_l10n.pot: $(top_srcdir)/src/frontends/qt2/ui/*.ui
242 sub(/.*<string>/, "", line); \
243 sub(/<\/string>.*/, "", line); \
244 gsub(/&/, "\\&", line); \
245 gsub(/</, "<", line); \
246 gsub(/>/, ">", line); \
247 gsub(/\"/, "\\\"", line); \
248 if (length(line) > 0) \
249 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n",\
250 FILENAME, FNR, line); \
252 ../src/frontends/qt2/ui/*.ui > qt_l10n.pot
254 $(srcdir)/layouts_l10n.pot: $(top_srcdir)/lib/layouts/*.layout $(top_srcdir)/lib/layouts/*.inc
259 sub(/Style /, "", line); \
260 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
261 FILENAME, FNR, line); \
265 sub(/[[:space:]]*GuiName[[:space:]]*/, "", line); \
266 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
267 FILENAME, FNR, line); \
269 ' ../lib/layouts/*.layout ../lib/layouts/*.inc > layouts_l10n.pot
271 $(srcdir)/languages_l10n.pot: $(top_srcdir)/lib/languages
278 match($$0,"\"[^\"]*\""); \
279 lang=substr($$0,RSTART,RLENGTH); \
280 gsub(/\"/, "", lang); \
281 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
282 FILENAME, FNR, lang); \
284 ' ../lib/languages > languages_l10n.pot
286 $(srcdir)/ui_l10n.pot: $(top_srcdir)/lib/ui/*.ui
291 sub(/[^"]*"/, "", line); \
292 sub(/".*/, "", line); \
293 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
294 FILENAME, FNR, line); \
298 sub(/[^"]*"/, "", line); \
299 sub(/".*/, "", line); \
300 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
301 FILENAME, FNR, line); \
305 sub(/[^"]*"/, "", line); \
306 sub(/".*/, "", line); \
307 printf("#: %s:%d\nmsgid \"%s\"\nmsgstr \"\"\n\n", \
308 FILENAME, FNR, line); \
310 ' ../lib/ui/*.ui > ui_l10n.pot
312 # Tell versions [3.59,3.63) of GNU make not to export all variables.
313 # Otherwise a system limit (for SysV at least) may be exceeded.