-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
71 lines (56 loc) · 2.15 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
# This Makefile is meant to be used by people that do not usually work
# with Go source code. If you know what GOPATH is then you probably
# don't need to bother with make.
.PHONY: lint-fix lint-deps lint shisui shisui-image test fmt clean devtools help
GOBIN = ./build/bin
GO ?= latest
GORUN = go run
GIT_COMMIT := $(shell git rev-parse HEAD)
GIT_DATE := $(shell git log -1 --format=%ci | cut -d ' ' -f 1)
#? shisui: Build shisui
shisui:
go build -ldflags "-X github.com/optimism-java/shisui2/internal/version.gitCommit=$(GIT_COMMIT) -X github.com/optimism-java/shisui2/internal/version.gitDate=$(GIT_DATE)" ./cmd/shisui/main.go
mkdir -p $(GOBIN)
mv main $(GOBIN)/shisui
@echo "Done building."
@echo "Run \"$(GOBIN)/shisui\" to launch shisui."
#? shisui-image: Build shisui image
shisui-image:
docker build -t ghcr.io/optimism-java/shisui:latest -f Dockerfile .
#? fmt: Ensure consistent code formatting.
fmt:
gofmt -s -w $(shell find . -name "*.go")
#? test: Run the tests.
test:
go test -v ./...
#? clean: Clean go cache, built executables, and the auto generated folder.
clean:
go clean -cache
rm -fr build/_workspace/pkg/ $(GOBIN)/*
# The devtools target installs tools required for 'go generate'.
# You need to put $GOBIN (or $GOPATH/bin) in your PATH to use 'go generate'.
#? devtools: Install recommended developer tools.
devtools:
env GOBIN= go install golang.org/x/tools/cmd/stringer@latest
env GOBIN= go install github.com/fjl/gencodec@latest
env GOBIN= go install google.golang.org/protobuf/cmd/protoc-gen-go@latest
env GOBIN= go install ./cmd/abigen
@type "solc" 2> /dev/null || echo 'Please install solc'
@type "protoc" 2> /dev/null || echo 'Please install protoc'
#? help: Get more info on make commands.
help: Makefile
@echo ''
@echo 'Usage:'
@echo ' make [target]'
@echo ''
@echo 'Targets:'
@sed -n 's/^#?//p' $< | column -t -s ':' | sort | sed -e 's/^/ /'
#? lint-deps: Install lint dependencies.
lint-deps:
@which golangci-lint || go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
#? lint: Run linters.
lint: lint-deps
golangci-lint run
#? lint-fix: Run linters and fix issues.
lint-fix: lint-deps
golangci-lint run --fix