forked from alibaba/kubeskoop
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
55 lines (43 loc) · 1.7 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
# Setting SHELL to bash allows bash commands to be executed by recipes.
# This is a requirement for 'setup-envtest.sh' in the test target.
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec
VERSION_PKG=github.com/alibaba/kubeskoop/version
TARGETOS?=linux
TARGETARCH?=amd64
TAG?=${shell git describe --tags --abbrev=7}
GIT_COMMIT=${shell git rev-parse HEAD}
ldflags="-X $(VERSION_PKG).Version=$(TAG) -X $(VERSION_PKG).Commit=${GIT_COMMIT} -w -s"
.PHONY: all
all: build-exporter build-skoop build-controller build-collector build-btfhack build-webconsole
.PHONY: fmt
fmt:
go fmt ./...
.PHONY: vet
vet: ## Run go vet against code.
go vet ./...
.PHONY: build-exporter
build-exporter:
CGO_ENABLED=0 go build -o bin/inspector -ldflags $(ldflags) ./cmd/exporter
.PHONY: build-skoop
build-skoop:
CGO_ENABLED=0 go build -o bin/skoop -ldflags $(ldflags) ./cmd/skoop
.PHONY: build-collector
build-collector:
CGO_ENABLED=0 go build -o bin/pod-collector -ldflags $(ldflags) ./cmd/collector
.PHONY: build-controller
build-controller:
go build -o bin/controller -ldflags $(ldflags) ./cmd/controller
.PHONY: build-btfhack
build-btfhack:
CGO_ENABLED=0 go build -o bin/btfhack -ldflags $(ldflags) ./cmd/btfhack
.PHONY: build-webconsole
build-webconsole:
cd webui && CGO_ENABLED=0 go build -o ../bin/webconsole -ldflags $(ldflags) .
.PHONY: generate-bpf
generate-bpf:
go generate ./pkg/exporter/probe/...
.PHONY: generate-bpf-in-container
generate-bpf-in-container:
docker run -v $(PWD):/go/src/github.com/alibaba/kubeskoop --workdir /go/src/github.com/alibaba/kubeskoop kubeskoop/bpf-build:go121-clang17 go generate ./pkg/exporter/probe/...