-
Notifications
You must be signed in to change notification settings - Fork 224
/
Makefile
82 lines (63 loc) · 3.25 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
.PHONY: help default clean bench pcap test all
default: bench test
clean:
rm -rf ./objs
all: bench test pcap test
#########################################################################################################
# SRS benchmark tool for SRS, janus, GB28181.
./objs/.format.bench.txt: *.go janus/*.go ./objs/.format.srs.txt ./objs/.format.gb28181.txt
gofmt -w *.go janus
mkdir -p objs && echo "done" > ./objs/.format.bench.txt
bench: ./objs/srs_bench
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
SRT_PREFIX := $(shell brew --prefix srt)
CGO_CFLAGS := -I$(SRT_PREFIX)/include
CGO_LDFLAGS := -L$(SRT_PREFIX)/lib -lsrt
else ifeq ($(UNAME_S),Linux)
CGO_CFLAGS := -I/usr/local/include
CGO_LDFLAGS := -L/usr/local/lib -lsrt -L/usr/local/ssl/lib -lcrypto -lstdc++ -lm -ldl
endif
./objs/srs_bench: ./objs/.format.bench.txt *.go janus/*.go srs/*.go vnet/*.go gb28181/*.go live/*.go Makefile
CGO_CFLAGS="$(CGO_CFLAGS)" CGO_LDFLAGS="$(CGO_LDFLAGS)" go build -mod=vendor -o objs/srs_bench .
#########################################################################################################
# For all regression tests.
test: ./objs/srs_test ./objs/srs_gb28181_test ./objs/srs_blackbox_test
#########################################################################################################
# For SRS regression test.
./objs/.format.srs.txt: srs/*.go vnet/*.go
gofmt -w srs vnet
mkdir -p objs && echo "done" > ./objs/.format.srs.txt
./objs/srs_test: ./objs/.format.srs.txt *.go srs/*.go vnet/*.go Makefile
go test ./srs -mod=vendor -c -o ./objs/srs_test
#########################################################################################################
# For pcap simulator test.
./objs/.format.pcap.txt: pcap/*.go
gofmt -w pcap
mkdir -p objs && echo "done" > ./objs/.format.pcap.txt
pcap: ./objs/pcap_simulator
./objs/pcap_simulator: ./objs/.format.pcap.txt pcap/*.go Makefile
go build -mod=vendor -o ./objs/pcap_simulator ./pcap
#########################################################################################################
# For gb28181 test.
./objs/.format.gb28181.txt: gb28181/*.go
gofmt -w gb28181
mkdir -p objs && echo "done" > ./objs/.format.gb28181.txt
./objs/srs_gb28181_test: ./objs/.format.gb28181.txt *.go gb28181/*.go Makefile
go test ./gb28181 -mod=vendor -c -o ./objs/srs_gb28181_test
#########################################################################################################
# For blackbox test.
./objs/.format.blackbox.txt: blackbox/*.go
gofmt -w blackbox
mkdir -p objs && echo "done" > ./objs/.format.blackbox.txt
./objs/srs_blackbox_test: ./objs/.format.blackbox.txt *.go blackbox/*.go Makefile
go test ./blackbox -mod=vendor -c -o ./objs/srs_blackbox_test
#########################################################################################################
# Help menu.
help:
@echo "Usage: make [default|bench|pcap|test|clean]"
@echo " default The default entry for make is bench+test"
@echo " bench Make the bench to ./objs/srs_bench"
@echo " pcap Make the pcap simulator to ./objs/pcap_simulator"
@echo " test Make the test tool to ./objs/srs_test and ./objs/srs_gb28181_test ./objs/srs_blackbox_test"
@echo " clean Remove all tools at ./objs"