-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
165 lines (126 loc) · 4.61 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
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
CFLAGS:=$(CFLAGS)
CFLAGS+=-std=gnu++1y
CFLAGS+=-Wall
CFLAGS+=-Wextra
CFLAGS+=-fvisibility=hidden
CFLAGS+=-W
CFLAGS+=-Wno-unused-parameter
CFLAGS+=-Wno-unused-function
CFLAGS+=-Wno-unused-label
CFLAGS+=-Wno-write-strings
CFLAGS+=-D__STDC_CONSTANT_MACROS
BIN?=bin
SRC=src
# default to debug mode
DEBUG?=1
ifeq ($(DEBUG), 1)
CFLAGS += -Werror -Wno-deprecated-declarations
CFLAGS += -g3
LDFLAGS += -g
else
CFLAGS += -s -O3 -DNDEBUG -Wno-unused-variable -Wno-deprecated-declarations
LDFLAGS += -s
endif
CFLAGS += -I$(SRC) -I$(SRC)/lib_modules
CFLAGS += -I./extra/include
LDFLAGS += -L./extra/lib
LDFLAGS += $(LDLIBS)
all: targets
$(BIN)/config.mk:
@echo "Configuring ..."
@set -e ; \
mkdir -p $(BIN)
export PKG_CONFIG_PATH=./extra/lib/pkgconfig:$$PKG_CONFIG_PATH ; \
/bin/echo '# config file' > $(BIN)/config.mk.tmp ; \
/bin/echo -n 'CFLAGS+=' >> $(BIN)/config.mk.tmp ; \
pkg-config --cflags libavcodec libavdevice libavformat libswresample libswscale x264 sdl2 >> $(BIN)/config.mk.tmp ; \
/bin/echo -n 'LDFLAGS+=' >> $(BIN)/config.mk.tmp ; \
pkg-config --libs sdl2 >> $(BIN)/config.mk.tmp ; \
/bin/echo -n 'LDFLAGS+=' >> $(BIN)/config.mk.tmp ; \
pkg-config --libs --static libavcodec libavdevice libavformat libswresample libswscale x264 gpac >> $(BIN)/config.mk.tmp ; \
sed -i "s/-lgpac/-lgpac_static/" $(BIN)/config.mk.tmp ; \
/bin/echo 'CFLAGS+=-I./extra/include/asio -Wno-unused-local-typedefs' >> $(BIN)/config.mk.tmp
/bin/echo 'LDFLAGS+=-lturbojpeg' >> $(BIN)/config.mk.tmp ; \
mv $(BIN)/config.mk.tmp $(BIN)/config.mk ; \
include $(BIN)/config.mk
CFLAGS+=-Umain
TARGETS:=
DEPS:=
#------------------------------------------------------------------------------
ProjectName:=$(SRC)/lib_utils
UTILS_SRCS:=\
$(ProjectName)/log.cpp\
UTILS_OBJS:=$(UTILS_SRCS:%.cpp=$(BIN)/%.o)
#------------------------------------------------------------------------------
ProjectName:=$(SRC)/lib_media
MEDIA_SRCS:=\
$(ProjectName)/common/libav.cpp\
$(ProjectName)/common/picture.cpp\
$(ProjectName)/decode/jpegturbo_decode.cpp\
$(ProjectName)/decode/libav_decode.cpp\
$(ProjectName)/demux/gpac_demux_mp4_simple.cpp\
$(ProjectName)/demux/gpac_demux_mp4_full.cpp\
$(ProjectName)/demux/libav_demux.cpp\
$(ProjectName)/encode/jpegturbo_encode.cpp\
$(ProjectName)/encode/libav_encode.cpp\
$(ProjectName)/in/file.cpp\
$(ProjectName)/in/sound_generator.cpp\
$(ProjectName)/in/video_generator.cpp\
$(ProjectName)/mux/gpac_mux_m2ts.cpp\
$(ProjectName)/mux/gpac_mux_mp4.cpp\
$(ProjectName)/mux/libav_mux.cpp\
$(ProjectName)/out/file.cpp\
$(ProjectName)/out/null.cpp\
$(ProjectName)/out/print.cpp\
$(ProjectName)/render/sdl_audio.cpp\
$(ProjectName)/render/sdl_common.cpp\
$(ProjectName)/render/sdl_video.cpp\
$(ProjectName)/stream/apple_hls.cpp\
$(ProjectName)/stream/mpeg_dash.cpp\
$(ProjectName)/transform/audio_convert.cpp\
$(ProjectName)/transform/restamp.cpp\
$(ProjectName)/transform/video_convert.cpp\
$(ProjectName)/utils/comparator.cpp\
$(ProjectName)/utils/recorder.cpp\
LIB_MEDIA_OBJS:=$(MEDIA_SRCS:%.cpp=$(BIN)/%.o)
DEPS+=$(LIB_MEDIA_OBJS:%.o=%.deps)
#------------------------------------------------------------------------------
ProjectName:=$(SRC)/lib_modules
MODULES_SRCS:=\
$(ProjectName)/core/system_clock.cpp\
$(ProjectName)/utils/pipeline.cpp\
$(ProjectName)/utils/stranded_pool_executor.cpp\
LIB_MODULES_OBJS:=$(MODULES_SRCS:%.cpp=$(BIN)/%.o)
DEPS+=$(LIB_MODULES_OBJS:%.o=%.deps)
#------------------------------------------------------------------------------
ProjectName:=$(SRC)/tests
include $(ProjectName)/project.mk
CFLAGS+=-I$(ProjectName)
#------------------------------------------------------------------------------
ProjectName:=$(SRC)/apps/player
include $(ProjectName)/project.mk
CFLAGS+=-I$(ProjectName)
#------------------------------------------------------------------------------
ProjectName:=$(SRC)/apps/dashcastx
include $(ProjectName)/project.mk
CFLAGS+=-I$(ProjectName)
#------------------------------------------------------------------------------
ProjectName:=$(SRC)/apps/mp42tsx
include $(ProjectName)/project.mk
CFLAGS+=-I$(ProjectName)
#------------------------------------------------------------------------------
targets: $(TARGETS)
unit: $(TARGETS)
#------------------------------------------------------------------------------
$(BIN)/%.exe:
@mkdir -p $(dir $@)
$(CXX) -o "$@" $^ $(LDFLAGS)
$(BIN)/%.o: %.cpp
@mkdir -p $(dir $@)
$(CXX) "$<" -c $(CFLAGS) -o "$(BIN)/$*.deps" -MM -MT "$(BIN)/$*.o"
$(CXX) "$<" -c $(CFLAGS) -o "$@"
clean:
rm -rf $(BIN)
mkdir $(BIN)
#-------------------------------------------------------------------------------
-include $(DEPS)