From 31d0dbd222db2f2b3fe0ca3bfdc4e320ef0eb63f Mon Sep 17 00:00:00 2001 From: Shen Li Date: Sun, 15 Nov 2015 17:36:22 +0800 Subject: [PATCH] tidb: Check reduce/reduce conflicts in Makefile --- Makefile | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 3468b1758c..84c8b4e5a2 100644 --- a/Makefile +++ b/Makefile @@ -24,13 +24,14 @@ build: install: $(GO) install ./... +TEMP_FILE = temp_parser_file + parser: go get github.com/qiuyesuifeng/goyacc go get github.com/qiuyesuifeng/golex - a=`mktemp temp.XXXXXX`; \ - goyacc -o /dev/null -xegen $$a parser/parser.y; \ - goyacc -o parser/parser.go -xe $$a parser/parser.y 2>&1 | grep "shift/reduce" | awk '{print} END {if (NR > 0) {print "Find conflict in parser.y. Please check y.output for more information."; exit 1;}}'; \ - rm -f $$a; \ + goyacc -o /dev/null -xegen $(TEMP_FILE) parser/parser.y; \ + goyacc -o parser/parser.go -xe $(TEMP_FILE) parser/parser.y 2>&1 | egrep "(shift|reduce)/reduce" | awk '{print} END {if (NR > 0) {print "Find conflict in parser.y. Please check y.output for more information."; system("rm -f $(TEMP_FILE)"); exit 1;}}'; + rm -f $(TEMP_FILE); \ rm -f y.output @if [ $(ARCH) = $(LINUX) ]; \