-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (63 loc) · 1.53 KB
/
Makefile
File metadata and controls
76 lines (63 loc) · 1.53 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd
#
# SPDX-License-Identifier: LGPL-2.1
BUILD_DIR = build
TARGETs = bpf observe filter so tools demo
BPF_TARGET_ARCH := $(shell uname -m)
ifeq ($(BPF_TARGET_ARCH), loongarch64)
BPF_TARGET_ARCH := loongarch
endif
ifneq ($(BPF_TARGET_ARCH), loongarch)
TARGETs += policy
endif
SUBTARGETs = $(foreach i,$(TARGETs),$(i)/%)
MAKE = make PROJ_ROOT=$(shell pwd)
.PHONY: all clean distclean pseudo $(TARGETs)
.SUFFIXES:
USE_SUBMODULE ?= 1
all: $(TARGETs)
demo test: so
bpf: $(if $(filter 1,$(USE_SUBMODULE)),bpf.gitsubmodule)
observe filter policy so: bpf
$(TARGETs):
$(MAKE) -C $@
$(SUBTARGETs): pseudo
$(MAKE) $* -C $(shell dirname $@)
test: pseudo
# 如果网络有问题,请参考.gitmodules文件,手动拉取子仓库放到对应目录
git submodule update --init --depth 1 googletest
$(MAKE) -C $@
pseudo:
%.gitsubmodule:
git submodule update --init $*
clean:
@for i in $(TARGETs); do $(MAKE) -C $$i clean; done
distclean:
@for i in $(TARGETs); do $(MAKE) -C $$i distclean; done
rm -rf $(BUILD_DIR)
help:
# 编译完整项目:
# make 或者 make all
#
# 清理完整项目:
# make clean
#
# 编译指定子模块:
# make dir
# 例如 make test 或 make observe
#
# 编译模块的指定目标:
# make dir/target
# 例如 make observe/bio-stat
# make observe/clean
#
# 清理指定子模块:
# make dir/clean
# 或
# make clean -C dir
# 例如 make observe/clean
#
# 编译测试用例并运行
# make test
# 或者
# make -C test