From: Bruno Haible Date: Fri, 1 May 2020 19:35:43 +0000 (+0200) Subject: build: Fix VPATH build failures with old bison when the *.y files are modified. X-Git-Tag: v0.21~73 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42c37e2889fb0cf7b8dbe033dcb573b3ef62f697;p=thirdparty%2Fgettext.git build: Fix VPATH build failures with old bison when the *.y files are modified. * gettext-runtime/intl/Makefile.am (BISON): New variable. (YACC): Use it. (plural.c): Don't do the post-processing if a suitable version of bison was not found. * gettext-tools/src/Makefile.am (BISON): New variable. (po-gram-gen.c, cldr-plural.c): Don't do the post-processing if a suitable version of bison was not found. --- diff --git a/gettext-runtime/intl/Makefile.am b/gettext-runtime/intl/Makefile.am index b884340df..6204d1aa4 100644 --- a/gettext-runtime/intl/Makefile.am +++ b/gettext-runtime/intl/Makefile.am @@ -69,7 +69,8 @@ AM_CPPFLAGS += \ -Drelocate2=libintl_relocate2 \ -DDEPENDS_ON_LIBICONV=1 -YACC = @INTLBISON@ -d +BISON = @INTLBISON@ +YACC = $(BISON) -d BISONFLAGS = --name-prefix=__gettext # Tell the ELF linker which symbols to export. @@ -322,9 +323,11 @@ MOSTLYCLEANFILES += localename-table.h $(srcdir)/plural.c: $(srcdir)/plural.y $(AM_V_YACC)$(YACC) $(BISONFLAGS) --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 + && 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; \ + } # 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 diff --git a/gettext-tools/src/Makefile.am b/gettext-tools/src/Makefile.am index 875eb4eb0..2a8b8e7fa 100644 --- a/gettext-tools/src/Makefile.am +++ b/gettext-tools/src/Makefile.am @@ -92,6 +92,7 @@ LDADD = ../gnulib-lib/libgettextlib.la $(LTLIBUNISTRING) @LTLIBINTL@ $(WOE32_LDA OTHERPROGDEPENDENCIES = ../gnulib-lib/libgettextlib.la $(WOE32_LDADD) SED = sed +BISON = @TOOLS_BISON@ YACC = @YACC@ -d JAR = @JAR@ JAVACOMP = $(SHELL) ../javacomp.sh @@ -522,10 +523,12 @@ po-gram-gen.c po-gram-gen.h: po-gram-gen.y y.tab.h po-gram-gen.h \ y.output po-gram-gen.output \ -- $(YACC) $(YFLAGS) $(AM_YFLAGS) \ - && sed -e 's|".*/po-gram-gen.y"|"po-gram-gen.y"|' < po-gram-gen.c > po-gram-gen.c-tmp \ - && rm -f po-gram-gen.c \ - && mv po-gram-gen.c-tmp $(srcdir)/po-gram-gen.c \ - && { test '$(srcdir)' = . || mv po-gram-gen.h $(srcdir)/po-gram-gen.h; } + && test ':' = '$(BISON)' || { \ + sed -e 's|".*/po-gram-gen.y"|"po-gram-gen.y"|' < po-gram-gen.c > po-gram-gen.c-tmp \ + && rm -f po-gram-gen.c \ + && mv po-gram-gen.c-tmp $(srcdir)/po-gram-gen.c \ + && { test '$(srcdir)' = . || mv po-gram-gen.h $(srcdir)/po-gram-gen.h; }; \ + } BUILT_SOURCES += po-gram-gen.c po-gram-gen.h MOSTLYCLEANFILES += po-gram-gen.c-tmp MAINTAINERCLEANFILES += po-gram-gen.c po-gram-gen.h @@ -549,10 +552,12 @@ cldr-plural.c cldr-plural.h: cldr-plural.y y.tab.h cldr-plural.h \ y.output cldr-plural.output \ -- $(YACC) $(YFLAGS) $(AM_YFLAGS) \ - && sed -e 's|".*/cldr-plural.y"|"cldr-plural.y"|' < cldr-plural.c > cldr-plural.c-tmp \ - && rm -f cldr-plural.c \ - && mv cldr-plural.c-tmp $(srcdir)/cldr-plural.c \ - && { test '$(srcdir)' = . || mv cldr-plural.h $(srcdir)/cldr-plural.h; } + && test ':' = '$(BISON)' || { \ + sed -e 's|".*/cldr-plural.y"|"cldr-plural.y"|' < cldr-plural.c > cldr-plural.c-tmp \ + && rm -f cldr-plural.c \ + && mv cldr-plural.c-tmp $(srcdir)/cldr-plural.c \ + && { test '$(srcdir)' = . || mv cldr-plural.h $(srcdir)/cldr-plural.h; }; \ + } BUILT_SOURCES += cldr-plural.c cldr-plural.h MOSTLYCLEANFILES += cldr-plural.c-tmp MAINTAINERCLEANFILES += cldr-plural.c cldr-plural.h