-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
102 lines (86 loc) · 2.72 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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#
# Copyright 2018 Yaacov Zamir <[email protected]>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# Major version directory
major:=v5
# Details of the version of 'antlr' that will be downloaded to process the
# grammar and generate the parser:
antlr_url:=https://www.antlr.org/download/antlr-4.7.1-complete.jar
antlr_sum:=f41dce7441d523baf9769cb7756a00f27a4b67e55aacab44525541f62d7f6688
tsl_parser_src := $(wildcard ./$(major)/cmd/tsl_parser/*.go)
tsl_sqlite_src := $(wildcard ./$(major)/cmd/tsl_sqlite/*.go)
tsl_gorm_src := $(wildcard ./$(major)/cmd/tsl_gorm/*.go)
tsl_mongo_src := $(wildcard ./$(major)/cmd/tsl_mongo/*.go)
tsl_graphql_src := $(wildcard ./$(major)/cmd/tsl_graphql/*.go)
tsl_mem_src := $(wildcard ./$(major)/cmd/tsl_mem/*.go)
all: fmt tsl_parser tsl_sqlite tsl_gorm tsl_mongo tsl_graphql tsl_mem
tsl_parser: $(tsl_parser_src)
cd ./$(major) && go build -o ../ ./cmd/tsl_parser
tsl_sqlite: $(tsl_sqlite_src)
cd ./$(major) && go build -o ../ ./cmd/tsl_sqlite
tsl_gorm: $(tsl_gorm_src)
cd ./$(major) && go build -o ../ ./cmd/tsl_gorm
tsl_mongo: $(tsl_mongo_src)
cd ./$(major) && go build -o ../ ./cmd/tsl_mongo
tsl_graphql: $(tsl_graphql_src)
cd ./$(major) && go build -o ../ ./cmd/tsl_graphql
tsl_mem: $(tsl_mem_src)
cd ./$(major) && go build -o ../ ./cmd/tsl_mem
.PHONY: lint
lint:
cd ./$(major) && golangci-lint \
run \
--skip-dirs=/pkg/parser \
--no-config \
--issues-exit-code=1 \
--deadline=15m \
--disable-all \
--enable=deadcode \
--enable=gas \
--enable=goconst \
--enable=gocyclo \
--enable=gofmt \
--enable=golint \
--enable=ineffassign \
--enable=interfacer \
--enable=lll \
--enable=maligned \
--enable=megacheck \
--enable=misspell \
--enable=structcheck \
--enable=unconvert \
--enable=varcheck \
$(NULL)
.PHONY: fmt
fmt:
cd ./$(major) && gofmt -s -l -w ./pkg/ ./cmd/
.PHONY: clean
clean:
rm -f tsl_parser
rm -f tsl_gorm
rm -f tsl_mongo
rm -f tsl_sqlite
rm -f tsl_graphql
rm -f tsl_mem
rm -f antlr
.PHONY: test
test:
cd ./$(major) && ginkgo -r ./cmd ./pkg
.PHONY: generate
generate: antlr
cd ./$(major) && java -jar ../antlr -Dlanguage=Go -o ./pkg/parser ./TSL.g4
antlr:
wget --progress=dot:giga --output-document="$@" "$(antlr_url)"
echo "$(antlr_sum) $@" | sha256sum --check