]> git.ipfire.org Git - thirdparty/gettext.git/commitdiff
build: Fix VPATH build failures with old bison when the *.y files are modified.
authorBruno Haible <bruno@clisp.org>
Fri, 1 May 2020 19:35:43 +0000 (21:35 +0200)
committerBruno Haible <bruno@clisp.org>
Fri, 1 May 2020 19:35:43 +0000 (21:35 +0200)
* 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.

gettext-runtime/intl/Makefile.am
gettext-tools/src/Makefile.am

index b884340df8f3e31ba9cf8ab6e10432cd1c8726da..6204d1aa4a1cc30426c1be1cc9f44b10936c187b 100644 (file)
@@ -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
index 875eb4eb04590e363c7cb81c9ff6360ce9ba1a3c..2a8b8e7fa0021f0c703ee82a513c5575ee9516de 100644 (file)
@@ -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