forked from BlockscapeNetwork/signctrl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
45 lines (37 loc) · 1.29 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
GOPATH := $(shell go env GOPATH)
# If building a release, checkout the version tag to get the correct version setting
ifneq ($(shell git symbolic-ref -q --short HEAD),)
VERSION := unreleased-$(shell git symbolic-ref -q --short HEAD)
else
VERSION := $(shell git describe --tags)
endif
GIT_COMMIT := $(shell git rev-list -1 HEAD)
LDFLAGS := -X github.com/BlockscapeNetwork/signctrl/cmd.SemVer=$(VERSION) \
-X github.com/BlockscapeNetwork/signctrl/cmd.GitCommit=$(GIT_COMMIT)
# Allow users to pass additional flags via the conventional LDFLAGS variable
LDFLAGS += $(LDFLAGS)
# Build for local system
build:
@echo "--> Building SignCTRL..."
@go build -ldflags "$(LDFLAGS)" -o build/signctrl *.go
.PHONY: build
# Build for linux
build-linux:
@echo "--> Building SignCTRL for linux/amd64..."
GOOS=linux GOARCH=amd64 $(MAKE) build
.PHONY: build-linux
# Install the binary to $GOPATH/bin
install:
@echo "--> Installing SignCTRL to "$(GOPATH)"/bin..."
@go build -ldflags "$(LDFLAGS)" -o $(GOPATH)/bin/signctrl *.go
.PHONY: install
# Download dependencies
go-mod-cache: go.sum
@echo "--> Downloading dependencies for SignCTRL..."
@go mod download
.PHONY: go-mod-cache
# Verify dependencies
go.sum: go.mod
@echo "--> Ensuring dependencies for SignCTRL have not been modified..."
@go mod verify
.PHONY: go.sum