-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
36 lines (28 loc) · 900 Bytes
/
Makefile
File metadata and controls
36 lines (28 loc) · 900 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
all: build
GIT_COMMIT:=$(shell git rev-list -1 HEAD)
GIT_LAST_TAG:=$(shell git describe --abbrev=0 --tags)
GIT_EXACT_TAG:=$(shell git name-rev --name-only --tags HEAD)
BUILD_DATE := $(shell date -u +'%Y-%m-%dT%H:%M:%SZ')
COMMANDS_PATH:=github.com/distrobyte/gerry/internal/config
LDFLAGS:=-X ${COMMANDS_PATH}.GitCommit=${GIT_COMMIT} \
-X ${COMMANDS_PATH}.GitLastTag=${GIT_LAST_TAG} \
-X ${COMMANDS_PATH}.GitExactTag=${GIT_EXACT_TAG} \
-X ${COMMANDS_PATH}.BuildDate=${BUILD_DATE}
.PHONY: build
build:
CGO_ENABLED=0 go build -ldflags "$(LDFLAGS)" -o bin/gerry .
.PHONY: debug-build
debug-build:
go build -ldflags "$(LDFLAGS)" -gcflags=all="-N -l" -o bin/gerry .
.PHONY: install
install:
go install -ldflags "$(LDFLAGS)" .
.PHONY: docker
docker: build
@docker build -t ghcr.io/distrobyte/gerry:$(GIT_COMMIT) .
.PHONY: test
test:
go test -v -bench=. ./...
.PHONY: watch
watch:
air start