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>
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
9PACKAGE = @PACKAGE@
10VERSION = @VERSION@
11
12# These two variables depend on the location of this directory.
13subdir = po
14top_builddir = ..
15
16SHELL = /bin/sh
17@SET_MAKE@
18
19srcdir = @srcdir@
20top_srcdir = @top_srcdir@
21VPATH = @srcdir@
22
23prefix = @prefix@
24exec_prefix = @exec_prefix@
25datadir = @datadir@
26localedir = $(datadir)/locale
27gettextsrcdir = $(datadir)/gettext/po
28
29INSTALL = @INSTALL@
30INSTALL_DATA = @INSTALL_DATA@
31MKINSTALLDIRS = $(top_srcdir)/@MKINSTALLDIRS@
32mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_srcdir)/mkinstalldirs" ;; esac`
33
34CC = @CC@
35GMSGFMT = @GMSGFMT@
36MSGFMT = @MSGFMT@
37XGETTEXT = @XGETTEXT@
38MSGMERGE = msgmerge
39
40DEFS = @DEFS@
41CFLAGS = @CFLAGS@
42CPPFLAGS = @CPPFLAGS@
43
44INCLUDES = -I.. -I$(top_srcdir)/intl
45
46COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
47
48POFILES = @POFILES@
49GMOFILES = @GMOFILES@
50DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
51$(POFILES) $(GMOFILES)
52
53POTFILES = \
54
55CATALOGS = @CATALOGS@
56
57.SUFFIXES:
58.SUFFIXES: .c .o .po .pox .gmo .mo
59
60.c.o:
61	$(COMPILE) $<
62
63.po.pox:
64	$(MAKE) $(PACKAGE).pot
65	$(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
66
67.po.mo:
68	$(MSGFMT) -o $@ $<
69
70.po.gmo:
71	file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
72	  && rm -f $$file && $(GMSGFMT) --statistics -o $$file $<
73
74
75all: all-@USE_NLS@
76
77all-yes: $(CATALOGS)
78all-no:
79
80# Note: Target 'all' must not depend on target '$(srcdir)/$(PACKAGE).pot',
81# otherwise packages like GCC can not be built if only parts of the source
82# have been downloaded.
83
84$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in
85	$(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
86	  --add-comments --keyword=_ --keyword=N_ \
87	  --files-from=$(srcdir)/POTFILES.in \
88	&& test ! -f $(PACKAGE).po \
89	   || ( rm -f $(srcdir)/$(PACKAGE).pot \
90		&& mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
91
92
93install: install-exec install-data
94install-exec:
95install-data: install-data-@USE_NLS@
96	if test "$(PACKAGE)" = "gettext"; then \
97	  $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
98	  $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
99			  $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
100	else \
101	  : ; \
102	fi
103install-data-no: all
104install-data-yes: all
105	$(mkinstalldirs) $(DESTDIR)$(datadir)
106	@catalogs='$(CATALOGS)'; \
107	for cat in $$catalogs; do \
108	  cat=`basename $$cat`; \
109	  lang=`echo $$cat | sed 's/\.gmo$$//'`; \
110	  dir=$(localedir)/$$lang/LC_MESSAGES; \
111	  $(mkinstalldirs) $(DESTDIR)$$dir; \
112	  if test -r $$cat; then \
113	    $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
114	    echo "installing $$cat as $(DESTDIR)$$dir/$(PACKAGE).mo"; \
115	  else \
116	    $(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
117	    echo "installing $(srcdir)/$$cat as" \
118		 "$(DESTDIR)$$dir/$(PACKAGE).mo"; \
119	  fi; \
120	done
121
122# Define this as empty until I found a useful application.
123installcheck:
124
125uninstall:
126	catalogs='$(CATALOGS)'; \
127	for cat in $$catalogs; do \
128	  cat=`basename $$cat`; \
129	  lang=`echo $$cat | sed 's/\.gmo$$//'`; \
130	  rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
131	done
132	if test "$(PACKAGE)" = "gettext"; then \
133	  rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
134	else \
135	  : ; \
136	fi
137
138check: all
139
140dvi info tags TAGS ID:
141
142mostlyclean:
143	rm -f core core.* *.pox $(PACKAGE).po *.new.po
144	rm -fr *.o
145
146clean: mostlyclean
147
148distclean: clean
149	rm -f Makefile Makefile.in POTFILES *.mo
150
151maintainer-clean: distclean
152	@echo "This command is intended for maintainers to use;"
153	@echo "it deletes files that may require special tools to rebuild."
154	rm -f $(GMOFILES)
155
156distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
157dist distdir:
158	$(MAKE) update-po
159	@$(MAKE) dist2
160# This is a separate target because 'update-po' must be executed before.
161dist2: $(DISTFILES)
162	dists="$(DISTFILES)"; \
163	for file in $$dists; do \
164	  if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
165	  cp -p $$dir/$$file $(distdir); \
166	done
167
168update-po: Makefile
169	$(MAKE) $(PACKAGE).pot
170	if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
171	cd $(srcdir); \
172	catalogs='$(GMOFILES)'; \
173	for cat in $$catalogs; do \
174	  cat=`basename $$cat`; \
175	  lang=`echo $$cat | sed 's/\.gmo$$//'`; \
176	  echo "$$lang:"; \
177	  if $(MSGMERGE) $$lang.po $(PACKAGE).pot -o $$lang.new.po; then \
178	    mv -f $$lang.new.po $$lang.po; \
179	  else \
180	    echo "msgmerge for $$cat failed!"; \
181	    rm -f $$lang.new.po; \
182	  fi; \
183	done
184	$(MAKE) update-gmo
185
186update-gmo: Makefile $(GMOFILES)
187	@:
188
189Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
190	cd $(top_builddir) \
191	  && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
192	       $(SHELL) ./config.status
193
194# Tell versions [3.59,3.63) of GNU make not to export all variables.
195# Otherwise a system limit (for SysV at least) may be exceeded.
196.NOEXPORT:
197