-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathMakefile
More file actions
172 lines (144 loc) · 5.45 KB
/
Makefile
File metadata and controls
172 lines (144 loc) · 5.45 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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
include make.config
DEFINES += "-DMAX_FLOW_COUNT=$(MAX_FLOW_COUNT)"
DEFINES += "-DINTERVAL_COUNT=$(INTERVAL_COUNT)"
export DEFINES
SUBDIRS = deps/toptalk messages server cli-client html5-client docs
CLEANDIRS = $(SUBDIRS:%=clean-%)
TESTDIRS = $(SUBDIRS:%=test-%)
.PHONY: all $(SUBDIRS) help config
all: $(SUBDIRS)
@echo "Done."
help:
@echo "JitterTrap Build System"
@echo "======================="
@echo ""
@echo "Targets:"
@echo " all Build everything (default)"
@echo " clean Remove build artifacts"
@echo " install Install to DESTDIR (default: /)"
@echo " test Run all tests"
@echo " config Show current build configuration"
@echo " help Show this help message"
@echo " deps-libdatachannel Build bundled libdatachannel (for WebRTC)"
@echo ""
@echo "Analysis targets:"
@echo " cppcheck Run cppcheck static analysis"
@echo " clang-analyze Run clang static analyzer"
@echo " coverity-build Create Coverity analysis archive"
@echo " coverage Generate code coverage report"
@echo ""
@echo "Configuration:"
@echo " Override settings on command line or edit make.config"
@echo " Example: make SAMPLE_PERIOD_US=500 WEB_SERVER_PORT=8080"
@echo ""
@echo " Run 'make config' to see current settings"
config:
@echo "Current Build Configuration"
@echo "==========================="
@echo ""
@echo "Branding:"
@echo " PRODUCT_BRANDING = $(PRODUCT_BRANDING)"
@echo ""
@echo "Network Capture:"
@echo " SAMPLE_PERIOD_US = $(SAMPLE_PERIOD_US) (sampling interval in microseconds)"
@echo " ALLOWED_IFACES = $(ALLOWED_IFACES) (empty = all interfaces)"
@echo " MAX_IFACE_LEN = $(MAX_IFACE_LEN)"
@echo ""
@echo "Web Server:"
@echo " WEB_SERVER_PORT = $(WEB_SERVER_PORT)"
@echo " WEB_SERVER_DOCUMENT_ROOT= $(WEB_SERVER_DOCUMENT_ROOT)"
@echo ""
@echo "Performance:"
@echo " RT_CPU = $(RT_CPU) (CPU core for sampling thread)"
@echo " RT_CPU_TOPTALK = $(RT_CPU_TOPTALK) (CPU core for packet capture threads)"
@echo " INTERVAL_COUNT = $(INTERVAL_COUNT) (time intervals to track)"
@echo " MAX_FLOW_COUNT = $(MAX_FLOW_COUNT) (max concurrent flows)"
@echo ""
@echo "Feature Flags:"
@echo " DISABLE_IMPAIRMENTS = $(DISABLE_IMPAIRMENTS) (set to 1 to disable)"
@echo " DISABLE_PCAP = $(DISABLE_PCAP) (set to 1 to disable)"
@echo " ENABLE_WEBRTC_PLAYBACK = $(ENABLE_WEBRTC_PLAYBACK) (set to 1 to enable, requires libdatachannel)"
$(SUBDIRS):
@echo "Making $@"
@$(MAKE) --silent -C $@
# Build bundled libdatachannel for WebRTC support
# This is needed because Ubuntu 22.04 doesn't have libdatachannel,
# and Fedora's version has bugs affecting H.265 playback.
.PHONY: deps-libdatachannel
deps-libdatachannel:
@if [ ! -f deps/libdatachannel/install/lib64/libdatachannel.so ]; then \
echo "Building bundled libdatachannel..."; \
cd deps/libdatachannel && \
git submodule update --init --recursive --depth 1 && \
mkdir -p build && cd build && \
cmake .. -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=../install \
-DNO_WEBSOCKET=ON -DNO_EXAMPLES=ON -DNO_TESTS=ON && \
$(MAKE) -j$$(nproc) && $(MAKE) install; \
else \
echo "libdatachannel already built"; \
fi
# Server depends on libdatachannel when WebRTC is enabled
ifeq ($(ENABLE_WEBRTC_PLAYBACK), 1)
server: | messages deps/toptalk deps-libdatachannel
else
server: | messages deps/toptalk
endif
cli-client: | messages
update-cbuffer:
git subtree split --prefix deps/cbuffer --annotate='split ' --rejoin
git subtree pull --prefix deps/cbuffer https://github.com/acooks/cbuffer.git master --squash
update-toptalk:
git subtree split --prefix deps/toptalk --annotate='split ' --rejoin
git subtree pull --prefix deps/toptalk https://github.com/acooks/toptalk.git master --squash
# Remember to add the coverity bin directory to your PATH
coverity-build: $(CLEANDIRS)
cov-build --dir cov-int make messages server cli-client
@tar caf jittertrap-coverity-build.lzma cov-int
@echo Coverity build archive: jittertrap-coverity-build.lzma
coverity-clean:
rm -rf cov-int jittertrap-coverity-build.lzma
cppcheck:
cppcheck --enable=style,warning,performance,portability messages/ server/ cli-client/
clang-analyze:
scan-build $(MAKE) messages server cli-client
coverage:
CFLAGS="-fprofile-arcs -ftest-coverage" $(MAKE) clean test
lcov -c --no-external -d server -d cli-client -d messages -o jittertrap.lcov
.PHONY: clean $(CLEANDIRS)
clean: $(CLEANDIRS)
$(CLEANDIRS):
@echo "Cleaning $@"
@$(MAKE) --silent -C $(@:clean-%=%) clean
install: all
install -d ${DESTDIR}/usr/bin/
install -m 0755 server/jt-server ${DESTDIR}/usr/bin/
$(MAKE) -C html5-client install
test: $(TESTDIRS)
$(TESTDIRS):
@echo "Test $@"
@$(MAKE) --silent -C $(@:test-%=%) test
# AddressSanitizer testing
.PHONY: test-asan
test-asan:
@echo "Running AddressSanitizer tests..."
@$(MAKE) -C server test-asan
@echo "All ASan tests passed!"
.PHONY: test-video-asan
test-video-asan:
@echo "Running video AddressSanitizer tests..."
@$(MAKE) -C server test-video-asan
@echo "All video ASan tests passed!"
# Fuzzing targets
.PHONY: fuzz-build
fuzz-build:
@echo "Building fuzz harnesses..."
@$(MAKE) -C server/fuzz
.PHONY: fuzz
fuzz: fuzz-build
@echo "Running fuzzer (press Ctrl+C to stop)..."
@$(MAKE) -C server/fuzz run-fuzz-rtp
.PHONY: fuzz-quick
fuzz-quick: fuzz-build
@echo "Running 60-second fuzz session..."
@$(MAKE) -C server/fuzz fuzz-quick