-
Notifications
You must be signed in to change notification settings - Fork 28
/
Makefile
50 lines (37 loc) · 1.05 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
BINARY = musig
GOARCH = amd64
COMMIT=$(shell git rev-parse HEAD)
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS = -ldflags "-X main.VERSION=${BRANCH}:${COMMIT}"
# Enable go modules
GOCMD = GO111MODULE=on go
# Build the project
all: build
.PHONY: build
build:
${GOCMD} build ${LDFLAGS} -o ./bin/${BINARY} ./cmd/musig/main.go
.PHONY: linux
linux:
GOOS=linux GOARCH=${GOARCH} ${GOCMD} build ${LDFLAGS} -o ${BINARY}-linux-${GOARCH} .
.PHONY: macos
macos:
GOOS=darwin GOARCH=${GOARCH} ${GOCMD} build ${LDFLAGS} -o ${BINARY}-macos-${GOARCH} .
.PHONY: windows
windows:
GOOS=windows GOARCH=${GOARCH} ${GOCMD} build ${LDFLAGS} -o ${BINARY}-windows-${GOARCH}.exe .
cross: linux macos windows
.PHONY: test
test:
${GOCMD} get -v ./...; \
${GOCMD} vet $$(go list ./... | grep -v /vendor/); \
${GOCMD} test -v -race ./...; \
.PHONY: fmt
fmt:
${GOCMD} fmt $$(go list ./... | grep -v /vendor/)
.PHONY: tidy
tidy:
${GOCMD} mod tidy
.PHONY: download
download:
./scripts/dl_dataset.sh