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