-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
executable file
·40 lines (30 loc) · 1.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
PACKAGES := $(shell go list ./... | grep -v '/simulation')
VERSION := $(shell git branch | grep \* | cut -d ' ' -f2)
COMMIT := $(shell git rev-parse --short HEAD)
GOSUM := $(shell which gosum)
export GO111MODULE=on
BUILD_TAGS := -s -w \
-X github.com/commitHub/commitBlockchain/version.Version=${VERSION} \
-X github.com/commitHub/commitBlockchain/version.Commit=${COMMIT}
ifneq (${GOSUM},)
ifneq (${wildcard go.sum},)
BUILD_TAGS += -X github.com/commitHub/commitBlockchain/version.VendorHash=$(shell ${GOSUM} go.sum)
endif
endif
BUILD_FLAGS += -ldflags "${BUILD_TAGS}"
all: install
build: go.sum
ifeq (${OS},Windows_NT)
go build -mod=readonly ${BUILD_FLAGS} -o bin/maind.exe main/cmd/maind/
go build -mod=readonly ${BUILD_FLAGS} -o bin/maincli.exe main/cmd/maincli/
else
go build -mod=readonly ${BUILD_FLAGS} -o bin/maind main/cmd/maind/
go build -mod=readonly ${BUILD_FLAGS} -o bin/maincli main/cmd/maincli/
endif
install:
go install -mod=readonly ${BUILD_FLAGS} ./main/cmd/maind
go install -mod=readonly ${BUILD_FLAGS} ./main/cmd/maincli
go.sum:
@echo "--> Ensure dependencies have not been modified"
@go mod verify
.PHONY: all build install go.sum