forked from mercedes-benz/kosmoo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
50 lines (34 loc) · 1.06 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
50
# SPDX-License-Identifier: MIT
SHELL := /bin/bash
# The name of the executable (default is current directory name)
TARGET := $(shell echo $${PWD\#\#*/})
GOOS ?= $(shell go env GOOS)
VERSION ?= $(shell git describe --tags --exact-match || \
git describe --exact-match 2> /dev/null || \
git describe --match=$(git rev-parse --short=8 HEAD) --always --dirty --abbrev=8)
SRCS = $(shell find . -type f -name '*.go' -not -path "./vendor/*")
REGISTRY ?= docker.pkg.github.com/mercedes-benz/kosmoo
all: test build docker
build:
CGO_ENABLED=0 GOOS=$(GOOS) go build \
-o kosmoo \
./main.go
docker: build
cp kosmoo kubernetes/
docker build -t $(REGISTRY)/kosmoo:$(VERSION) kubernetes/
rm kubernetes/kosmoo
push:
docker push $(REGISTRY)/kosmoo:$(VERSION)
fmt:
@gofmt -l -w $(SRCS)
test: vet fmtcheck spdxcheck lint
vet:
go vet ./...
lint:
@hack/check_golangci-lint.sh
fmtcheck:
@gofmt -l -s $(SRCS) | read; if [ $$? == 0 ]; then echo "gofmt check failed for:"; gofmt -l -s $(SRCS); exit 1; fi
spdxcheck:
@hack/check_spdx.sh
version:
@echo $(VERSION)