forked from dexgs/livestreaming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
67 lines (52 loc) · 1.39 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
THIRDPARTY_DIR = ./thirdparty
SRT_DIR = $(THIRDPARTY_DIR)/srt
PICOHTTP_DIR = $(THIRDPARTY_DIR)/picohttpparser
INCLUDE_SRT_HEADERS = -I$(SRT_DIR)/srtcore/ -I$(SRT_DIR)/_build
INCLUDE_PICOHTTP_HEADERS = -I$(PICOHTTP_DIR)
SRT_STATIC = $(SRT_DIR)/_build/libsrt.a
CFLAGS += -Wall -Wextra
CFLAGS += $(INCLUDE_SRT_HEADERS)
CFLAGS += $(INCLUDE_PICOHTTP_HEADERS)
LDFLAGS += $(SRT_STATIC) -lpthread -lcrypto
.DEFAULT_GOAL := ShaRT
all: srt ShaRT
src = $(wildcard src/*.c) \
thirdparty/picohttpparser/picohttpparser.c
obj = $(src:%.c=obj/%.o)
obj/%.o: %.c
@mkdir -p "$(@D)"
$(CC) -c $(CFLAGS) $< -o $@
bin/ShaRT: $(obj)
@mkdir -p bin
$(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS)
.PHONY: ShaRT
ShaRT: bin/ShaRT
bin/test: $(filter-out obj/src/main.o, $(obj)) obj/test/test.o
@mkdir -p bin
$(CXX) $(CFLAGS) -o $@ $^ $(LDFLAGS)
.PHONY: test
test: bin/test
SRT_CMAKE_ARGS = \
-DENABLE_STATIC:bool=1 -DENABLE_SHARED:bool=0 -DENABLE_LOGGING:bool=0 \
-DENABLE_APPS:bool=0 -DCMAKE_BUILD_TYPE=Release
.PHONY: srt
srt:
cd $(THIRDPARTY_DIR)/$@; \
mkdir -p _build; \
cd _build; \
cmake ../ $(SRT_CMAKE_ARGS); \
cmake --build ./;
.PHONY: clean
clean:
rm -rf $(obj) bin
rm -rf $(THIRDPARTY_DIR)/srt/_build
ifeq ($(PREFIX),)
PREFIX := /usr
endif
.PHONY: install
install: bin/ShaRT
install -d $(DESTDIR)$(PREFIX)/bin
cp $< $(DESTDIR)$(PREFIX)/bin/ShaRT
.PHONY: uninstall
uninstall:
rm -f $(DESTDIR)$(PREFIX)/bin/ShaRT