forked from SeeFlowerX/stackplz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (58 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
CMD_CLANG ?= clang
CMD_GO ?= go
CMD_RM ?= rm
DEBUG_PRINT ?=
ifeq ($(DEBUG),1)
DEBUG_PRINT := -DDEBUG_PRINT
endif
.PHONY: all
all: ebpf assets build
@echo $(shell date)
.PHONY: clean
clean:
$(CMD_RM) -f user/bytecode/*.d
$(CMD_RM) -f user/bytecode/*.o
$(CMD_RM) -f assets/ebpf_probe.go
$(CMD_RM) -f bin/stackplz
.PHONY: ebpf
ebpf:
clang \
--target=bpf \
-c \
-nostdlibinc \
-no-canonical-prefixes \
-O2 \
$(DEBUG_PRINT) \
-isystem external/bionic/libc/include \
-isystem external/bionic/libc/kernel/uapi \
-isystem external/bionic/libc/kernel/uapi/asm-arm64 \
-isystem external/bionic/libc/kernel/android/uapi \
-I external/system/core/libcutils/include \
-I external/libbpf/src \
-g \
-MD -MF user/bytecode/stack.d \
-o user/bytecode/stack.o \
src/stack.c
clang \
--target=bpf \
-c \
-nostdlibinc \
-no-canonical-prefixes \
-O2 \
$(DEBUG_PRINT) \
-isystem external/bionic/libc/include \
-isystem external/bionic/libc/kernel/uapi \
-isystem external/bionic/libc/kernel/uapi/asm-arm64 \
-isystem external/bionic/libc/kernel/android/uapi \
-I external/system/core/libcutils/include \
-I external/libbpf/src \
-g \
-MD -MF user/bytecode/raw_syscalls.d \
-o user/bytecode/raw_syscalls.o \
src/raw_syscalls.c
.PHONY: assets
assets:
$(CMD_GO) run github.com/shuLhan/go-bindata/cmd/go-bindata -pkg assets -o "assets/ebpf_probe.go" $(wildcard ./user/bytecode/*.o ./preload_libs/*.so)
.PHONY: build
build:
GOARCH=arm64 GOOS=android CGO_ENABLED=1 CC=aarch64-linux-android29-clang $(CMD_GO) build -ldflags "-w -s" -o bin/stackplz .