This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: I18N: automatic determination of potfiles list
Ok, here's a revised patch which incorporates your suggestions. Also,
I actually tested "make install" this time and fixed the bugs thus
exposed.
N.B. I'm not including the diff to remove POTFILES.in in this post
since it's huge and uninteresting.
zw
* Makefile.in (INTL_TARGETS, POSUB): Delete all references.
(INTL_SUBDIRS): Just intl.
(.SUFFIXES): Add .gmo .po .pox.
(native): Also depend on build-@POSUB@.
(intl.all, intl.install): Depend on config.h and things it includes.
(po-generated): New target; depend on c-parse.c and tradcif.c.
(install-normal): Also depend on install-@POSUB@.
(XGETTEXT, GMSGFMT, MSGMERGE, PACKAGE, CATALOGS): New variables.
(build-, install-, build-po, update-po, install-po,
.po.gmo, .po.pox, $(PACKAGE).pot, po/$(PACKAGE).pot): New rules.
* aclocal.m4: Prefix each entry in CATALOGS with "po/"
* configure.in: Don't munge XGETTEXT. Don't generate
po/Makefile.in.
* configure: Regenerate.
* exgettext: Delete.
* config/m68k/m68k.h: Add doc strings for -msky and -mnosky.
cp, java, objc:
* Make-lang.in: Replace $(INTL_TARGETS) with po-generated.
po:
* EXCLUDES: New file.
* exgettext: New helper script; completely rewritten.
* Makefile.in.in, POTFILES.in: Delete.
===================================================================
Index: Makefile.in
--- Makefile.in 2001/10/29 14:34:18 1.760
+++ Makefile.in 2001/10/31 07:49:30
@@ -49,11 +49,6 @@ SUBDIRS =@subdirs@
CONFIG_LANGUAGES = @all_languages@
LANGUAGES = c gcov$(exeext) $(CONFIG_LANGUAGES)
-# Languages should create dependencies of $(INTL_TARGETS) on generated
-# sources in Make-lang.in. Example:
-# $(INTL_TARGETS): $(srcdir)/cp/parse.c
-INTL_TARGETS = intl.all intl.install
-
# Selection of languages to be made during stage1 build.
# This is overridden by configure.
BOOT_LANGUAGES = c @all_boot_languages@
@@ -341,8 +336,7 @@ INTLDEPS = @INTLDEPS@
LIBICONV = @LIBICONV@
# List of internationalization subdirectories.
-POSUB = @POSUB@
-INTL_SUBDIRS = intl $(POSUB)
+INTL_SUBDIRS = intl
# Change this to a null string if obstacks are installed in the
# system library.
@@ -836,8 +830,9 @@ LIB2_DIVMOD_FUNCS = _divdi3 _moddi3 _udi
#
# The only suffixes we want for implicit rules are .c and .o, so clear
# the list and add them. This speeds up GNU Make, and allows -r to work.
+# For i18n support, we also need .gmo, .po, .pox.
.SUFFIXES:
-.SUFFIXES: .c .o
+.SUFFIXES: .c .o .po .pox .gmo
Makefile: $(srcdir)/Makefile.in config.status $(srcdir)/version.c \
$(xmake_file) $(tmake_file) $(LANG_MAKEFILES)
@@ -941,7 +936,7 @@ start.encap: native xgcc$(exeext) cpp$(e
rest.encap: $(STMP_FIXPROTO) $(LIBGCC) $(EXTRA_PARTS) lang.rest.encap
# This is what is made with the host's compiler
# whether making a cross compiler or not.
-native: config.status auto-host.h intl.all $(LANGUAGES) \
+native: config.status auto-host.h intl.all build-@POSUB@ $(LANGUAGES) \
$(EXTRA_PASSES) $(EXTRA_PROGRAMS) $(USE_COLLECT2)
# Define the names for selecting languages in LANGUAGES.
@@ -1969,9 +1964,6 @@ intl.o: intl.c $(CONFIG_H) system.h intl
$(top_builddir)/intl/libintl.a: intl.all
-# Make sure all the headers are there for xgettext to scan.
-$(INTL_TARGETS): $(CONFIG_H) $(srcdir)/c-parse.c
-
intl.all intl.install intl.uninstall \
intl.mostlyclean intl.clean intl.distclean intl.maintainer-clean:
@for d in $(INTL_SUBDIRS); do \
@@ -1981,6 +1973,14 @@ intl.all intl.install intl.uninstall \
if [ $$? -eq 0 ] ; then true ; else exit 1 ; fi ; \
done
+# intl.all and intl.install need config.h to exist, and the files it includes.
+# (FIXME: intl/*.c shouldn't need to see insn-foo.h!)
+intl.all intl.install: config.h insn-flags.h insn-constants.h
+
+# Make-lang.in should add dependencies of po-generated on any generated
+# files which need to be scanned by gettext (usually Yacc-generated parsers).
+po-generated: c-parse.c tradcif.c
+
#
# Remake cpp and protoize.
@@ -2496,7 +2496,7 @@ install: $(INSTALL_TARGET) ; @true
# Install the driver last so that the window when things are
# broken is small.
install-normal: install-common $(INSTALL_HEADERS) $(INSTALL_LIBGCC) \
- $(INSTALL_CPP) install-man install-info intl.install \
+ $(INSTALL_CPP) install-man install-info intl.install install-@POSUB@ \
lang.install-normal install-driver
# Do nothing while making gcc with a cross-compiler. The person who
@@ -3337,3 +3337,66 @@ float.h-cross:
echo "#error float.h values not known for cross-compiler" >> t-float.h-cross
echo "#endif" >> t-float.h-cross
mv t-float.h-cross float.h-cross
+
+# Rules for generating translated message descriptions.
+# Disabled by autoconf if the tools are not available.
+
+XGETTEXT = @XGETTEXT@
+GMSGFMT = @GMSGFMT@
+MSGMERGE = msgmerge
+
+PACKAGE = @PACKAGE@
+CATALOGS = @CATALOGS@
+
+.PHONY: build- install- build-po install-po update-po
+
+# Dummy rules to deal with dependencies produced by use of
+# "build-@POSUB@" and "install-@POSUB@" above, when NLS is disabled.
+build-: ; @true
+install-: ; @true
+
+build-po: $(CATALOGS)
+
+# This notation should be acceptable to all Make implementations used
+# by people who are interested in updating .po files.
+update-po: $(CATALOGS:.gmo=.pox)
+
+# Update files in $(srcdir) atomically.
+.po.gmo:
+ test -d po || mkdir po
+ $(GMSGFMT) --statistics $< -o $@
+ $(SHELL) $(srcdir)/move-if-change $@ $(srcdir)/$@
+
+# This rule does _not_ copy into $(srcdir). User must do this
+# by hand. (User is a translation maintainer and is expected to
+# go through the new .po by hand anyway.)
+.po.pox:
+ test -d po || mkdir po
+ $(MSGMERGE) $< $(srcdir)/po/$(PACKAGE).pot -o $@
+
+install-po:
+ $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$(datadir)
+ for cat in $(CATALOGS); do \
+ cat=`basename $$cat`; \
+ lang=`echo $$cat | sed 's/\.gmo$$//'`; \
+ dir=$(localedir)/$$lang/LC_MESSAGES; \
+ echo $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$$dir; \
+ $(SHELL) $(srcdir)/mkinstalldirs $(DESTDIR)$$dir || exit 1; \
+ echo $(INSTALL_DATA) $(srcdir)/po/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
+ $(INSTALL_DATA) $(srcdir)/po/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
+ done
+
+# Rule for regenerating the message template (gcc.pot).
+# Instead of forcing everyone to edit POTFILES.in, which proved impractical,
+# this rule has no dependencies and always regenerates gcc.pot. This is
+# relatively harmless since the .po files do not directly depend on it.
+# Note that exgettext has an awk script embedded in it which requires a
+# fairly modern (POSIX-compliant) awk.
+$(PACKAGE).pot: po/$(PACKAGE).pot
+po/$(PACKAGE).pot: force
+ test -d po || mkdir po
+ $(MAKE) po-generated
+ AWK=$(AWK) $(SHELL) $(srcdir)/po/exgettext \
+ $(XGETTEXT) $(PACKAGE) $(srcdir)
+ $(SHELL) $(srcdir)/move-if-change $(PACKAGE).pot \
+ $(srcdir)/po/$(PACKAGE).pot
===================================================================
Index: aclocal.m4
--- aclocal.m4 2001/10/21 16:29:12 1.54
+++ aclocal.m4 2001/10/31 07:49:30
@@ -1691,8 +1691,9 @@ strdup strtoul tsearch __argz_count __ar
fi
dnl Construct list of names of catalog files to be constructed.
+ dnl GCC LOCAL: Tweak for non-recursive po directory build.
if test -n "$LINGUAS"; then
- for lang in $LINGUAS; do CATALOGS="$CATALOGS $lang$CATOBJEXT"; done
+ for lang in $LINGUAS; do CATALOGS="$CATALOGS po/$lang$CATOBJEXT"; done
fi
fi
===================================================================
Index: configure.in
--- configure.in 2001/10/30 16:47:24 1.550
+++ configure.in 2001/10/31 07:49:32
@@ -923,7 +923,6 @@ if test "${build}" != "${host}" && test
fi
AM_GNU_GETTEXT
-XGETTEXT="AWK='$AWK' \$(SHELL) \$(top_srcdir)/exgettext $XGETTEXT"
# Windows32 Registry support for specifying GCC installation paths.
AC_ARG_ENABLE(win32-registry,
@@ -1903,7 +1902,7 @@ all_boot_languages=
all_compilers=
all_stagestuff=
all_diff_excludes=
-all_outputs='Makefile intl/Makefile po/Makefile.in fixinc/Makefile gccbug mklibgcc'
+all_outputs='Makefile intl/Makefile fixinc/Makefile gccbug mklibgcc'
# List of language makefile fragments.
all_lang_makefiles=
all_headers=
===================================================================
Index: exgettext
--- exgettext Tue Oct 30 23:49:43 2001
+++ exgettext Tue May 5 13:32:27 1998
@@ -1,118 +0,0 @@
-#! /bin/sh
-# Wrapper around gettext for GCC sources.
-# Copyright 1998 Free Software Foundation, Inc.
-
-# Written by Paul Eggert <eggert@twinsun.com>.
-
-# This file is part of GCC.
-
-# GCC is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 2, or (at your option) any later
-# version.
-
-# GCC is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
-# License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with GCC; see the file COPYING. If not, write to the Free
-# Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-# 02111-1307, USA.
-
-# Set environment to default value, if not already set.
-: ${AWK=awk}
-
-# The argument to this wrapper is the xgettext command to be executed.
-# Extract the xgettext program name from the rest of the command.
-xgettext=${1?}
-shift
-
-# Save work if we're just wrapping a no-op.
-case $xgettext in
-:) exit;;
-esac
-
-# Find the files to be scanned, and the directory to scan them from.
-directory=.
-files=
-for i
-do
- case $i in
- --directory=*)
- directory=`expr " $i" : ' --directory=\(.*\)'`;;
- --files-from=*)
- files_from=`expr " $i" : ' --files-from=\(.*\)'`
- files=`$AWK '/^[^#]/ { print }' $files_from`;;
- esac
-done
-
-# Generate keyword options for xgettext,
-# by scanning for declarations of functions
-# whose parameter names end in "msgid".
-generate_keyword_options='
- /^[A-Z_a-z].*\(.*msgid[,)]/ {
-
- paren_index = index($0, "(")
-
- name = substr($0, 1, paren_index - 1)
- sub(/[^0-9A-Z_a-z]*$/, "", name)
- sub(/[ ]+PARAMS/, "", name)
- sub(/[ ]+VPARAMS/, "", name)
- sub(/.*[^0-9A-Z_a-z]/, "", name)
-
- args = substr($0, paren_index)
- sub(/msgid[,)].*/, "", args)
- for (n = 1; sub(/^[^,]*,/, "", args); n++) {
- continue;
- }
-
- if (n == 1) {
- keyword = name
- } else {
- keyword = name ":" n
- }
-
- if (! keyword_seen[keyword]++) {
- print "--keyword=" keyword
- }
- }
-'
-keyword_options=`(
- cd $directory &&
- $AWK "$generate_keyword_options" $files < /dev/null
-)` || exit
-
-# Generate temporary file reflecting the %e strings in the scanned files.
-tmp=tmp-emsgids.c
-
-generate_emsgids='
- /%e.*}/ {
- line = $0
- while ((percent_index = index(line, "%e")) != 0) {
- line = substr(line, percent_index + 2)
- bracket_index = index(line, "}")
- if (bracket_index == 0) {
- continue
- }
- msgid = substr(line, 1, bracket_index - 1)
- if (index(msgid, "%") != 0) {
- continue
- }
- printf "#line %d \"%s\"\n", FNR, FILENAME
- printf "_(\"%s\")\n", msgid
- line = substr(line, bracket_index + 1)
- }
- }
-'
-(cd $directory &&
- $AWK "$generate_emsgids" $files < /dev/null
-) > $directory/$tmp || exit
-
-# Run the xgettext command, with temporary added as a file to scan.
-"$xgettext" $keyword_options ${1+"$@"} $tmp || exit
-
-# Clean up.
-# If we don't get here, `make clean' will remove this file later.
-rm -f $directory/$tmp
===================================================================
Index: config/m68k/m68k.h
--- config/m68k/m68k.h 2001/09/11 16:49:59 1.54
+++ config/m68k/m68k.h 2001/10/31 07:49:33
@@ -178,11 +178,11 @@ extern int target_flags;
{ "nofpa", - MASK_FPA, \
N_("Do not generate code for a Sun FPA") }, \
{ "sky", -(MASK_FPA|MASK_68040_ONLY|MASK_68881), \
- N_("") }, \
+ N_("Generate code for a Sun Sky board") }, \
{ "sky", MASK_SKY, \
- N_("") }, \
+ N_("Generate code for a Sun Sky board") }, \
{ "nosky", - MASK_SKY, \
- N_("") }, \
+ N_("Do not use Sky linkage convention") }, \
{ "68881", - (MASK_FPA|MASK_SKY), \
N_("Generate code for a 68881") }, \
{ "68881", MASK_68881, "" }, \
===================================================================
Index: cp/Make-lang.in
--- cp/Make-lang.in 2001/10/08 20:53:40 1.94
+++ cp/Make-lang.in 2001/10/31 07:49:34
@@ -66,7 +66,7 @@ g++spec.o: $(srcdir)/cp/g++spec.c $(SYST
$(CC) -c $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(DRIVER_DEFINES) \
$(INCLUDES) $(srcdir)/cp/g++spec.c)
-$(INTL_TARGETS): $(srcdir)/cp/parse.c
+po-generated: $(srcdir)/cp/parse.c
# Create the compiler driver for g++.
GXX_OBJS = gcc.o g++spec.o intl.o prefix.o version.o
===================================================================
Index: java/Make-lang.in
--- java/Make-lang.in 2001/10/17 17:19:18 1.69
+++ java/Make-lang.in 2001/10/31 07:49:40
@@ -77,7 +77,7 @@ $(GCJ)-cross$(exeext): $(GCJ)$(exeext)
-rm -f $(GCJ)-cross$(exeext)
cp $(GCJ)$(exeext) $(GCJ)-cross$(exeext)
-$(INTL_TARGETS): $(srcdir)/java/parse.c $(srcdir)/java/parse-scan.c
+po-generated: $(srcdir)/java/parse.c $(srcdir)/java/parse-scan.c
$(srcdir)/java/parse.c: $(srcdir)/java/parse.y
$(BISON) -t --name-prefix=java_ $(BISONFLAGS) \
===================================================================
Index: objc/Make-lang.in
--- objc/Make-lang.in 2001/08/09 22:33:35 1.37
+++ objc/Make-lang.in 2001/10/31 07:49:40
@@ -63,7 +63,7 @@ objc-parse.o : $(srcdir)/objc/objc-parse
$(CC) $(ALL_CFLAGS) $(ALL_CPPFLAGS) $(INCLUDES) -I$(srcdir)/objc \
-c $(srcdir)/objc/objc-parse.c $(OUTPUT_OPTION)
-$(INTL_TARGETS): $(srcdir)/objc/objc-parse.c
+po-generated: $(srcdir)/objc/objc-parse.c
$(srcdir)/objc/objc-parse.c : $(srcdir)/objc/objc-parse.y
cd $(srcdir)/objc; \
$(BISON) $(BISONFLAGS) -o op$$$$.c objc-parse.y ; \
===================================================================
Index: po/EXCLUDES
--- po/EXCLUDES Tue May 5 13:32:27 1998
+++ po/EXCLUDES Tue Oct 30 23:49:40 2001
@@ -0,0 +1,64 @@
+# This file lists all the sources which should *not* be scanned for
+# strings to translate. Only the first word on each line is used; the
+# rest is ignored. Only files with an extension of .c or .h are
+# examined to begin with.
+
+# These files are part of libgcc, or target headers provided by gcc.
+config/rs6000/sol-c0.c
+config/float-c4x.h
+config/float-i128.h
+config/float-i32.h
+config/float-i386.h
+config/float-i64.h
+config/float-m68k.h
+config/float-sh.h
+config/float-sparc.h
+config/float-vax.h
+crtstuff.c
+frame.h
+gbl-ctors.h
+libgcc1.c
+libgcc1-test.c
+libgcc2.c
+libgcc2.h
+limitx.h
+limity.h
+longlong.h
+unwind-dw2-fde.c
+unwind-dw2-fde.h
+unwind-dw2.c
+unwind-pe.h
+unwind-sjlj.c
+unwind.h
+
+# These programs are meant to be executed only by GCC maintainers or
+# installers. Such files do not need to be translated, as these
+# people typically need to be able to read English anyway.
+enquire.c
+fix-header.c
+gen-protos.c
+genattr.c
+genattrtab.c
+gencheck.c
+gencodes.c
+genconfig.c
+genconstants.c
+genemit.c
+genextract.c
+genflags.c
+gengenrtl.c
+genopinit.c
+genoutput.c
+genpeep.c
+genpreds.c
+genrecog.c
+gensupport.c
+gensupport.h
+scan-decls.c
+scan.c
+scan.h
+
+# These files are not yet internationalized, because they contain
+# many strings that require a lot of analysis, and are little-used.
+mips-tdump.c
+mips-tfile.c
===================================================================
Index: po/Makefile.in.in
--- po/Makefile.in.in Tue Oct 30 23:49:53 2001
+++ po/Makefile.in.in Tue May 5 13:32:27 1998
@@ -1,196 +0,0 @@
-# Makefile for program source directory in GNU NLS utilities package.
-# Copyright (C) 1995-1997, 2000, 2001 by Ulrich Drepper <drepper@gnu.ai.mit.edu>
-#
-# This file file be copied and used freely without restrictions. It can
-# be used in projects which are not available under the GNU General Public License
-# but which still want to provide support for the GNU gettext functionality.
-# Please note that the actual code is *not* freely available.
-
-PACKAGE = @PACKAGE@
-VERSION = @VERSION@
-
-# These two variables depend on the location of this directory.
-subdir = po
-top_builddir = ..
-
-SHELL = /bin/sh
-@SET_MAKE@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-datadir = @datadir@
-localedir = $(datadir)/locale
-gettextsrcdir = $(datadir)/gettext/po
-
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-MKINSTALLDIRS = @MKINSTALLDIRS@
-mkinstalldirs = $(SHELL) `case "$(MKINSTALLDIRS)" in /*) echo "$(MKINSTALLDIRS)" ;; *) echo "$(top_builddir)/$(MKINSTALLDIRS)" ;; esac`
-
-CC = @CC@
-GMSGFMT = @GMSGFMT@
-MSGFMT = @MSGFMT@
-XGETTEXT = @XGETTEXT@
-MSGMERGE = msgmerge
-
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@
-
-INCLUDES = -I.. -I$(top_srcdir)/intl
-
-COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
-
-POFILES = @POFILES@
-GMOFILES = @GMOFILES@
-DISTFILES = ChangeLog Makefile.in.in POTFILES.in $(PACKAGE).pot \
-$(POFILES) $(GMOFILES)
-
-POTFILES = \
-
-CATALOGS = @CATALOGS@
-
-.SUFFIXES:
-.SUFFIXES: .c .o .po .pox .gmo .mo
-
-.c.o:
- $(COMPILE) $<
-
-.po.pox:
- $(MAKE) $(PACKAGE).pot
- $(MSGMERGE) $< $(srcdir)/$(PACKAGE).pot -o $*.pox
-
-.po.mo:
- $(MSGFMT) -o $@ $<
-
-.po.gmo:
- file=$(srcdir)/`echo $* | sed 's,.*/,,'`.gmo \
- && rm -f $$file && $(GMSGFMT) --statistics -o $$file $<
-
-
-all: all-@USE_NLS@
-
-all-yes: $(CATALOGS)
-all-no:
-
-# Note: Target 'all' must not depend on target '$(srcdir)/$(PACKAGE).pot',
-# otherwise packages like GCC can not be built if only parts of the source
-# have been downloaded.
-
-$(srcdir)/$(PACKAGE).pot: $(POTFILES) $(srcdir)/POTFILES.in
- $(XGETTEXT) --default-domain=$(PACKAGE) --directory=$(top_srcdir) \
- --add-comments --keyword=_ --keyword=N_ \
- --files-from=$(srcdir)/POTFILES.in \
- && test ! -f $(PACKAGE).po \
- || ( rm -f $(srcdir)/$(PACKAGE).pot \
- && mv $(PACKAGE).po $(srcdir)/$(PACKAGE).pot )
-
-
-install: install-exec install-data
-install-exec:
-install-data: install-data-@USE_NLS@
- if test "$(PACKAGE)" = "gettext"; then \
- $(mkinstalldirs) $(DESTDIR)$(gettextsrcdir); \
- $(INSTALL_DATA) $(srcdir)/Makefile.in.in \
- $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
- else \
- : ; \
- fi
-install-data-no: all
-install-data-yes: all
- $(mkinstalldirs) $(DESTDIR)$(datadir)
- @catalogs='$(CATALOGS)'; \
- for cat in $$catalogs; do \
- cat=`basename $$cat`; \
- lang=`echo $$cat | sed 's/\.gmo$$//'`; \
- dir=$(localedir)/$$lang/LC_MESSAGES; \
- $(mkinstalldirs) $(DESTDIR)$$dir; \
- if test -r $$cat; then \
- $(INSTALL_DATA) $$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
- echo "installing $$cat as $(DESTDIR)$$dir/$(PACKAGE).mo"; \
- else \
- $(INSTALL_DATA) $(srcdir)/$$cat $(DESTDIR)$$dir/$(PACKAGE).mo; \
- echo "installing $(srcdir)/$$cat as" \
- "$(DESTDIR)$$dir/$(PACKAGE).mo"; \
- fi; \
- done
-
-# Define this as empty until I found a useful application.
-installcheck:
-
-uninstall:
- catalogs='$(CATALOGS)'; \
- for cat in $$catalogs; do \
- cat=`basename $$cat`; \
- lang=`echo $$cat | sed 's/\.gmo$$//'`; \
- rm -f $(DESTDIR)$(localedir)/$$lang/LC_MESSAGES/$(PACKAGE).mo; \
- done
- if test "$(PACKAGE)" = "gettext"; then \
- rm -f $(DESTDIR)$(gettextsrcdir)/Makefile.in.in; \
- else \
- : ; \
- fi
-
-check: all
-
-dvi info tags TAGS ID:
-
-mostlyclean:
- rm -f core core.* *.pox $(PACKAGE).po *.new.po
- rm -fr *.o
-
-clean: mostlyclean
-
-distclean: clean
- rm -f Makefile Makefile.in POTFILES *.mo
-
-maintainer-clean: distclean
- @echo "This command is intended for maintainers to use;"
- @echo "it deletes files that may require special tools to rebuild."
- rm -f $(GMOFILES)
-
-distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir)
-dist distdir:
- $(MAKE) update-po
- @$(MAKE) dist2
-# This is a separate target because 'update-po' must be executed before.
-dist2: $(DISTFILES)
- dists="$(DISTFILES)"; \
- for file in $$dists; do \
- if test -f $$file; then dir=.; else dir=$(srcdir); fi; \
- cp -p $$dir/$$file $(distdir); \
- done
-
-update-po: Makefile
- $(MAKE) $(PACKAGE).pot
- if test "$(PACKAGE)" = "gettext"; then PATH=`pwd`/../src:$$PATH; fi; \
- cd $(srcdir); \
- catalogs='$(GMOFILES)'; \
- for cat in $$catalogs; do \
- cat=`basename $$cat`; \
- lang=`echo $$cat | sed 's/\.gmo$$//'`; \
- echo "$$lang:"; \
- if $(MSGMERGE) $$lang.po $(PACKAGE).pot -o $$lang.new.po; then \
- mv -f $$lang.new.po $$lang.po; \
- else \
- echo "msgmerge for $$cat failed!"; \
- rm -f $$lang.new.po; \
- fi; \
- done
- $(MAKE) update-gmo
-
-update-gmo: Makefile $(GMOFILES)
- @:
-
-Makefile: Makefile.in.in $(top_builddir)/config.status POTFILES.in
- cd $(top_builddir) \
- && CONFIG_FILES=$(subdir)/$@.in CONFIG_HEADERS= \
- $(SHELL) ./config.status
-
-# Tell versions [3.59,3.63) of GNU make not to export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
===================================================================
Index: po/exgettext
--- po/exgettext Tue May 5 13:32:27 1998
+++ po/exgettext Tue Oct 30 23:49:40 2001
@@ -0,0 +1,156 @@
+#! /bin/sh
+# Wrapper around gettext for GCC sources.
+# Copyright 1998, 2001 Free Software Foundation, Inc.
+
+# Written by Paul Eggert <eggert@twinsun.com>.
+# Revised by Zack Weinberg <zackw@stanford.edu> for no-POTFILES operation.
+
+# This file is part of GNU CC.
+
+# GNU CC is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# GNU CC is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with GNU CC; see the file COPYING. If not, write to
+# the Free Software Foundation, 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Set environment to default value, if not already set.
+: ${AWK=awk}
+
+# The arguments to this wrapper are: the program to execute, the
+# name of the "package", and the path to the source directory.
+
+if [ $# -ne 3 ]
+then echo "usage: $0 <xgettext> <package> <srcdir>"
+ exit 1
+fi
+
+xgettext=$1
+package=$2
+srcdir=$3
+
+nl='
+'
+
+set -e
+
+# Create temporary directory for scratch files.
+T=exg$$.d
+mkdir $T
+trap "rm -r $T" 0
+
+pwd=`pwd`
+kopt=$pwd/$T/keyword-options
+emsg=$pwd/$T/emsgids.c
+posr=$pwd/$T/po-sources
+
+# Locate files to scan, and generate the list. All .c and .h files in
+# $srcdir are examined, likewise $srcdir/config and $srcdir/config/*
+# (directories). Also, all subdirectories of $srcdir that contain a
+# config-lang.in. Exclusions come from $srcdir/po/EXCLUDE.
+#
+# Then generate keyword options for xgettext, by scanning for declarations
+# of functions whose parameter names end in "msgid".
+#
+# Finally, generate a source file containing all %e strings from
+# driver specs, so those can be translated too.
+#
+# All in one huge awk script.
+
+echo "scanning for keywords and %e strings..." >&2
+
+( cd $srcdir
+ lang_subdirs=`echo */config-lang.in | sed -e 's|/config-lang\.in||g'`
+ { echo *.[ch]
+ echo config/*.[ch]
+ echo config/*/*.[ch]
+ for l in $lang_subdirs
+ do echo $l/*.[ch]
+ done
+ } | tr ' ' "$nl" |
+ $AWK -v excl=po/EXCLUDES -v posr=$posr -v kopt=$kopt -v emsg=$emsg '
+function keyword_option(line) {
+ paren_index = index(line, "(")
+ name = substr(line, 1, paren_index - 1)
+ sub(/[^0-9A-Z_a-z]*$/, "", name)
+ sub(/[ ]+PARAMS/, "", name)
+ sub(/[ ]+VPARAMS/, "", name)
+ sub(/.*[^0-9A-Z_a-z]/, "", name)
+
+ args = substr(line, paren_index)
+ sub(/msgid[,\)].*/, "", args)
+ for (n = 1; sub(/^[^,]*,/, "", args); n++) {
+ continue
+ }
+
+ if (n == 1) { keyword = name }
+ else { keyword = name ":" n }
+
+ if (! keyword_seen[keyword]++) {
+ print "--keyword=" keyword > kopt
+ }
+}
+
+function spec_error_string (line) {
+ while ((percent_index = index(line, "%e")) != 0) {
+ escape = substr(line, percent_index - 1, 1)
+ line = substr(line, percent_index + 2)
+ if (escape == "%") return
+
+ bracket_index = index(line, "}")
+ if (bracket_index == 0) return
+
+ msgid = substr(line, 1, bracket_index - 1)
+ if (index(msgid, "%") != 0) return
+
+ printf("#line %d \"%s\"\n", lineno, file) > emsg
+ printf("_(\"%s\")\n", msgid) > emsg
+
+ line = substr(line, bracket_index + 1)
+ }
+}
+
+BEGIN {
+ while ((getline < excl) > 0) {
+ if ($0 ~ /^#/ || $0 ~ /^[ ]*$/)
+ continue
+ excludes[$1] = 1
+ }
+}
+
+{ if (!($0 in excludes)) {
+ print > posr
+ files[NR] = $0
+ }
+}
+
+END {
+ for (f in files) {
+ file = files[f]
+ lineno = 1
+ while (getline < file) {
+ if (/^(#[ ]*define[ ]*)?[A-Za-z_].*\(.*msgid[,\)]/) {
+ keyword_option($0)
+ } else if (/%e/) {
+ spec_error_string($0)
+ }
+ lineno++
+ }
+ }
+ print emsg > posr
+}'
+)
+
+# Run the xgettext command, with temporary added as a file to scan.
+echo "running xgettext..." >&2
+$xgettext --default-domain=$package --directory=$srcdir \
+ --add-comments `cat $kopt` --files-from=$posr \
+ -o $package.pot