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