forked from pingcap/tidb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (54 loc) · 1.86 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# tidb build rules.
ARCH="`uname -s`"
LINUX="Linux"
MAC="Darwin"
GO=godep go
LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBBuildTS=$(shell date -u '+%Y-%m-%d %I:%M:%S')"
LDFLAGS += -X "github.com/pingcap/tidb/util/printer.TiDBGitHash=$(shell git rev-parse HEAD)"
.PHONY: deps all build install parser clean todo test tidbtest mysqltest gotest interpreter
all: godep parser build test
godep:
go get github.com/tools/godep
build:
$(GO) build
install:
$(GO) install ./...
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; \
rm -f $$a; \
rm -f y.output
@if [ $(ARCH) = $(LINUX) ]; \
then \
sed -i -e 's|//line.*||' -e 's/yyEofCode/yyEOFCode/' parser/parser.go; \
elif [ $(ARCH) = $(MAC) ]; \
then \
sed -i "" 's|//line.*||' parser/parser.go; \
sed -i "" 's/yyEofCode/yyEOFCode/' parser/parser.go; \
fi
golex -o parser/scanner.go parser/scanner.l
deps:
go list -f '{{range .Deps}}{{printf "%s\n" .}}{{end}}{{range .TestImports}}{{printf "%s\n" .}}{{end}}' ./... | \
sort | uniq | grep -E '[^/]+\.[^/]+/' |grep -v "pingcap/tidb" | \
awk 'BEGIN{ print "#!/bin/bash" }{ printf("go get -u %s\n", $$1) }' > deps.sh
chmod +x deps.sh
bash deps.sh
clean:
$(GO) clean -i ./...
rm -rf *.out
rm -f deps.sh
todo:
@grep -n ^[[:space:]]*_[[:space:]]*=[[:space:]][[:alpha:]][[:alnum:]]* */*.go parser/scanner.l parser/parser.y || true
@grep -n TODO */*.go parser/scanner.l parser/parser.y tidb-test/testdata.ql || true
@grep -n BUG */*.go parser/scanner.l parser/parser.y || true
@grep -n println */*.go parser/scanner.l parser/parser.y || true
test: gotest
gotest:
$(GO) test -cover ./...
race:
$(GO) test --race -cover ./...
interpreter:
@cd interpreter && $(GO) build -ldflags '$(LDFLAGS)'