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-2025 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 POTFILES.in $(PACKAGE).pot \
54 stamp-cat-id $(POFILES) $(GMOFILES) $(SOURCES)
59 CATOBJEXT = @CATOBJEXT@
60 INSTOBJEXT = @INSTOBJEXT@
63 .SUFFIXES: .c .o .po .pox .gmo .mo .msg .cat
69 $(MAKE) $(PACKAGE).pot
70 $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
76 file=`echo $* | sed 's,.*/,,'`.gmo \
77 && rm -f $$file && $(GMSGFMT) -o $$file $<
80 sed -f ../intl/po2msg.sed < $< > $*.msg \
81 && rm -f $@ && $(GENCAT) $@ $*.msg
86 all-yes: $(CATALOGS) @MAINT@ $(PACKAGE).pot
89 $(srcdir)/$(PACKAGE).pot: $(POTFILES)
90 $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
91 --add-comments --keyword=_ --keyword=N_ \
92 --msgid-bugs-address=https://sourceware.org/bugzilla/ \
93 --files-from=$(srcdir)/POTFILES.in
94 rm -f $(srcdir)/$(PACKAGE).pot
95 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot
97 $(srcdir)/cat-id-tbl.c: stamp-cat-id; @:
98 $(srcdir)/stamp-cat-id: $(PACKAGE).pot
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 \
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; \
109 cd $(srcdir) && rm -f stamp-cat-id && echo timestamp > stamp-cat-id
112 install: install-exec install-data
119 install-data: install-data-@USE_NLS@
121 install-data-yes: all
122 if test -r $(MKINSTALLDIRS); then \
123 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \
125 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \
127 @catalogs='$(CATALOGS)'; \
128 for cat in $$catalogs; do \
129 cat=`basename $$cat`; \
131 *.gmo) destdir=$(gnulocaledir);; \
132 *) destdir=$(localedir);; \
134 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
135 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \
136 if test -r $(MKINSTALLDIRS); then \
137 $(MKINSTALLDIRS) $$dir; \
139 $(top_srcdir)/mkinstalldirs $$dir; \
141 if test -r $$cat; then \
142 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
143 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \
145 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \
146 echo "installing $(srcdir)/$$cat as" \
147 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \
149 if test -r $$cat.m; then \
150 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
151 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
153 if test -r $(srcdir)/$$cat.m ; then \
154 $(INSTALL_DATA) $(srcdir)/$$cat.m \
155 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \
156 echo "installing $(srcdir)/$$cat as" \
157 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \
163 if test "$(PACKAGE)" = "gettext"; then \
164 if test -r $(MKINSTALLDIRS); then \
165 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \
167 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \
169 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
170 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
175 # Define this as empty until I found a useful application.
179 catalogs='$(CATALOGS)'; \
180 for cat in $$catalogs; do \
181 cat=`basename $$cat`; \
182 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
183 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
184 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
185 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \
186 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \
188 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in
192 cat-id-tbl.o: ../intl/libgettext.h
194 html dvi pdf ps info tags TAGS ID:
197 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp
203 rm -f Makefile Makefile.in POTFILES *.mo *.msg *.cat *.cat.m
205 maintainer-clean: distclean
206 @echo "This command is intended for maintainers to use;"
207 @echo "it deletes files that may require special tools to rebuild."
210 distdir = ../$(PACKAGE)-$(VERSION)/$(subdir)
211 dist distdir: update-po $(DISTFILES)
212 dists="$(DISTFILES)"; \
213 for file in $$dists; do \
214 ln $(srcdir)/$$file $(distdir) 2> /dev/null \
215 || cp -p $(srcdir)/$$file $(distdir); \
219 $(MAKE) $(PACKAGE).pot
220 PATH=`pwd`/../src:$$PATH; \
222 catalogs='$(CATALOGS)'; \
223 for cat in $$catalogs; do \
224 cat=`basename $$cat`; \
225 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \
226 mv $$lang.po $$lang.old.po; \
228 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \
229 rm -f $$lang.old.po; \
231 echo "msgmerge for $$cat failed!"; \
233 mv $$lang.old.po $$lang.po; \
237 POTFILES: POTFILES.in
238 ( if test 'x$(srcdir)' != 'x.'; then \
239 posrcprefix='$(top_srcdir)/'; \
244 && (sed -e '/^#/d' -e '/^[ ]*$$/d' \
245 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \
246 | sed -e '$$s/\\$$//') > $@-t \
250 POTFILES.in: @MAINT@ ../Makefile
251 cd .. && $(MAKE) po/POTFILES.in
253 Makefile: Make-in ../config.status POTFILES
255 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \
256 CONFIG_HEADERS= $(SHELL) ./config.status
258 # Tell versions [3.59,3.63) of GNU make not to export all variables.
259 # Otherwise a system limit (for SysV at least) may be exceeded.