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