/
Makefile
93 lines (77 loc) · 2.45 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
# Copyright 2016 The uranus Authors
# This file is part of the uranus library.
#
# The uranus library is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# The uranus library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with the uranus library. If not, see <http:#www.gnu.org/licenses/>.
TEST = $(shell go list ./... |grep -v test)
GOFILES_NOVENDOR := $(shell go list -f "{{.Dir}}" ./...)
### Check and format code
# check the code for style standards; currently enforces go formatting.
# display output first, then check for success
.PHONY: check
check:
@echo "Checking code for formatting style compliance."
@gofmt -l -d ${GOFILES_NOVENDOR}
@gofmt -l ${GOFILES_NOVENDOR} | read && echo && echo "Your marmot has found a problem with the formatting style of the code." 1>&2 && exit 1 || true
# fmt runs gofmt -w on the code, modifying any files that do not match
# the style guide.
.PHONY: fmt
fmt:
@echo "Correcting any formatting style corrections."
@gofmt -l -w ${GOFILES_NOVENDOR}
### Test
.PHONY: test
test:
@echo "Testing uranus all packages"
@go test $(TEST)
### Building project
# build all targets
.PHONY: check fmt all
all:
@echo "Building all targets(uranus,uranuscli)."
@go install ./cmd/uranus
go build ./cmd/uranus
mv uranus ./build
@go install ./cmd/uranuscli
go build ./cmd/uranuscli
mv uranuscli ./build
@go install ./cmd/uranusvm
go build ./cmd/uranusvm
mv uranusvm ./build
# build all targets in windows
.PHONY: win
win:
@go install ./cmd/uranus
go build ./cmd/uranus
@move /y uranus.exe ./build >NUL
@go install ./cmd/uranuscli
go build ./cmd/uranuscli
@move /y uranuscli.exe ./build >NUL
@dir .\build\uranus*
### Clean up
# clean removes the target folder containing build artefacts
.PHONY: clean
clean:
@echo "Clean uranus executable file."
-rm ./build/uranus
-rm ./build/uranuscli
### Release
.PHONY: release
release: test
@echo "Making uranus release."
@goreleaser --snapshot --rm-dist
### solc
.PHONY: solc
solc:
@scripts/solc.sh ./build/solc
@touch build/solc