From ecad2dfb109571c2b91760891f2cf62b53a1cdc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Villemot?= Date: Wed, 14 Aug 2019 11:21:47 +0200 Subject: [PATCH] Avoid running bison and flex multiple times when doing parallel builds --- src/Makefile.am | 12 +++++++++--- src/macro/Makefile.am | 8 ++++++-- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/src/Makefile.am b/src/Makefile.am index aced0535..b594a830 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -68,14 +68,20 @@ dynare_m_CPPFLAGS = $(BOOST_CPPFLAGS) -I. dynare_m_LDFLAGS = $(AM_LDFLAGS) $(BOOST_LDFLAGS) dynare_m_LDADD = macro/libmacro.a $(BOOST_FILESYSTEM_LIB) $(BOOST_SYSTEM_LIB) -DynareFlex.cc FlexLexer.h: DynareFlex.ll +DynareFlex.cc: DynareFlex.ll $(LEX) -o DynareFlex.cc DynareFlex.ll + +FlexLexer.h: cp $(LEXINC)/FlexLexer.h . || test -f ./FlexLexer.h dynare_m-DynareFlex.$(OBJEXT): CXXFLAGS += -Wno-old-style-cast -DynareBison.cc DynareBison.hh location.hh stack.hh position.hh: DynareBison.yy - $(YACC) -W -o DynareBison.cc DynareBison.yy +# We do not use a multiple target rule for Bison, because otherwise it will be +# run several times in parallel builds +DynareBison.cc: DynareBison.yy + $(YACC) -W -o $@ $< + +DynareBison.hh location.hh stack.hh position.hh: DynareBison.cc all-local: $(PROGRAMS) diff --git a/src/macro/Makefile.am b/src/macro/Makefile.am index a23480b0..c97e99fc 100644 --- a/src/macro/Makefile.am +++ b/src/macro/Makefile.am @@ -26,5 +26,9 @@ Tokenizer.cc: Tokenizer.ll libmacro_a-Tokenizer.$(OBJEXT): CXXFLAGS += -Wno-old-style-cast -Parser.cc Parser.hh location.hh stack.hh position.hh: Parser.yy - $(YACC) -W -o Parser.cc Parser.yy +# We do not use a multiple target rule for Bison, because otherwise it will be +# run several times in parallel builds +Parser.cc: Parser.yy + $(YACC) -W -o $@ $< + +Parser.hh location.hh stack.hh position.hh: Parser.cc