forked from open-telemetry/opentelemetry-ebpf-profiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
72 lines (56 loc) · 1.98 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
70
71
72
.PHONY: all all-common binary clean ebpf generate test test-deps protobuf docker-image agent legal
SHELL:=/usr/bin/env bash
all: generate ebpf binary
# Removes the go build cache and binaries in the current project
clean:
go clean -cache -i
$(MAKE) -C support/ebpf clean
rm -f build-targets/*.{deb,rpm}
rm -f support/*.test
generate: protobuf
go install github.com/florianl/bluebox@v0.0.1
go generate ./...
binary:
go build -buildvcs=false -ldflags="-extldflags=-static" -tags osusergo,netgo
ebpf:
$(MAKE) -j$(shell nproc) -C support/ebpf
lint: generate
# We don't want to build the tracers here, so we stub them for linting
touch support/ebpf/tracer.ebpf.x86
golangci-lint run --timeout 10m
test: generate ebpf test-deps
go test ./...
TESTDATA_DIRS:= \
libpf/nativeunwind/elfunwindinfo/testdata \
libpf/pfelf/testdata \
reporter/testdata
test-deps:
$(foreach testdata_dir, $(TESTDATA_DIRS), \
($(MAKE) -C "$(testdata_dir)") || exit ; \
)
protobuf:
cd proto && ./buildpb.sh
# Detect native architecture.
UNAME_NATIVE_ARCH:=$(shell uname -m)
ifeq ($(UNAME_NATIVE_ARCH),x86_64)
NATIVE_ARCH:=amd64
else ifeq ($(UNAME_NATIVE_ARCH),aarch64)
NATIVE_ARCH:=arm64
else
$(error Unsupported architecture: $(UNAME_NATIVE_ARCH))
endif
docker-image:
docker build -t profiling-agent --build-arg arch=$(NATIVE_ARCH) -f Dockerfile .
agent:
docker run -v "$$PWD":/agent -it profiling-agent make
legal:
@go install go.elastic.co/go-licence-detector@latest
@go list -m -json $(sort $(shell go list -deps -tags=linux -f "{{with .Module}}{{if not .Main}}{{.Path}}{{end}}{{end}}" .)) | go-licence-detector \
-includeIndirect \
-rules legal/rules.json \
-depsTemplate=legal/templates/deps.csv.tmpl \
-depsOut=deps.profiling-agent.csv
@./legal/append-non-go-info.sh legal/non-go-dependencies.json deps.profiling-agent.csv
@echo "Dependencies license summary (from deps.profiling-agent.csv):"
@echo " Count License"
@tail -n '+2' deps.profiling-agent.csv | cut -d',' -f5 | sort | uniq -c | sort -k1rn