forked from kubearmor/kubearmor-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
69 lines (57 loc) · 1.55 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# SPDX-License-Identifier: Apache-2.0
# Copyright 2022 Authors of KubeArmor
CURDIR := $(shell pwd)
INSTALLDIR := $(shell go env GOPATH)/bin/
ifeq (, $(shell which govvv))
$(shell go install github.com/ahmetb/govvv@latest)
endif
PKG := $(shell go list ./selfupdate)
GIT_INFO := $(shell govvv -flags -pkg $(PKG))
.PHONY: build
build:
cd $(CURDIR); go mod tidy; CGO_ENABLED=0 go build -ldflags "-w -s ${GIT_INFO}" -o karmor
.PHONY: debug
debug:
cd $(CURDIR); go mod tidy; CGO_ENABLED=0 go build -ldflags "${GIT_INFO}" -o karmor
.PHONY: install
install: build
install -m 0755 karmor $(DESTDIR)$(INSTALLDIR)
.PHONY: clean
clean:
cd $(CURDIR); rm -f karmor
.PHONY: test
test:
cd $(CURDIR); go test -v ./...
.PHONY: protobuf
vm-protobuf:
cd $(CURDIR)/vm/protobuf; protoc --proto_path=. --go_opt=paths=source_relative --go_out=plugins=grpc:. vm.proto
.PHONY: gofmt
gofmt:
cd $(CURDIR); gofmt -s -d $(shell find . -type f -name '*.go' -print)
cd $(CURDIR); test -z "$(shell gofmt -s -l $(shell find . -type f -name '*.go' -print) | tee /dev/stderr)"
.PHONY: golint
golint:
ifeq (, $(shell which golint))
@{ \
set -e ;\
GOLINT_TMP_DIR=$$(mktemp -d) ;\
cd $$GOLINT_TMP_DIR ;\
go mod init tmp ;\
go get -u golang.org/x/lint/golint ;\
rm -rf $$GOLINT_TMP_DIR ;\
}
endif
cd $(CURDIR); golint ./...
.PHONY: gosec
gosec:
ifeq (, $(shell which gosec))
@{ \
set -e ;\
GOSEC_TMP_DIR=$$(mktemp -d) ;\
cd $$GOSEC_TMP_DIR ;\
go mod init tmp ;\
go install github.com/securego/gosec/v2/cmd/gosec@latest ;\
rm -rf $$GOSEC_TMP_DIR ;\
}
endif
cd $(CURDIR); gosec ./...