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-2024 Free Software Foundation, Inc.
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.
17 top_srcdir = @top_srcdir@
19 top_builddir = @top_builddir@
22 exec_prefix = @exec_prefix@
24 localedir = @localedir@
25 gnulocaledir = @datarootdir@/locale
26 gettextsrcdir = @datarootdir@/gettext/po
32 INSTALL_DATA = @INSTALL_DATA@
33 MKINSTALLDIRS = @MKINSTALLDIRS@
37 GMSGFMT = PATH=../src:$$PATH @GMSGFMT@
39 XGETTEXT = PATH=../src:$$PATH @XGETTEXT@
40 MSGMERGE = PATH=../src:$$PATH msgmerge
46 INCLUDES = -I.. -I$(top_srcdir)/intl
48 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
50 SOURCES = cat-id-tbl.c
53 DISTFILES = ChangeLog Makefile.in.in SRC-POTFILES.in BLD-POTFILES.in $(PACKAGE).pot \
54 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
61 CATOBJEXT = @CATOBJEXT@
62 INSTOBJEXT = @INSTOBJEXT@
65 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
71 $(MAKE) $(PACKAGE).pot
72 $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
78 file=`echo $* | sed 's,.*/,,'`.gmo \
79 && rm -f $$file && $(GMSGFMT) -o $$file $<
82 sed -f ../intl/po2msg.sed < $< > $*.msg \
83 && rm -f $@ && $(GENCAT) $@ $*.msg
88 all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
91 $(srcdir)/$(PACKAGE).pot: $(SRC-POTFILES) $(BLD-POTFILES)
92 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
93 --add-comments --keyword=_ --keyword=N_ \
94 --msgid-bugs-address=https://sourceware.org/bugzilla/ \
95 --files-from=$(srcdir)/SRC-POTFILES.in
96 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=.. \
97 --add-comments --keyword=_ --keyword=N_ \
99 --msgid-bugs-address=https://sourceware.org/bugzilla/ \
100 --files-from=$(srcdir)/BLD-POTFILES.in
101 rm -f $(srcdir)/$(PACKAGE).pot
102 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
104 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
105 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
107 sed -f ../intl/po2tbl.sed $(srcdir)/$(PACKAGE).pot \
108 | sed -e "s/@PACKAGE NAME@/$(PACKAGE)/" > cat-id-tbl.tmp
109 if cmp -s cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; then \
112 echo cat-id-tbl.c changed; \
113 rm -f $(srcdir)/cat-id-tbl.c; \
114 mv cat-id-tbl.tmp $(srcdir)/cat-id-tbl.c; \
116 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
119 install: install-exec install-data
126 install-data: install-data-@USE_NLS@
128 install-data-yes: all
129 if test -r $(MKINSTALLDIRS); then \
130 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
132 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
134 @catalogs='$(CATALOGS)'; \
135 for cat in $$catalogs; do \
136 cat=`basename $$cat`; \
138 *.gmo) destdir=$(gnulocaledir);; \
139 *) destdir=$(localedir);; \
141 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
142 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
143 if test -r $(MKINSTALLDIRS); then \
144 $(MKINSTALLDIRS) $$dir; \
146 $(top_srcdir)/mkinstalldirs $$dir; \
148 if test -r $$cat; then \
149 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
150 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
152 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
153 echo "installing $(srcdir)/$$cat as" \
154 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
156 if test -r $$cat.m; then \
157 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
158 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
160 if test -r $(srcdir)/$$cat.m ; then \
161 $(INSTALL_DATA) $(srcdir)/$$cat.m \
162 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
163 echo "installing $(srcdir)/$$cat as" \
164 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
170 if test "$(PACKAGE)" = "gettext"; then \
171 if test -r $(MKINSTALLDIRS); then \
172 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
174 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
176 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
177 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
182 # Define this as empty until I found a useful application.
186 catalogs='$(CATALOGS)'; \
187 for cat in $$catalogs; do \
188 cat=`basename $$cat`; \
189 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
190 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
191 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
192 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
193 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
195 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
199 cat-id-tbl.o: ../intl/libgettext.h
201 html dvi pdf ps info tags TAGS ID:
204 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
210 rm -f Makefile Makefile.in *.mo *.msg *.cat *.cat.m
211 rm -f SRC-POTFILES BLD-POTFILES
213 maintainer-clean: distclean
214 @echo "This command is intended for maintainers to use;"
215 @echo "it deletes files that may require special tools to rebuild."
216 rm -f $(GMOFILES) SRC-POTFILES.in BLD-POTFILES.in
218 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
219 dist distdir: update-po $(DISTFILES)
220 dists="$(DISTFILES)"; \
221 for file in $$dists; do \
222 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
223 || cp -p $(srcdir)/$$file $(distdir); \
227 $(MAKE) $(PACKAGE).pot
228 PATH=`pwd`/../src:$$PATH; \
230 catalogs='$(CATALOGS)'; \
231 for cat in $$catalogs; do \
232 cat=`basename $$cat`; \
233 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
234 mv $$lang.po $$lang.old.po; \
236 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
237 rm -f $$lang.old.po; \
239 echo "msgmerge for $$cat failed!"; \
241 mv $$lang.old.po $$lang.po; \
245 SRC-POTFILES: SRC-POTFILES.in
246 ( if test 'x$(srcdir)' != 'x.'; then \
247 posrcprefix='$(top_srcdir)/'; \
252 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
253 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
254 | sed -e '$$s/\\$$//') > $@-t \
258 BLD-POTFILES: BLD-POTFILES.in
260 && sed -e '/^#/d' -e '/^[ ]*$$/d' \
261 -e "s@.*@ ../& \\\\@" < $(srcdir)/$@.in \
262 | sed -e '$$s/\\$$//' > $@-t \
266 SRC-POTFILES.in: @MAINT@ ../Makefile
267 cd .. && $(MAKE) po/SRC-POTFILES.in
269 BLD-POTFILES.in: @MAINT@ ../Makefile
270 cd .. && $(MAKE) po/BLD-POTFILES.in
272 Makefile: Make-in ../config.status SRC-POTFILES BLD-POTFILES
274 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
275 CONFIG_HEADERS= $(SHELL) ./config.status
277 # Tell versions [3.59,3.63) of GNU make not to export all variables.
278 # Otherwise a system limit (for SysV at least) may be exceeded.