From: khooyp Date: Thu, 10 Feb 2011 01:59:06 +0000 (+0000) Subject: Add conditional workaround for flex < 2.5.20, such as in RedHat. X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=6445cf2c5bf8c259914aec4dce0df82453194ac7;p=francis%2Fstp.git Add conditional workaround for flex < 2.5.20, such as in RedHat. - Old versions of flex did not support the -f flag, and did not provide a destroy function. git-svn-id: https://stp-fast-prover.svn.sourceforge.net/svnroot/stp-fast-prover/trunk/stp@1139 e59a4935-1847-0410-ae03-e826735625c1 --- diff --git a/src/parser/Makefile b/src/parser/Makefile index 5e33139..25998d2 100644 --- a/src/parser/Makefile +++ b/src/parser/Makefile @@ -1,8 +1,16 @@ TOP = ../.. include $(TOP)/scripts/Makefile.common +# Workaround for flex < 2.5.20 which do not support the -f flag nor provide *_destroy functions +OLD_FLEX=$(shell flex --version | awk -F '[ .]' '{ print ($$(NF-2) < 2 || $$(NF-2) == 2 && ($$(NF-1) < 5 || $$(NF-1) == 5 && $$NF < 20)) }') + +ifeq (1,$(OLD_FLEX)) +LEX=flex -Ce +else #`From the flex manual>: -Cfe' is often a good compromise between speed and size for production scanners. LEX=flex -Cfe +endif + YACC=bison --debug -v SRCS = $(foreach foo,cvc smt smt2,lex$(foo).cpp parse$(foo).cpp) LetMgr.cpp @@ -15,6 +23,9 @@ libparser.a: $(OBJS) lex%.cpp: %.lex parse%.hpp ../AST/AST.h $(LEX) -o$@ -P$* $< +ifeq (1,$(OLD_FLEX)) + echo "int $*lex_destroy(void) { return 0; }" >> $@ +endif parse%.cpp parse%.hpp: %.y $(YACC) -o parse$*.cpp -d -p $* $<