From: Bruno Haible Date: Sat, 1 Aug 2020 15:25:10 +0000 (+0200) Subject: Fix build failure with bison 3.7. Revisit bison Makefile rules. X-Git-Tag: v0.21.1~109 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=934ef444c53fd745798ff8402da7ef8b39464bab;p=thirdparty%2Fgettext.git Fix build failure with bison 3.7. Revisit bison Makefile rules. * gettext-runtime/intl/Makefile.am ($(srcdir)/plural.c): Keep and distribute the plural.h file. Don't use --output option. * gettext-tools/src/Makefile.am (YACC): Removed unused variable. (po-gram-gen.c, po-gram-gen.h): Correct the #line statements in the generated files. (po-gram-gen2.h): Likewise. (cldr-plural.c, cldr-plural.h): Likewise. --- diff --git a/.gitignore b/.gitignore index 1de922cea..7f7ab4179 100644 --- a/.gitignore +++ b/.gitignore @@ -477,6 +477,7 @@ /gettext-tools/libgettextpo/iconv_open-zos.h # Files generated by "make", using bison. /gettext-runtime/intl/plural.c +/gettext-runtime/intl/plural.h /gettext-tools/src/cldr-plural.c /gettext-tools/src/cldr-plural.h /gettext-tools/src/po-gram-gen.c diff --git a/gettext-runtime/intl/Makefile.am b/gettext-runtime/intl/Makefile.am index 22de832e9..d3fa63fc6 100644 --- a/gettext-runtime/intl/Makefile.am +++ b/gettext-runtime/intl/Makefile.am @@ -70,8 +70,9 @@ AM_CPPFLAGS += \ -DDEPENDS_ON_LIBICONV=1 BISON = @INTLBISON@ -YACC = $(BISON) -d BISONFLAGS = --name-prefix=__gettext +# Just to shut up Automake "error: Yacc source seen but 'YACC' is undefined". +YACC = $(BISON) -d # Tell the ELF linker which symbols to export. AM_CFLAGS = @CFLAG_VISIBILITY@ @@ -321,19 +322,29 @@ MOSTLYCLEANFILES += localename-table.h # script. # Additionally, here we need a rule that works even without a VPATH variable. # Therefore we override this rule. +# Note: There is no point in using Bison's --output option, since we need to +# postprocess the generated files and we don't want that unpostprocessed files +# remain in place if the user interrupts the build through Ctrl-C. $(srcdir)/plural.c: $(srcdir)/plural.y - $(AM_V_YACC)$(YACC) $(BISONFLAGS) --output plural.c $(srcdir)/plural.y \ + $(AM_V_YACC)$(BISON) -d $(BISONFLAGS) $(srcdir)/plural.y \ && test ':' = '$(BISON)' || { \ - 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; \ + sed -e 's|".*/plural.y"|"plural.y"|' \ + -e 's|"plural\.tab\.c"|"plural.c"|' \ + -e 's|"plural\.tab\.h"|"plural.h"|' \ + < plural.tab.c > plural.c-tmp \ + && sed -e 's|".*/plural.y"|"plural.y"|' \ + -e 's|"plural\.tab\.h"|"plural.h"|' \ + < plural.tab.h > plural.h-tmp \ + && rm -f plural.tab.c plural.tab.h \ + && mv plural.c-tmp $(srcdir)/plural.c \ + && mv plural.h-tmp $(srcdir)/plural.h; \ } # Don't put plural.c into BUILT_SOURCES. Since plural.c is in the source # directory, 'make' does not find it without a VPATH variable. -MOSTLYCLEANFILES += plural.c-tmp -MAINTAINERCLEANFILES += plural.c -EXTRA_DIST += plural.c +MOSTLYCLEANFILES += plural.tab.c plural.tab.h plural.c-tmp plural.h-tmp +MAINTAINERCLEANFILES += plural.c plural.h +EXTRA_DIST += plural.c plural.h # Rules for compiling a .c file, that work even without a VPATH variable. bindtextdom.lo: $(srcdir)/bindtextdom.c diff --git a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am index 764ffadbd..510ab2a08 100644 --- a/gettext-tools/src/Makefile.am +++ b/gettext-tools/src/Makefile.am @@ -113,7 +113,6 @@ OTHERPROGDEPENDENCIES = ../gnulib-lib/libgettextlib.la $(WOE32_LDADD) SED = sed BISON = @TOOLS_BISON@ -YACC = @YACC@ -d JAR = @JAR@ JAVACOMP = $(SHELL) ../javacomp.sh CSHARPCOMP = $(SHELL) ../csharpcomp.sh @@ -551,24 +550,37 @@ endif # always fires and, since $(srcdir) is read-only, the commands which update # (or at least touch) $(srcdir)/FILE.c and $(srcdir)/FILE.h fail. # Therefore we don't use ylwrap. +# +# Note: There is no point in using Bison's --output option, since we need to +# postprocess the generated files and we don't want that unpostprocessed files +# remain in place if the user interrupts the build through Ctrl-C. po-gram-gen.c po-gram-gen.h: po-gram-gen.y $(AM_V_YACC)$(BISON) -d $(YFLAGS) $(AM_YFLAGS) $(srcdir)/po-gram-gen.y \ && test ':' = '$(BISON)' || { \ - sed -e 's|".*/po-gram-gen.y"|"po-gram-gen.y"|' < po-gram-gen.tab.c > po-gram-gen.c-tmp \ - && rm -f po-gram-gen.tab.c \ + sed -e 's|".*/po-gram-gen.y"|"po-gram-gen.y"|' \ + -e 's|"po-gram-gen\.tab\.c"|"po-gram-gen.c"|' \ + -e 's|"po-gram-gen\.tab\.h"|"po-gram-gen.h"|' \ + < po-gram-gen.tab.c > po-gram-gen.c-tmp \ + && sed -e 's|".*/po-gram-gen.y"|"po-gram-gen.y"|' \ + -e 's|"po-gram-gen\.tab\.h"|"po-gram-gen.h"|' \ + < po-gram-gen.tab.h > po-gram-gen.h-tmp \ + && rm -f po-gram-gen.tab.c po-gram-gen.tab.h \ && mv po-gram-gen.c-tmp $(srcdir)/po-gram-gen.c \ - && mv po-gram-gen.tab.h $(srcdir)/po-gram-gen.h; \ + && mv po-gram-gen.h-tmp $(srcdir)/po-gram-gen.h; \ } BUILT_SOURCES += po-gram-gen.c po-gram-gen.h -MOSTLYCLEANFILES += po-gram-gen.tab.c po-gram-gen.tab.h po-gram-gen.c-tmp +MOSTLYCLEANFILES += po-gram-gen.tab.c po-gram-gen.tab.h po-gram-gen.c-tmp po-gram-gen.h-tmp MAINTAINERCLEANFILES += po-gram-gen.c po-gram-gen.h EXTRA_DIST += po-gram-gen.c po-gram-gen.h + # po-gram-gen2.h is generated from po-gram-gen.h and is also distributed in the # tarballs (just for convenience). po-gram-gen2.h: po-gram-gen.h - $(SED) -e 's/yy/po_gram_/g' -e 's/extern /extern DLL_VARIABLE /' $(srcdir)/po-gram-gen.h > po-gram-gen2.h-tmp \ + $(SED) -e 's/yy/po_gram_/g' -e 's/extern /extern DLL_VARIABLE /' \ + -e 's|"po-gram-gen\.h"|"po-gram-gen2.h"|' \ + < $(srcdir)/po-gram-gen.h > po-gram-gen2.h-tmp \ && mv po-gram-gen2.h-tmp $(srcdir)/po-gram-gen2.h BUILT_SOURCES += po-gram-gen2.h MOSTLYCLEANFILES += po-gram-gen2.h-tmp @@ -580,13 +592,19 @@ po-lex.o po-lex.lo: po-gram-gen2.h cldr-plural.c cldr-plural.h: cldr-plural.y $(AM_V_YACC)$(BISON) -d $(YFLAGS) $(AM_YFLAGS) $(srcdir)/cldr-plural.y \ && test ':' = '$(BISON)' || { \ - sed -e 's|".*/cldr-plural.y"|"cldr-plural.y"|' < cldr-plural.tab.c > cldr-plural.c-tmp \ - && rm -f cldr-plural.tab.c \ + sed -e 's|".*/cldr-plural.y"|"cldr-plural.y"|' \ + -e 's|"cldr-plural\.tab\.c"|"cldr-plural.c"|' \ + -e 's|"cldr-plural\.tab\.h"|"cldr-plural.h"|' \ + < cldr-plural.tab.c > cldr-plural.c-tmp \ + && sed -e 's|".*/cldr-plural.y"|"cldr-plural.y"|' \ + -e 's|"cldr-plural\.tab\.h"|"cldr-plural.h"|' \ + < cldr-plural.tab.h > cldr-plural.h-tmp \ + && rm -f cldr-plural.tab.c cldr-plural.tab.h \ && mv cldr-plural.c-tmp $(srcdir)/cldr-plural.c \ - && mv cldr-plural.tab.h $(srcdir)/cldr-plural.h; \ + && mv cldr-plural.h-tmp $(srcdir)/cldr-plural.h; \ } BUILT_SOURCES += cldr-plural.c cldr-plural.h -MOSTLYCLEANFILES += cldr-plural.tab.c cldr-plural.tab.h cldr-plural.c-tmp +MOSTLYCLEANFILES += cldr-plural.tab.c cldr-plural.tab.h cldr-plural.c-tmp cldr-plural.h-tmp MAINTAINERCLEANFILES += cldr-plural.c cldr-plural.h EXTRA_DIST += cldr-plural.c cldr-plural.h