-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
42 lines (30 loc) · 1.19 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
MOCKS_DIR := ./testutil/mocks
OPFGD_PKG := github.com/babylonlabs-io/finality-gadget/cmd/opfgd
BUILDDIR ?= $(CURDIR)/build
BUILD_FLAGS := --tags '$(BUILD_TAGS)' --ldflags '$(LDFLAGS)'
BUILD_ARGS := $(BUILD_ARGS) -o $(BUILDDIR)
DOCKER ?= $(shell which docker)
GIT_ROOT := $(shell git rev-parse --show-toplevel)
# https://github.com/babylonlabs-io/finality-gadget/issues/28
mock-gen:
@which mockgen > /dev/null || CGO_ENABLED=0 go install go.uber.org/mock/mockgen@latest
mockgen -source=db/interface.go -package mocks -destination $(MOCKS_DIR)/db_mock.go
mockgen -source=finalitygadget/interface.go -package mocks -destination $(MOCKS_DIR)/finalitygadget_mock.go
mockgen -source=finalitygadget/expected_clients.go -package mocks -destination $(MOCKS_DIR)/expected_clients_mock.go
test:
go test -race ./... -v
lint:
golangci-lint run
install:
go install -trimpath $(OPFGD_PKG)
.PHONY: lint test mock-gen install
$(BUILDDIR)/:
mkdir -p $(BUILDDIR)/
build: go.sum $(BUILDDIR)/
CGO_CFLAGS="-O -D__BLST_PORTABLE__" go $@ -mod=readonly $(BUILD_FLAGS) $(BUILD_ARGS) ./...
build-docker:
$(DOCKER) build \
--tag babylonlabs-io/finality-gadget \
-f Dockerfile \
$(GIT_ROOT)
.PHONY: build build-docker