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 General 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 datarootdir = @datarootdir@
27 localedir = $(datadir)/locale
28 gettextsrcdir = $(datadir)/gettext/po
31 INSTALL_DATA = @INSTALL_DATA@
32 MKINSTALLDIRS = @MKINSTALLDIRS@
33 mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
45 INCLUDES = -I.. -I$(top_srcdir)/intl
47 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
51 DISTFILES = Makefile.in.in POTFILES.in $(PACKAGE).pot \
52 $(POFILES) $(GMOFILES)
54 # need two spaces before = as m4/gettext.m4 matches against
55 # 'POTFILES[space]=' to add files from POTFILES
56 BUILT_POTFILES = $(top_builddir)/keymap_alldefs.h
63 .SUFFIXES: .c .o .po .pox .gmo .mo
69 $(MAKE) $(PACKAGE).pot
70 $(MSGMERGE) $< $(PACKAGE).pot -o $*.pox
76 file=`echo $* | sed 's,.*/,,'`.gmo \
77 && rm -f $$file && $(GMSGFMT) --statistics -o $$file $<
85 $(top_builddir)/keymap_alldefs.h:
86 ( cd $(top_builddir) && $(MAKE) keymap_alldefs.h )
88 # Note: Target 'all' must not depend on target '$(srcdir)/$(PACKAGE).pot',
89 # otherwise packages like GCC can not be built if only parts of the source
90 # have been downloaded.
92 $(PACKAGE).pot: $(POTFILES) $(BUILT_POTFILES) $(srcdir)/POTFILES.in
93 rm -f $(PACKAGE).pot $(PACKAGE).po
94 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
95 --add-comments --keyword=_ --keyword=N_ \
96 --files-from=$(srcdir)/POTFILES.in \
98 $(XGETTEXT) --default-domain=$(PACKAGE) \
99 --add-comments --keyword=_ --keyword=N_ \
100 --join $(BUILT_POTFILES) \
101 && test ! -f $(PACKAGE).po \
102 || ( rm -f $(PACKAGE).pot \
103 && mv $(PACKAGE).po $(PACKAGE).pot )
106 install: install-exec install-data
108 install-data: install-data-@USE_NLS@
109 if test "$(PACKAGE)" = "gettext"; then \
110 $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
111 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
112 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
117 install-data-yes: all
118 $(mkinstalldirs) $(DESTDIR)$(datadir)
119 @catalogs='$(CATALOGS)'; \
120 for cat in $$catalogs; do \
121 cat=`basename $$cat`; \
122 lang=`echo $$cat | sed 's/\.gmo$$//'`; \
123 dir=$(localedir)/$$lang/LC_MESSAGES; \
124 $(mkinstalldirs) $(DESTDIR)$$dir; \
125 if test -r $$cat; then \
126 $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
127 echo "installing $$cat as $(DESTDIR)$$dir/$(PACKAGE).mo"; \
129 $(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
130 echo "installing $(srcdir)/$$cat as" \
131 "$(DESTDIR)$$dir/$(PACKAGE).mo"; \
135 # Define this as empty until I found a useful application.
139 catalogs='$(CATALOGS)'; \
140 for cat in $$catalogs; do \
141 cat=`basename $$cat`; \
142 lang=`echo $$cat | sed 's/\.gmo$$//'`; \
143 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
145 if test "$(PACKAGE)" = "gettext"; then \
146 rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
153 dvi info tags TAGS ID:
156 rm -f core core.* *.pox $(PACKAGE).po *.new.po
162 rm -f Makefile Makefile.in POTFILES *.mo
164 maintainer-clean: distclean
165 @echo "This command is intended for maintainers to use;"
166 @echo "it deletes files that may require special tools to rebuild."
169 distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
170 dist distdir: $(DISTFILES)
171 dists="$(DISTFILES)"; \
172 for file in $$dists; do \
173 if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
174 cp -p $$dir/$$file $(distdir); \
178 $(MAKE) $(PACKAGE).pot
179 if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
181 catalogs='$(GMOFILES)'; \
182 for cat in $$catalogs; do \
183 cat=`basename $$cat`; \
184 lang=`echo $$cat | sed 's/\.gmo$$//'`; \
186 if $(MSGMERGE) $$lang.po $(PACKAGE).pot -o $$lang.new.po; then \
187 mv -f $$lang.new.po $$lang.po; \
189 echo "msgmerge for $$cat failed!"; \
190 rm -f $$lang.new.po; \
195 update-gmo: Makefile $(GMOFILES)
198 Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
200 && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
201 $(SHELL) ./config.status
203 # Tell versions [3.59,3.63) of GNU make not to export all variables.
204 # Otherwise a system limit (for SysV at least) may be exceeded.