forked from hemilabs/heminetwork
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
85 lines (63 loc) · 2.14 KB
/
Makefile
File metadata and controls
85 lines (63 loc) · 2.14 KB
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
# Copyright (c) 2024-2025 Hemi Labs, Inc.
# Use of this source code is governed by the MIT License,
# which can be found in the LICENSE file.
# PROJECTPATH is the project root directory.
# This Makefile is stored in the project root directory, so the directory is
# retrieved by getting the directory of this Makefile.
PROJECTPATH = $(abspath $(dir $(realpath $(firstword $(MAKEFILE_LIST)))))
export GOBIN=$(PROJECTPATH)/bin
export GOCACHE=$(PROJECTPATH)/.gocache
export GOPKG=$(PROJECTPATH)/pkg
GO_LDFLAGS=
DIST=$(PROJECTPATH)/dist
project = heminetwork
version = $(shell git describe --tags 2>/dev/null || echo "v0.0.0")
cmds = \
bfgd \
hemictl \
hproxyd \
keygen \
popmd \
tbcd
.PHONY: all clean deps go-deps $(cmds) build install lint lint-deps tidy race test vulncheck \
vulncheck-deps
all: tidy build lint test install
clean: clean-test
rm -rf $(GOBIN) $(GOCACHE) $(GOPKG)
clean-test:
rm -rf $(PROJECTPATH)/service/tbc/.testleveldb/
deps: lint-deps vulncheck-deps go-deps
go-deps:
go mod download
go mod tidy
go mod verify
$(cmds):
go build -trimpath -ldflags "$(GO_LDFLAGS)" -o $(GOBIN)/$@ ./cmd/$@
build:
go build ./...
install: $(cmds)
define LICENSE_HEADER
Copyright (c) {{.year}} {{.author}}
Use of this source code is governed by the MIT License,
which can be found in the LICENSE file.
endef
export LICENSE_HEADER
lint:
$(shell go env GOPATH)/bin/golangci-lint fmt ./...
$(shell go env GOPATH)/bin/golangci-lint run --fix ./...
$(shell go env GOPATH)/bin/golicenser -tmpl="$$LICENSE_HEADER" -author="Hemi Labs, Inc." -year-mode=git-range -fix ./...
lint-deps:
@echo "Installing with $(shell go env GOVERSION)"
GOBIN=$(shell go env GOPATH)/bin go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0
GOBIN=$(shell go env GOPATH)/bin go install github.com/joshuasing/golicenser/cmd/golicenser@v0.3
GOBIN=$(shell go env GOPATH)/bin go install mvdan.cc/gofumpt@v0.9.1
tidy:
go mod tidy
race:
go test -v -race ./...
test:
go test -v -test.timeout=20m ./...
vulncheck:
$(shell go env GOPATH)/bin/govulncheck ./...
vulncheck-deps:
GOBIN=$(shell go env GOPATH)/bin go install golang.org/x/vuln/cmd/govulncheck@latest