-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
80 lines (63 loc) · 2.83 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
OBJS = $(shell find cmd -mindepth 1 -type d -execdir printf '%s\n' {} +)
TARGETS = sdk_targets.json
SHELL := /usr/bin/env bash
SETUP_VERSIONS = $(shell jq -r '.versions|map("setup-\(.)")[]' ${TARGETS})
BUILD_VERSIONS = $(shell jq -r '.versions|map("build-\(.)")[]' ${TARGETS})
BUILD_VERSIONS_DEBUG = $(shell jq -r '.versions|map("build-\(.)-debug")[]' ${TARGETS})
STORE_MOD_VERSIONS = $(shell jq -r '.versions|map("store-mod-\(.)")[]' ${TARGETS})
TEST_VERSIONS = $(shell jq -r '.versions|map("test-\(.)")[]' ${TARGETS})
COVERAGE_VERSIONS = $(shell jq -r '.versions|map("coverage-\(.)")[]' ${TARGETS})
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
COMMIT := $(shell git log -1 --format='%H')
BASEPKG = github.com/emerishq/tracelistener
.PHONY: clean $(SETUP_VERSIONS) $(BUILD_VERSIONS)
$(BUILD_VERSIONS):
go build -o build/tracelistener -v \
-tags $(shell echo $@ | sed -e 's/build-/sdk_/g' -e 's/-/_/g'),muslc \
-ldflags "-X main.Version=${BRANCH}-${COMMIT} -X main.SupportedSDKVersion=$(shell echo $@ | sed -e 's/build-//g' -e 's/-/_/g')" \
${BASEPKG}/cmd/tracelistener
$(BUILD_VERSIONS_DEBUG):
go build -o build/tracelistener -v \
-gcflags=all="-N -l" \
-tags $(shell echo $@ | sed -e 's/build-/sdk_/g' -e 's/-/_/g' -e 's/_debug//g'),muslc \
-ldflags "-X main.Version=${BRANCH}-${COMMIT} -X main.SupportedSDKVersion=$(shell echo $@ | sed -e 's/build-//g' -e 's/-/_/g')" \
${BASEPKG}/cmd/tracelistener
resetchain:
go build -o build/resetchain -v \
-gcflags=all="-N -l" \
-tags muslc \
-ldflags "-X main.Version=${BRANCH}-${COMMIT}" \
${BASEPKG}/cmd/resetchain
clean:
rm -rf build
rm go.mod go.sum | true
cp mods/go.mod.bare ./go.mod
docker:
docker build -t emeris/tracelistener --build-arg GIT_TOKEN=${GITHUB_TOKEN} -f Dockerfile .
$(SETUP_VERSIONS):
cp mods/go.mod.$(shell echo $@ | sed 's/setup-//g') ./go.mod
cp mods/go.sum.$(shell echo $@ | sed 's/setup-//g') ./go.sum
available-go-tags:
@echo Available Go \`//go:build\' tags:
@jq -r '.versions|map("sdk_\(.)")[]' ${TARGETS}
versions-json:
@jq -r -c "map( { "versions": .[] } )" ${TARGETS}
$(STORE_MOD_VERSIONS):
cp ./go.mod mods/go.mod.$(shell echo $@ | sed 's/store-mod-//g')
cp ./go.sum mods/go.sum.$(shell echo $@ | sed 's/store-mod-//g')
$(TEST_VERSIONS):
go test -v -failfast -race -count=1 \
-tags $(shell echo $@ | sed -e 's/test-/sdk_/g' -e 's/-/_/g'),muslc \
./...
$(COVERAGE_VERSIONS):
go test -v -failfast -race -coverprofile=coverage.out -covermode=atomic -count=1 \
-tags $(shell echo $@ | sed -e 's/coverage-/sdk_/g' -e 's/-/_/g'),muslc \
./...
generate-test-data:
./tracelistener/scripts/multichain_setup_script.sh
./tracelistener/scripts/generate_txs.sh
./tracelistener/scripts/relayer_script.sh
./tracelistener/scripts/stop_daemons.sh
sqlgen:
rm -rf ./tracelistener/tables
go run ./cmd/sqlgen/... --config sqlmodels.yaml --out ./tracelistener/tables