-
Notifications
You must be signed in to change notification settings - Fork 77
/
Makefile
172 lines (143 loc) · 3.74 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
165
166
167
168
169
170
171
###############################################################################
# common
###############################################################################
#ARCH: linux/pi/android/ios/
ARCH ?= linux
CROSS_PREFIX ?=
OUTPUT ?= /usr/local
BUILD_DIR := $(shell pwd)/../build/
ARCH_INC := $(BUILD_DIR)/$(ARCH).inc
COLOR_INC := $(BUILD_DIR)/color.inc
ifeq ($(ARCH_INC), $(wildcard $(ARCH_INC)))
include $(ARCH_INC)
endif
CC = $(CROSS_PREFIX)gcc
CXX = $(CROSS_PREFIX)g++
LD = $(CROSS_PREFIX)ld
AR = $(CROSS_PREFIX)ar
ifeq ($(COLOR_INC), $(wildcard $(COLOR_INC)))
include $(COLOR_INC)
else
CC_V = $(CC)
CXX_V = $(CXX)
LD_V = $(LD)
AR_V = $(AR)
CP_V = $(CP)
RM_V = $(RM)
endif
###############################################################################
# target and object
###############################################################################
TGT_NAME = aquila
###############################################################################
# cflags and ldflags
###############################################################################
CFLAGS_SDL = `pkg-config --cflags sdl`
LDFLAGS_SDL = `pkg-config --libs sdl`
LDFLAGS_X264 = -lx264
LDFLAGS_FDKAAC = -lfdk-aac
#LDFLAGS_ALSA = -lasound
LDFLAGS_FFMPEG = `pkg-config --libs libavformat libavutil libavcodec libswscale`
LDFLAGS_JPEG = -ljpeg
LDFLAGS_LUA = -llua5.2
CFLAGS := -g -Wall
# -Werror
# -fsanitize=address
CFLAGS += -I./
CFLAGS += -I./algo
CFLAGS += -I./codec
CFLAGS += -I./device
CFLAGS += -I./filter
CFLAGS += -I./muxer
CFLAGS += -I./playback
CFLAGS += -I./protocol
CFLAGS += -I./util
CFLAGS += -I/usr/local/include/gear-lib
CFLAGS += -Wl,-rpath=/usr/local/lib
CFLAGS += $(CFLAGS_SDL)
LDFLAGS :=
LDFLAGS += -lgcc_s -lc
LDFLAGS += -L$(OUTPUT)/lib
LDFLAGS += -L/usr/local/lib/gear-lib -lposix -ldebug -llog -lconfig -lgevent -lrtsp -ldict -lfile -lvector -lsock
LDFLAGS += -L/usr/local/lib/gear-lib -lthread -lrpc -ltime -lhash -lworkq -luvc -luac -lmedia-io -ldarray -lmp4
LDFLAGS += -L/usr/local/lib/gear-lib -lrtmpc
LDFLAGS += -lqueue
LDFLAGS += -lpthread -lrt
# -lasan
LDFLAGS += $(LDFLAGS_SDL)
LDFLAGS += $(LDFLAGS_X264)
LDFLAGS += $(LDFLAGS_FDKAAC)
LDFLAGS += $(LDFLAGS_ALSA)
LDFLAGS += $(LDFLAGS_FFMPEG)
LDFLAGS += $(LDFLAGS_JPEG)
LDFLAGS += $(LDFLAGS_LUA)
.PHONY : all clean
TGT := $(TGT_NAME)
ALGO_OBJS :=
CODEC_OBJS := \
codec/codec.o \
codec/x264_enc.o \
codec/aac_enc.o \
codec/mjpeg_enc.o \
codec/h264_dec.o
#codec/h264_enc.o \
DEVICE_OBJS := \
device/device.o \
device/usbcam.o \
device/microphone.o \
device/vdevfake.o
FILTER_OBJS := \
filter/filter.o \
filter/videocap_filter.o \
filter/videoenc_filter.o \
filter/videodec_filter.o \
filter/upstream_filter.o \
filter/record_filter.o \
filter/playback_filter.o \
filter/remotectrl_filter.o
MUXER_OBJS := \
muxer/muxer.o \
muxer/flv.o \
muxer/mp4.o
PLAYBACK_OBJS := \
playback/playback.o \
playback/sdl.o \
playback/snkfake.o
PROTOCOL_OBJS := \
protocol/protocol.o \
protocol/rtmp.o \
protocol/rtsp.o \
protocol/rtp.o \
protocol/rtp_h264.o \
protocol/rpcd.o
UTIL_OBJS := \
util/url.o \
util/config.o \
util/imgconvert.o \
util/overlay.o
OBJS := \
$(ALGO_OBJS) \
$(CODEC_OBJS) \
$(DEVICE_OBJS) \
$(FILTER_OBJS) \
$(MUXER_OBJS) \
$(PLAYBACK_OBJS) \
$(PROTOCOL_OBJS) \
$(UTIL_OBJS) \
main.o
all: $(TGT)
%.o:%.c
$(CC_V) -c $(CFLAGS) $< -o $@
%.o:%.cc
$(CXX_V) -c $(CFLAGS) $< -o $@
%.o:%.cpp
$(CXX_V) -c $(CFLAGS) $< -o $@
$(TGT_NAME): $(OBJS)
$(CC_V) -o $@ $^ $(LDFLAGS)
clean:
$(RM_V) -f $(OBJS)
$(RM_V) -f $(TGT)
install:
$(CP_V) -f $(TGT_NAME) ${OUTPUT}/bin
uninstall:
$(RM_V) -f ${OUTPUT}/bin/$(TGT_NAME)