-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
58 lines (44 loc) · 1.66 KB
/
Makefile
File metadata and controls
58 lines (44 loc) · 1.66 KB
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
# Written to build LeMon for use on Linux-based systems.
#
# To obtain a list of targets and what each one builds, you can enter 'make list'.
#
# WARNING: the libbpf library on your system MUST be >= v1.5.0. If your package maintainer
# does not offer this version, the install script will attempt to install it for you, but you should
# look at their instructions on how to build and install it from source if in doubt.
# Last updated: 11/5/25
vpath %.c src
vpath %.h include
vpath %.o object_files
CC = clang
CFLAGS = -O3 -o LeMon -I include
LDFLAGS = -L/usr/lib -lbpf
all: clean LeMon docs
.PHONY: list
list:
@echo "LIST OF POSSIBLE MAKE TARGETS:\ninstall - installs all dependencies needed to run LeMon.\nLeMon - builds LeMon's user and kernel space components.\ndocs - builds LeMon's documentation using doxygen.\nclean - removes all built binaries, objects and documentation."
.PHONY: install
install:
@chmod +x install
@./install
.PHONY: docs
docs:
@if [ -d "docs" ]; then rm -rf docs; fi
@doxygen
@cp -r assets docs/html
.PHONY: clean
clean:
@if [ -d "object_files" ]; then rm -rf object_files; fi
@if [ -d "docs" ]; then rm -rf docs; fi
@if [ -f "LeMon" ]; then rm LeMon; fi
CPPFLAGS = --target=aarch64-linux-gnu -O2 -I include -L/usr/lib -lbpf
LeMon: LeMon.c eBPFInKernelAndUserspace.h LeMon_Wired.o LeMon_Wireless.o
$(CC) $(CPPFLAGS) $< -o $@
@chmod u+x LeMon
CFLAGS = -D__TARGET_ARCH_arm64 -target bpf -Wall -O2 -c -g -I include
LeMon_Wired.o: LeMon_Wired.bpf.c
if [ ! -d "object_files" ]; then mkdir object_files; fi
$(CC) -c $(CFLAGS) $^ -o $@
mv $@ object_files
LeMon_Wireless.o: LeMon_Wireless.bpf.c
$(CC) -c $(CFLAGS) $^ -o $@
mv $@ object_files