-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
26 lines (21 loc) · 829 Bytes
/
Makefile
File metadata and controls
26 lines (21 loc) · 829 Bytes
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
# Version
GIT_TAG ?= $(shell git describe --tags $(git rev-list --tags --max-count=1))
GIT_COMMIT ?= $(shell git rev-parse HEAD)
BUILD_DATE ?= $(shell date +%FT%T%z)
# Go build ldflags
LDFLAG_TAG := -X 'github.com/itiky/alieninvasion/cmd/alieninvasion.GitTag=$(GIT_TAG)'
LDFLAG_COMMIT := -X 'github.com/itiky/alieninvasion/cmd/alieninvasion.GitCommit=$(GIT_COMMIT)'
LDFLAG_BUILD := -X 'github.com/itiky/alieninvasion/cmd/alieninvasion.BuildDate=$(BUILD_DATE)'
# Output names
BINARY_NAME := ai
.PHONY: deps
deps:
@echo "Downloading go.mod dependencies"
go mod download
.PHONY: lint
lint:
golangci-lint run
.PHONY: build
build-binary: deps
@echo "Building binary ($(BINARY_NAME)): $(GIT_TAG).$(GIT_COMMIT).$(BUILD_DATE)"
@go build -ldflags "$(LDFLAG_TAG) $(LDFLAG_COMMIT) $(LDFLAG_BUILD)" -o $(BINARY_NAME) ./cmd/main.go