huangcm
2025-09-01 53d8e046ac1bf2ebe94f671983e3d3be059df91a
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
 
# define sources root directory before everything
SRC_ROOT := ../..
 
# change compiler and linker option before you include rule.mk
#
# link to libscript.a when you need to fetch configuration
# from test_script
#
#CFLAGS := $(CFLAGS) -g
CFLAGS = -I. -Ilib -Wall -DVERSION=\"5.10\" -Wno-strict-aliasing
LDFLAGS := -lscript -lrt
CFLAGS  += -Ilib/bluetooth
 
# include rule.mk
include $(SRC_ROOT)/rule.mk
 
# define objects collection variable
lib = \
   lib/bluetooth.o \
   lib/hci.o \
   lib/sdp.o
 
hciattach_objs = \
   hciattach.o \
   hciattach_ath3k.o \
   hciattach_bcm43xx.o \
   hciattach_intel.o \
   hciattach_qualcomm.o \
   hciattach_st.o \
   hciattach_ti.o \
   hciattach_tialt.o \
   hciattach_rtk.o \
   hciattach_xr.o \
   hciattach_aic.o \
   hciattach_sprd.o
 
hciconfig_objs = \
   hciconfig.o \
   csr.o
 
hcitool_objs = \
   hcitool.o
 
btmon_objs = \
   monitor/main.o \
   monitor/mainloop.o \
   monitor/display.o \
   monitor/hcidump.o \
   monitor/btsnoop.o \
   monitor/control.o \
   monitor/packet.o \
   monitor/vendor.o \
   monitor/lmp.o \
   monitor/l2cap.o \
   monitor/uuid.o \
   monitor/sdp.o \
   monitor/crc.o \
   monitor/ll.o
 
# add your target(s) to all
.PHONY: all
all: hciattach hciconfig hcitool btmon
 
# define you target, the target will be output to dragonboard/output/bin
# directory
hciattach: $(hciattach_objs) $(lib)
   $(LINK_MSG)
   $(LINKX)
 
hciconfig: $(hciconfig_objs) $(lib)
   $(LINK_MSG)
   $(LINKX)
 
hcitool: $(hcitool_objs) $(lib)
   $(LINK_MSG)
   $(LINKX)
 
btmon: $(btmon_objs) $(lib)
   $(LINK_MSG)
   $(LINKX)
 
# change objs to your objects collection variable
$(hciattach_objs): %.o: %.c
   $(COMPILE_MSG)
   $(COMPILEX)
 
$(hciconfig_objs): %.o: %.c
   $(COMPILE_MSG)
   $(COMPILEX)
 
$(hcitool_objs): %.o: %.c
   $(COMPILE_MSG)
   $(COMPILEX)
 
$(btmon_objs): %.o: %.c
   $(COMPILE_MSG)
   $(COMPILEX)
 
 
# clean temp files
clean:
   -rm -rf $(hciattach_objs) $(hciattach_objs:.o=.d)
   -rm -rf $(hciconfig_objs) $(hciconfig_objs:.o=.d)
   -rm -rf $(hcitool_objs) $(hcitool_objs:.o=.d)
   -rm -rf $(lib) $(lib:.o=.d)
   -rm -rf $(btmon_objs) $(btmon_objs:.o=.d)