-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
39 lines (30 loc) · 1003 Bytes
/
Makefile
File metadata and controls
39 lines (30 loc) · 1003 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
27
28
29
30
31
32
33
34
35
36
37
38
39
.PHONY: build clean test fmt lint help version
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo "dev")
GIT_COMMIT ?= $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
BUILD_DATE ?= $(shell date -u '+%Y-%m-%d_%H:%M:%S')
LDFLAGS := -X github.com/danielgatis/revoshell/pkg/version.Version=$(VERSION) \
-X github.com/danielgatis/revoshell/pkg/version.GitCommit=$(GIT_COMMIT) \
-X github.com/danielgatis/revoshell/pkg/version.BuildDate=$(BUILD_DATE)
build:
@echo "Building revoshell..."
@echo "Version: $(VERSION)"
@echo "Commit: $(GIT_COMMIT)"
@echo "Build Date: $(BUILD_DATE)"
@mkdir -p bin
@go build -ldflags "$(LDFLAGS)" -o bin/revoshell .
clean:
@rm -rf bin
test:
@go test -v -race ./...
fmt:
@gofmt -s -w .
@go mod tidy
lint:
@go tool golangci-lint run --fix --timeout 10m0s
deps:
@go mod download
@go mod tidy
version:
@echo "Version: $(VERSION)"
@echo "Commit: $(GIT_COMMIT)"
@echo "Build Date: $(BUILD_DATE)"