]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
build: Fix #line statements in bison-generated files.
authorBruno Haible <bruno@clisp.org>
Sun, 25 Nov 2018 01:11:23 +0000 (02:11 +0100)
committerBruno Haible <bruno@clisp.org>
Sun, 25 Nov 2018 01:11:23 +0000 (02:11 +0100)
* gettext-tools/src/plural-exp.c: Revert changes from 2014-12-03 and 2014-12-04.
* gettext-runtime/intl/Makefile.in (PLURAL_OBJECT): Remove variable.
(OBJECTS): Use plural.lo always.
($(srcdir)/plural.c): New rule.
(.y.c, pluralx.c, pluralx.lo): Remove rules.
(mostlyclean): Delete the temporary file of the plural.c rule.
(maintainer-clean): Delete plural.c.
* gettext-tools/configure.ac (intl/Makefile): Remove PLURAL_OBJECT hack.

.gitignore
gettext-runtime/intl/Makefile.in
gettext-tools/configure.ac
gettext-tools/src/plural-exp.c

index 5faf45606df41fc4ee59d2e3219629af73f7a63b..e76f0d55e7b2701c070f3a3be7078ceef12a2b68 100644 (file)
 /gnulib-local/Makefile.in
 
 # Files generated by "make" and even kept by "make maintainer-clean":
-/gettext-runtime/intl/plural.c
 /gettext-runtime/po/en@boldquot.po
 /gettext-runtime/po/en@quot.po
 /gettext-tools/po/en@boldquot.po
 /gettext-tools/libgettextpo/ostream.priv.h
 /gettext-tools/libgettextpo/ostream.vt.h
 # Files generated by "make", using bison.
+/gettext-runtime/intl/plural.c
 /gettext-tools/src/cldr-plural.c
 /gettext-tools/src/cldr-plural.h
 /gettext-tools/src/po-gram-gen.c
index b19f3f3c4bd47376a1afd491811eae8b39879591..bbc7f8e20f45c2b814d7282431d9eb9759397a48 100644 (file)
@@ -109,10 +109,6 @@ LIBS = @LIBS@
 
 COMPILE = $(CC) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $(XCFLAGS)
 
-# This line will be replaced with pluralx.lo, when this file is used
-# in gettext-tools/intl/.  See the pluralx.lo rule below for the rationale.
-PLURAL_OBJECT = plural.lo
-
 HEADERS = \
   gmo.h \
   gettextP.h \
@@ -183,7 +179,7 @@ OBJECTS = \
   dcngettext.lo \
   dngettext.lo \
   ngettext.lo \
-  $(PLURAL_OBJECT) \
+  plural.lo \
   plural-exp.lo \
   localcharset.lo \
   threadlib.lo \
@@ -235,9 +231,11 @@ LTV_AGE=1
 .SUFFIXES:
 .SUFFIXES: .c .y .lo .sin .sed
 
-.y.c:
-       $(AM_V_YACC)$(YACC) $(YFLAGS) --output $@ $<
-       $(AM_V_at)rm -f $*.h
+$(srcdir)/plural.c: $(srcdir)/plural.y
+       $(AM_V_YACC)$(YACC) $(YFLAGS) --output plural.c $(srcdir)/plural.y \
+       && sed -e 's|".*/plural.y"|"plural.y"|' < plural.c > plural.c-tmp \
+       && rm -f plural.c plural.h \
+       && mv plural.c-tmp $(srcdir)/plural.c
 
 bindtextdom.lo: $(srcdir)/bindtextdom.c
        $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/bindtextdom.c
@@ -271,13 +269,6 @@ ngettext.lo: $(srcdir)/ngettext.c
        $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/ngettext.c
 plural.lo: $(srcdir)/plural.c
        $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/plural.c
-# $(srcdir)/plural.c contains a relative file name of the Bison source.
-# That could mess up LCOV when the C source file is referred to from a
-# different base directory.
-pluralx.c: $(srcdir)/plural.c
-       $(AM_V_GEN)sed -e 's|^#line \([0-9]*\) "\(plural\.[cy]\)"|#line \1 "$(srcdir)/\2"|' < $(srcdir)/plural.c > $@
-pluralx.lo: pluralx.c
-       $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) pluralx.c
 plural-exp.lo: $(srcdir)/plural-exp.c
        $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC --mode=compile $(COMPILE) $(srcdir)/plural-exp.c
 localcharset.lo: $(srcdir)/localcharset.c
@@ -509,7 +500,7 @@ localename.lo: $(srcdir)/gettextP.h
 localename.lo localename-table.lo: localename-table.h
 hash-string.lo dcigettext.lo loadmsgcat.lo: $(srcdir)/hash-string.h
 explodename.lo l10nflist.lo: $(srcdir)/loadinfo.h
-dcigettext.lo loadmsgcat.lo $(PLURAL_OBJECT) plural-exp.lo: $(srcdir)/plural-exp.h
+dcigettext.lo loadmsgcat.lo plural.lo plural-exp.lo: $(srcdir)/plural-exp.h
 dcigettext.lo: $(srcdir)/eval-plural.h
 localcharset.lo: $(srcdir)/localcharset.h
 bindtextdom.lo dcigettext.lo finddomain.lo loadmsgcat.lo localealias.lo lock.lo log.lo: $(srcdir)/lock.h
@@ -519,7 +510,7 @@ printf.lo: $(srcdir)/printf-args.h $(srcdir)/printf-args.c $(srcdir)/printf-pars
 # A bison-2.1 generated plural.c includes <libintl.h> if ENABLE_NLS.
 PLURAL_DEPS_yes = libintl.h
 PLURAL_DEPS_no =
-$(PLURAL_OBJECT): $(PLURAL_DEPS_@USE_INCLUDED_LIBINTL@)
+plural.lo: $(PLURAL_DEPS_@USE_INCLUDED_LIBINTL@)
 
 tags: TAGS
 
@@ -541,7 +532,7 @@ mostlyclean:
        rm -f *.a *.la *.o *.obj *.lo core core.*
        rm -f libgnuintl.h libintl.h localename-table.h ref-add.sed ref-del.sed
        rm -f -r .libs _libs
-       rm -f pluralx.c
+       rm -f plural.c-tmp
 
 clean: mostlyclean
 
@@ -552,6 +543,7 @@ distclean: clean
 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 $(srcdir)/plural.c
 
 
 # GNU gettext needs not contain the file 'VERSION' but contains some
index a944dc75c280af90ac625eed06d1439df63811fc..82fa2cd768cd1fe3ae1790b768100862d1964f04 100644 (file)
@@ -504,10 +504,8 @@ AC_CONFIG_FILES([doc/Makefile])
 
 AC_CONFIG_FILES([intl/Makefile:../gettext-runtime/intl/Makefile.in], [
   # Change srcdir variable so that it points to ../gettext-runtime/intl.
-  # Change PLURAL_OBJECT variable so that pluralx.c is used instead of plural.c.
   sed -e 's|^srcdir =.*$|srcdir = $(top_srcdir)/../gettext-runtime/intl|' \
       -e 's|^VPATH =.*$||' \
-      -e 's|^PLURAL_OBJECT = .*$|PLURAL_OBJECT = pluralx.lo|' \
     < intl/Makefile > intl/Makefile.tmp
   mv intl/Makefile.tmp intl/Makefile
   ])
index beee95506c679352990817acc84c749ca0b1e95c..a654a73c87c6d6002fe7b4760a7c82cb44c43e56 100644 (file)
@@ -1,5 +1,5 @@
 /* Expression parsing for plural form selection.
-   Copyright (C) 2000-2001, 2003, 2015-2016 Free Software Foundation, Inc.
+   Copyright (C) 2000-2001, 2003, 2014, 2018 Free Software Foundation, Inc.
    Written by Ulrich Drepper <drepper@cygnus.com>, 2000.
 
    This program is free software: you can redistribute it and/or modify
@@ -17,5 +17,5 @@
 
 /* Include the expression parsing code from libintl, with different function
    names.  */
-#include "../intl/pluralx.c"
+#include "../../gettext-runtime/intl/plural.c"
 #include "../../gettext-runtime/intl/plural-exp.c"