diff options
| author | Paul Buetow <paul@buetow.org> | 2024-02-11 23:18:26 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2024-02-11 23:18:26 +0200 |
| commit | 3e988cebf28b1c03d8be4aac0cad7fd2a59701ff (patch) | |
| tree | 7135d7d703cd953dd988fb33eedff6a41c0a80d3 /Makefile | |
| parent | 38a1666d39d834a2d2bd69662291afd9a63b2fd6 (diff) | |
move all to makefiles
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 22 |
1 files changed, 20 insertions, 2 deletions
@@ -1,9 +1,27 @@ +export LIBBPFGO = $(CURDIR)/../libbpfgo +export CC = clang +export GOOS = linux +export GOARCH = amd64 +export CGO_CFLAGS = -I$(LIBBPFGO)/output -I$(LIBBPFGO)/selftest/common +export CGO_LDFLAGS = -lelf -lzstd $(LIBBPFGO)/output/libbpf.a + all: build run -build: - ./build.sh + +build: bpfbuild gobuild + +bpfbuild: + bpftool btf dump file /sys/kernel/btf/vmlinux format c > vmlinux.h + $(CC) -g -O2 -Wall -fpie -I$(LIBBPFGO)/selftest/common -target bpf -D__TARGET_ARCH_amd64 -I$(LIBBPFGO)/output -I$(LIBBPFGO)/selftest/common -c ioriotng.bpf.c -o ioriotng.bpf.o + +gobuild: + echo 'package main' > internal/opids.go + echo >> internal/opids.go + sed -E 's/#define (.*) ([0-9]+)/const \1 = \2/' opids.h >> internal/opids.go + go build -race -tags netgo -ldflags '-w -extldflags "-static"' -o ioriotng ./cmd/ioriotng/main.go clean: find . -type f -name ioriotng -delete find . -name \*.o -delete find . -name vmlinux.h -delete + run: sudo ./ioriotng |
