summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2024-02-19 11:53:13 +0200
committerPaul Buetow <paul@buetow.org>2024-02-19 11:53:13 +0200
commit4309271756784e9e4846a385c477ea31f183dc3b (patch)
treec302159be3c7322a59bcbf08c5fe9b5b423721b0 /Makefile
parent728b11eb64db53d8f71faa86ed5043efbaa8d589 (diff)
make ioriotng able to run without .c source files present
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile13
1 files changed, 12 insertions, 1 deletions
diff --git a/Makefile b/Makefile
index 19460a8..8dc859e 100644
--- a/Makefile
+++ b/Makefile
@@ -14,8 +14,19 @@ bpfbuild:
make -C ./internal/c redo
if [ ! -e ioriotng.bpf.o ]; then cp -v ./internal/c/ioriotng.bpf.o .; fi
+.PHONY: tracepoint_list.go
+tracepoint_list.go:
+ # Fetch tracepoint probes from C code and generate list for Go userland code to auto-attach to.
+ echo "// Auto-generated from C, don't change manually!" > ./internal/tracepoints/tracepoint_list.go
+ echo 'package tracepoints' >> ./internal/tracepoints/tracepoint_list.go
+ echo >> ./internal/tracepoints/tracepoint_list.go
+ echo 'var tracepointList = []string{' >> ./internal/tracepoints/tracepoint_list.go
+ sed -n -E '/^SEC.*sys_(enter|exit)_/ { s/[")]//g; s/.*sys_(.*)/\t"\1",/; p; }' \
+ ./internal/c/tracepoints/*.c >> ./internal/tracepoints/tracepoint_list.go
+ echo '}' >> ./internal/tracepoints/tracepoint_list.go
+
.PHONY: gobuild
-gobuild:
+gobuild: tracepoint_list.go
go build -tags netgo -ldflags '-w -extldflags "-static"' -o ioriotng ./cmd/ioriotng/main.go
.PHONY: clean