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