-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
25 lines (21 loc) · 1.03 KB
/
Makefile
File metadata and controls
25 lines (21 loc) · 1.03 KB
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
VERSION := $(shell git describe --tags --always --dirty)
COMMIT := $(shell git rev-parse --short HEAD)
BUILD_DATE := $(shell date -u '+%Y-%m-%d %H:%M:%S')
GO_VERSION := $(shell go version | cut -d' ' -f3)
LDFLAGS := -X 'github.com/conormkelly/yts-cli/cmd.version=$(VERSION)' \
-X 'github.com/conormkelly/yts-cli/cmd.commit=$(COMMIT)' \
-X 'github.com/conormkelly/yts-cli/cmd.buildDate=$(BUILD_DATE)' \
-X 'github.com/conormkelly/yts-cli/cmd.goVersion=$(GO_VERSION)'
.PHONY: build
build:
go build -ldflags "$(LDFLAGS)" -o bin/yts
.PHONY: install
install:
go install -ldflags "$(LDFLAGS)"
.PHONY: release
release:
GOOS=linux GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o bin/yts-linux-amd64
GOOS=linux GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o bin/yts-linux-arm64
GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o bin/yts-darwin-amd64
GOOS=darwin GOARCH=arm64 go build -ldflags "$(LDFLAGS)" -o bin/yts-darwin-arm64
GOOS=windows GOARCH=amd64 go build -ldflags "$(LDFLAGS)" -o bin/yts-windows-amd64.exe