forked from projectsyn/lieutenant-operator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (37 loc) · 948 Bytes
/
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
# Project parameters
BINARY_NAME ?= lieutenant-operator
VERSION ?= $(shell git describe --tags --always --dirty --match=v* || (echo "command failed $$?"; exit 1))
IMAGE_NAME ?= docker.io/projectsyn/$(BINARY_NAME):$(VERSION)
# Antora variables
# Go parameters
GOCMD ?= go
GOBUILD ?= $(GOCMD) build
GOCLEAN ?= $(GOCMD) clean
GOTEST ?= $(GOCMD) test
GOGET ?= $(GOCMD) get
.PHONY: all
all: test build
.PHONY: generate
generate:
go generate ./...
.PHONY: build
build: generate
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -v \
-o $(BINARY_NAME) \
-ldflags "-X main.Version=$(VERSION) -X 'main.BuildDate=$(shell date)'" \
cmd/manager/main.go
@echo built '$(VERSION)'
.PHONY: test
test: generate
$(GOTEST) -v -cover ./...
.PHONY: run
run: generate
go run main.go
.PHONY: clean
clean:
$(GOCLEAN)
rm -f $(BINARY_NAME)
.PHONY: docker
docker:
DOCKER_BUILDKIT=1 docker build -t $(IMAGE_NAME) .
@echo built image $(IMAGE_NAME)