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 2001, 2003, 2006, 2007, 2009 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 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=bug-binutils@gnu.org \ 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=bug-binutils@gnu.org \ 107 --files-from=$(srcdir)/BLD-POTFILES.in 108 rm -f $(srcdir)/$(PACKAGE).pot 109 mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot 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-pdf: 131install-data: install-data-@USE_NLS@ 132install-data-no: all 133install-data-yes: all 134 if test -r $(MKINSTALLDIRS); then \ 135 $(MKINSTALLDIRS) $(DESTDIR)$(datadir); \ 136 else \ 137 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(datadir); \ 138 fi 139 @catalogs='$(CATALOGS)'; \ 140 for cat in $$catalogs; do \ 141 cat=`basename $$cat`; \ 142 case "$$cat" in \ 143 *.gmo) destdir=$(gnulocaledir);; \ 144 *) destdir=$(localedir);; \ 145 esac; \ 146 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ 147 dir=$(DESTDIR)$$destdir/$$lang/LC_MESSAGES; \ 148 if test -r $(MKINSTALLDIRS); then \ 149 $(MKINSTALLDIRS) $$dir; \ 150 else \ 151 $(top_srcdir)/mkinstalldirs $$dir; \ 152 fi; \ 153 if test -r $$cat; then \ 154 $(INSTALL_DATA) $$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ 155 echo "installing $$cat as $$dir/$(PACKAGE)$(INSTOBJEXT)"; \ 156 else \ 157 $(INSTALL_DATA) $(srcdir)/$$cat $$dir/$(PACKAGE)$(INSTOBJEXT); \ 158 echo "installing $(srcdir)/$$cat as" \ 159 "$$dir/$(PACKAGE)$(INSTOBJEXT)"; \ 160 fi; \ 161 if test -r $$cat.m; then \ 162 $(INSTALL_DATA) $$cat.m $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ 163 echo "installing $$cat.m as $$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ 164 else \ 165 if test -r $(srcdir)/$$cat.m ; then \ 166 $(INSTALL_DATA) $(srcdir)/$$cat.m \ 167 $$dir/$(PACKAGE)$(INSTOBJEXT).m; \ 168 echo "installing $(srcdir)/$$cat as" \ 169 "$$dir/$(PACKAGE)$(INSTOBJEXT).m"; \ 170 else \ 171 true; \ 172 fi; \ 173 fi; \ 174 done 175 if test "$(PACKAGE)" = "gettext"; then \ 176 if test -r $(MKINSTALLDIRS); then \ 177 $(MKINSTALLDIRS) $(DESTDIR)$(gettextsrcdir); \ 178 else \ 179 $(top_srcdir)/mkinstalldirs $(DESTDIR)$(gettextsrcdir); \ 180 fi; \ 181 $(INSTALL_DATA) $(srcdir)/Makefile.in.in \ 182 $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \ 183 else \ 184 : ; \ 185 fi 186 187# Define this as empty until I found a useful application. 188installcheck: 189 190uninstall: 191 catalogs='$(CATALOGS)'; \ 192 for cat in $$catalogs; do \ 193 cat=`basename $$cat`; \ 194 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ 195 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ 196 rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ 197 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT); \ 198 rm -f $(DESTDIR)$(gnulocaledir)/$$lang/LC_MESSAGES/$(PACKAGE)$(INSTOBJEXT).m; \ 199 done 200 rm -f $(DESTDIR)$(gettextsrcdir)/po-Makefile.in.in 201 202check: all 203 204cat-id-tbl.o: ../intl/libgettext.h 205 206html dvi pdf ps info tags TAGS ID: 207 208mostlyclean: 209 rm -f core core.* *.pox $(PACKAGE).po *.old.po cat-id-tbl.tmp 210 rm -fr *.o 211 212clean: mostlyclean 213 214distclean: clean 215 rm -f Makefile Makefile.in *.mo *.msg *.cat *.cat.m 216 rm -f SRC-POTFILES BLD-POTFILES 217 218maintainer-clean: distclean 219 @echo "This command is intended for maintainers to use;" 220 @echo "it deletes files that may require special tools to rebuild." 221 rm -f $(GMOFILES) SRC-POTFILES.in BLD-POTFILES.in 222 223distdir = ../$(PACKAGE)-$(VERSION)/$(subdir) 224dist distdir: update-po $(DISTFILES) 225 dists="$(DISTFILES)"; \ 226 for file in $$dists; do \ 227 ln $(srcdir)/$$file $(distdir) 2> /dev/null \ 228 || cp -p $(srcdir)/$$file $(distdir); \ 229 done 230 231update-po: Makefile 232 $(MAKE) $(PACKAGE).pot 233 PATH=`pwd`/../src:$$PATH; \ 234 cd $(srcdir); \ 235 catalogs='$(CATALOGS)'; \ 236 for cat in $$catalogs; do \ 237 cat=`basename $$cat`; \ 238 lang=`echo $$cat | sed 's/\$(CATOBJEXT)$$//'`; \ 239 mv $$lang.po $$lang.old.po; \ 240 echo "$$lang:"; \ 241 if $(MSGMERGE) $$lang.old.po $(PACKAGE).pot -o $$lang.po; then \ 242 rm -f $$lang.old.po; \ 243 else \ 244 echo "msgmerge for $$cat failed!"; \ 245 rm -f $$lang.po; \ 246 mv $$lang.old.po $$lang.po; \ 247 fi; \ 248 done 249 250SRC-POTFILES: SRC-POTFILES.in 251 ( if test 'x$(srcdir)' != 'x.'; then \ 252 posrcprefix='$(top_srcdir)/'; \ 253 else \ 254 posrcprefix="../"; \ 255 fi; \ 256 rm -f $@-t $@ \ 257 && (sed -e '/^#/d' \ 258 -e '/^[ ]*$$/d' \ 259 -e "s@.*@ $$posrcprefix& \\\\@" < $(srcdir)/$@.in \ 260 | sed -e '$$s/\\$$//') > $@-t \ 261 && chmod a-w $@-t \ 262 && mv $@-t $@ ) 263 264BLD-POTFILES: BLD-POTFILES.in 265 ( rm -f $@-t $@ \ 266 && (sed -e '/^#/d' \ 267 -e '/^[ ]*$$/d' \ 268 -e "s@.*@ ../& \\\\@" < $(srcdir)/$@.in \ 269 | sed -e '$$s/\\$$//') > $@-t \ 270 && chmod a-w $@-t \ 271 && mv $@-t $@ ) 272 273SRC-POTFILES.in: @MAINT@ ../Makefile 274 cd .. && $(MAKE) po/SRC-POTFILES.in 275 276BLD-POTFILES.in: @MAINT@ ../Makefile 277 cd .. && $(MAKE) po/BLD-POTFILES.in 278 279# Note - The presence of SRC-POTFILES and BLD-POTFILES as dependencies 280# here breaks the implementation of the 'distclean' rule for maintainers. 281# This is because if 'make distclean' is run in the BFD directory, the 282# Makefile there will be deleted before 'distclean' is made here, and so 283# the dependency SRC-POTFILES -> SRC-POTFILES.in -> ../Makefile cannot 284# be satisfied. 285# 286# The SRC-POTFILES and BLD-POTFILES dependencies cannot be removed, 287# however since it is necessary that these files be built during 288# *configure* time, so that configure can insert them into the 289# po/Makefile that it is creating, so that the Makefile will have 290# the correct dependencies. 291Makefile: Make-in ../config.status SRC-POTFILES BLD-POTFILES 292 cd .. \ 293 && CONFIG_FILES=$(subdir)/Makefile.in:$(subdir)/Make-in \ 294 CONFIG_HEADERS= $(SHELL) ./config.status 295 296# Tell versions [3.59,3.63) of GNU make not to export all variables. 297# Otherwise a system limit (for SysV at least) may be exceeded. 298.NOEXPORT: 299