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