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