-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
49 lines (41 loc) · 1.48 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
# Copyright 2023 Furqan Software Ltd. All rights reserved.
BUILD_TAG := $(shell git describe --tags)
BUILD_TIME := $(shell date -u '+%Y-%m-%dT%H:%M:%SZ')
PRINTD_EXT :=
ifeq ($(shell go env GOOS),windows)
PRINTD_EXT := .exe
endif
.PHONY: printd
printd:
go generate
go build -ldflags "-X main.version=$(BUILD_TAG:v%=%) -X main.date=$(BUILD_TIME)" -o printd$(PRINTD_EXT) .
.PHONY: lint
lint:
staticcheck .
.PHONY: lint.tools.install
lint.tools.install:
go install honnef.co/go/tools/cmd/staticcheck@2023.1.2
.PHONY: test
test:
go test -race -v .
.PHONY: goversioninfo
goversioninfo:
ifeq ($(shell go env GOOS),windows)
${GOPATH}/bin/goversioninfo \
-o="rsrc_$(shell go env GOOS)_$(shell go env GOARCH).syso" \
-copyright="© 2015-$(shell date +'%Y') Furqan Software Ltd." \
-file-version=v$(BUILD_TAG:v%=%) \
-product-version=v$(BUILD_TAG:v%=%) \
-ver-major=$(word 1,$(subst ., ,$(BUILD_TAG:v%=%))) \
-ver-minor=$(word 2,$(subst ., ,$(BUILD_TAG:v%=%))) \
-ver-patch=$(word 3,$(subst ., ,$(word 1,$(subst -, ,$(BUILD_TAG:v%=%))))) \
-ver-build=0 \
-product-ver-major=$(word 1,$(subst ., ,$(BUILD_TAG:v%=%))) \
-product-ver-minor=$(word 2,$(subst ., ,$(BUILD_TAG:v%=%))) \
-product-ver-patch=$(word 3,$(subst ., ,$(word 1,$(subst -, ,$(BUILD_TAG:v%=%))))) \
-product-ver-build=0 \
-arm=$(if $(filter arm64,$(shell go env GOARCH)),true,false)
endif
.PHONY: goversioninfo.install
goversioninfo.install:
go install github.com/josephspurrier/goversioninfo/cmd/goversioninfo@v1.4.0