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
9PACKAGE = @PACKAGE@
10VERSION = @VERSION@
11
12SHELL = /bin/sh
13@SET_MAKE@
14
15srcdir = @srcdir@
16top_srcdir = @top_srcdir@
17VPATH = @srcdir@
18
19prefix = @prefix@
20exec_prefix = @exec_prefix@
21datadir = $(prefix)/@DATADIRNAME@
22localedir = $(datadir)/locale
23gnulocaledir = $(prefix)/share/locale
24gettextsrcdir = $(prefix)/share/gettext/po
25subdir = po
26
27INSTALL = @INSTALL@
28INSTALL_DATA = @INSTALL_DATA@
29MKINSTALLDIRS = @MKINSTALLDIRS@
30
31CC = @CC@
32GENCAT = @GENCAT@
33GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
34MSGFMT = @MSGFMT@
35XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
36MSGMERGE = PATH=../src:$$PATH msgmerge
37
38DEFS = @DEFS@
39CFLAGS = @CFLAGS@
40CPPFLAGS = @CPPFLAGS@
41
42INCLUDES = -I.. -I$(top_srcdir)/intl
43
44COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
45
46POFILES = @POFILES@
47GMOFILES = @GMOFILES@
48DISTFILES = Makefile.in.in POTFILES.in $(PACKAGE).pot \
49$(POFILES) $(GMOFILES) $(SOURCES)
50
51POTFILES = \
52
53CATALOGS = @CATALOGS@
54CATOBJEXT = @CATOBJEXT@
55INSTOBJEXT = @INSTOBJEXT@
56
57.SUFFIXES:
58.SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
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) -o $$file $<
73
74.po.cat:
75	sed -f ../intl/po2msg.sed < $< > $*.msg \
76	  && rm -f $@ && $(GENCAT) $@ $*.msg
77
78
79all: all-@USE_NLS@
80
81all-yes: $(CATALOGS)
82all-no:
83
84$(srcdir)/$(PACKAGE).pot: $(POTFILES)
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
92install: install-exec install-data
93install-exec:
94install-data: install-data-@USE_NLS@
95install-data-no: all
96install-data-yes: all
97	if test -x "$(MKINSTALLDIRS)"; then \
98	  $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
99	else \
100	  $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
101	fi
102	@catalogs='$(CATALOGS)'; \
103	for cat in $$catalogs; do \
104	  cat=`basename $$cat`; \
105	  case "$$cat" in \
106	    *.gmo) destdir=$(DESTDIR)$(gnulocaledir);; \
107	    *)     destdir=$(DESTDIR)$(localedir);; \
108	  esac; \
109	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
110	  dir=$$destdir/$$lang/LC_MESSAGES; \
111	  if test -r "$(MKINSTALLDIRS)"; then \
112	    $(MKINSTALLDIRS) $$dir; \
113	  else \
114	    $(SHELL) $(top_srcdir)/mkinstalldirs $$dir; \
115	  fi; \
116	  if test -r $$cat; then \
117	    $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
118	    echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
119	  else \
120	    $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
121	    echo "installing $(srcdir)/$$cat as" \
122		 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
123	  fi; \
124	  if test -r $$cat.m; then \
125	    $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
126	    echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
127	  else \
128	    if test -r $(srcdir)/$$cat.m ; then \
129	      $(INSTALL_DATA) $(srcdir)/$$cat.m \
130		$$dir/$(PACKAGE)$(INSTOBJEXT).m; \
131	      echo "installing $(srcdir)/$$cat as" \
132		   "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
133	    else \
134	      true; \
135	    fi; \
136	  fi; \
137	done
138	if test "$(PACKAGE)" = "gettext"; then \
139	  if test -x "$(MKINSTALLDIRS)"; then \
140	    $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
141	  else \
142	    $(SHELL) $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
143	  fi; \
144	  $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
145			  $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
146	else \
147	  : ; \
148	fi
149
150# Define this as empty until I found a useful application.
151installcheck:
152
153uninstall:
154	catalogs='$(CATALOGS)'; \
155	for cat in $$catalogs; do \
156	  cat=`basename $$cat`; \
157	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
158	  rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
159	  rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
160	  rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
161	  rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
162	done
163
164check: all
165
166dvi info tags TAGS ID:
167
168mostlyclean:
169	rm -f core core.* *.pox $(PACKAGE).po *.old.po
170	rm -fr *.o
171
172clean: mostlyclean
173	rm -f *.gmo
174
175distclean: clean
176	rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
177
178maintainer-clean: distclean
179	@echo "This command is intended for maintainers to use;"
180	@echo "it deletes files that may require special tools to rebuild."
181	rm -f $(GMOFILES)
182
183distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
184dist distdir: update-po $(DISTFILES)
185	dists="$(DISTFILES)"; \
186	for file in $$dists; do \
187	  ln $(srcdir)/$$file $(distdir) 2> /dev/null \
188	    || cp -p $(srcdir)/$$file $(distdir); \
189	done
190
191update-po: Makefile
192	$(MAKE) $(PACKAGE).pot
193	PATH=`pwd`/../src:$$PATH; \
194	cd $(srcdir); \
195	catalogs='$(CATALOGS)'; \
196	for cat in $$catalogs; do \
197	  cat=`basename $$cat`; \
198	  lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
199	  mv $$lang.po $$lang.old.po; \
200	  echo "$$lang:"; \
201	  if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
202	    rm -f $$lang.old.po; \
203	  else \
204	    echo "msgmerge for $$cat failed!"; \
205	    rm -f $$lang.po; \
206	    mv $$lang.old.po $$lang.po; \
207	  fi; \
208	done
209
210POTFILES: POTFILES.in
211	( if test 'x$(srcdir)' != 'x.'; then \
212	    posrcprefix='$(top_srcdir)/'; \
213	  else \
214	    posrcprefix="../"; \
215	  fi; \
216	  rm -f $@-t $@ \
217	    && (sed -e '/^#/d' -e '/^[ 	]*$$/d' \
218		    -e "s@.*@	$$posrcprefix& \\\\@" < $(srcdir)/$@.in \
219		| sed -e '$$s/\\$$//') > $@-t \
220	    && chmod a-w $@-t \
221	    && mv $@-t $@ )
222
223Makefile: Makefile.in.in ../config.status POTFILES
224	cd .. \
225	  && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
226	       $(SHELL) ./config.status
227
228# Tell versions [3.59,3.63) of GNU make not to export all variables.
229# Otherwise a system limit (for SysV at least) may be exceeded.
230.NOEXPORT:
231