forked from cskiraly/Streamers
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
243 lines (205 loc) · 5.05 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
include utils.mak
include config.mak
#save external LDLIBS
LDLIBS_IN := $(LDLIBS)
CFLAGS = -g -Wall
CFLAGS += $(call cc-option, -Wdeclaration-after-statement)
CFLAGS += $(call cc-option, -Wno-switch)
CFLAGS += $(call cc-option, -Wdisabled-optimization)
CFLAGS += $(call cc-option, -Wpointer-arith)
CFLAGS += $(call cc-option, -Wredundant-decls)
CFLAGS += $(call cc-option, -Wno-pointer-sign)
CFLAGS += $(call cc-option, -Wcast-qual)
CFLAGS += $(call cc-option, -Wwrite-strings)
CFLAGS += $(call cc-option, -Wtype-limits)
CFLAGS += $(call cc-option, -Wundef)
CFLAGS += $(call cc-option, -funit-at-a-time)
LINKER = $(CC)
STATIC ?= 0
CPPFLAGS = -I$(NAPA)/include
CPPFLAGS += -I$(GRAPES)/include
CPPFLAGS += -Itransition
ifdef GPROF
CFLAGS += -pg -O0
LDFLAGS += -pg
endif
ifdef DEBUG
CFLAGS += -O0
CPPFLAGS += -DDEBUG
endif
OBJS += dbg.o
ifdef DEBUGOUT
CPPFLAGS += -DDEBUGOUT
endif
LDFLAGS += -L$(GRAPES)/src
LDLIBS += -lgrapes
LIBFILES += $(GRAPES)/src/libgrapes.a
ifdef ALTO
LDFLAGS += -L$(NAPA)/ALTOclient
LDFLAGS += -L$(LIBXML2_DIR)/lib
LDLIBS += -lALTO -lxml2
CFLAGS += -pthread
LDFLAGS += -pthread
LDLIBS += $(call ld-option, -lz)
endif
ifdef ML
LDFLAGS += -L$(NAPA)/ml -L$(LIBEVENT_DIR)/lib
LDLIBS += -lml -lm
LIBFILES += $(NAPA)/ml/libml.a
CPPFLAGS += -I$(NAPA)/ml/include -I$(LIBEVENT_DIR)/include
ifdef MONL
LDFLAGS += -L$(NAPA)/dclog -L$(NAPA)/rep -L$(NAPA)/monl -L$(NAPA)/common
LDLIBS += -lstdc++ -lmon -lrep -ldclog -lcommon
LIBFILES += $(NAPA)/monl/libmon.a
CPPFLAGS += -DMONL
ifneq ($(STATIC), 0)
LINKER=$(CXX)
endif
endif
UNAME := $(shell uname)
ifeq ($(UNAME), Darwin)
LIBEVENT=$(LIBEVENT_DIR)/lib/libevent.a
else
LIBEVENT=-levent
endif
LDLIBS += $(LIBEVENT)
LDLIBS += $(call ld-option, -lrt)
endif
OBJS += streaming.o
OBJS += net_helpers.o
ifdef ALTO
OBJS += topology-ALTO.o
OBJS += config.o
else
OBJS += topology.o nodeid_set.o
endif
OBJS += chunk_signaling.o
OBJS += chunklock.o
OBJS += transaction.o
OBJS += ratecontrol.o
OBJS += channel.o
ifdef THREADS
CPPFLAGS += -DTHREADS
OBJS += loop-mt.o
CFLAGS += -pthread
LDFLAGS += -pthread
else
OBJS += loop.o
endif
ifdef MONL
OBJS += measures-monl.o
else
OBJS += measures.o
endif
OBJS += output-grapes.o
IO ?= grapes
ifeq ($(IO), grapes)
CFLAGS += -DIO_GRAPES
CFLAGS += -DOUTPUT_REORDER=true
OBJS += input-grapes.o
ifdef FFMPEG_DIR
CPPFLAGS += -I$(FFMPEG_DIR)
LDFLAGS += -L$(FFMPEG_DIR)/libavcodec -L$(FFMPEG_DIR)/libavformat -L$(FFMPEG_DIR)/libavutil -L$(FFMPEG_DIR)/libavcore -L$(FFMPEG_DIR)/lib
CFLAGS += -pthread
LDFLAGS += -pthread
LDLIBS += -lavformat -lavcodec -lavutil
LDLIBS += $(call ld-option, -lavcore)
LDLIBS += -lm
LDLIBS += $(call ld-option, -lz)
LDLIBS += $(call ld-option, -lbz2)
LDLIBS += $(call ld-option, -lva)
ifdef X264_DIR
CPPFLAGS += -I$(X264_DIR) -I$(X264_DIR)/include
LDFLAGS += -L$(X264_DIR) -L$(X264_DIR)/lib
LDLIBS += -lx264
endif
endif
endif
ifeq ($(IO), chunkstream)
CFLAGS += -DIO_CHUNKSTREAM
CFLAGS += -DOUTPUT_REORDER=false
OBJS += input-chunkstream.o output-chunkstream.o
endif
EXECTARGET = streamer
ifdef ML
EXECTARGET := $(EXECTARGET)-ml
endif
ifdef MONL
EXECTARGET := $(EXECTARGET)-monl
endif
ifdef ALTO
EXECTARGET := $(EXECTARGET)-alto
endif
ifdef THREADS
EXECTARGET := $(EXECTARGET)-threads
endif
ifdef IO
EXECTARGET := $(EXECTARGET)-$(IO)
endif
ifeq ($(STATIC), 1)
EXECTARGET := $(EXECTARGET)-halfstatic
LDFLAGS += -Wl,-static
LDFLAGSPOST += -Wl,-Bdynamic
endif
ifeq ($(STATIC), 2)
EXECTARGET := $(EXECTARGET)-static
LDFLAGS += -static
endif
ifdef DEBUG
EXECTARGET := $(EXECTARGET)-debug
endif
ifdef RELEASE
EXECTARGET := $(EXECTARGET)-$(RELEASE)
endif
ifeq ($(HOSTARCH), mingw32)
LDLIBS += -lmsvcrt -lwsock32 -lws2_32 -liberty
EXECTARGET := $(EXECTARGET).exe
else
LDLIBS += $(LIBRT)
endif
#apply external LDLIBS at the end as well to resolve lining order problems
LDLIBS += $(LDLIBS_IN)
#lm might be needed again at the end
LDLIBS += $(call ld-option, -lm)
.PHONY: clean distclean
all: $(EXECTARGET)
$(EXECTARGET): $(LIBFILES)
ifndef ML
$(EXECTARGET): $(OBJS) $(GRAPES)/src/net_helper.o $(EXECTARGET).o
else
$(EXECTARGET): $(OBJS) $(GRAPES)/src/net_helper-ml.o $(EXECTARGET).o
endif
$(LINKER) $(LDFLAGS) $^ $(LOADLIBES) $(LDLIBS) $(LDFLAGSPOST) -o $@
$(EXECTARGET).o: streamer.o
ln -sf streamer.o $(EXECTARGET).o
$(OBJS): config.mak
version.h: config.mak
./version.sh
streamer.d: version.h
GRAPES:
git clone http://www.disi.unitn.it/~kiraly/PublicGits/GRAPES.git
cd GRAPES; git checkout -b for-streamer-0.8.3 origin/for-streamer-0.8.3
ffmpeg:
(wget http://ffmpeg.org/releases/ffmpeg-checkout-snapshot.tar.bz2; tar xjf ffmpeg-checkout-snapshot.tar.bz2; mv ffmpeg-checkout-20* ffmpeg) || svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg; ./configure
prepare: $(GRAPES) $(FFSRC)
$(MAKE) -C $(GRAPES) -f Makefile
ifdef ML
cd $(NAPA); ./autogen.sh; $(MAKE)
endif
$(MAKE) -C $(FFSRC)
clean:
rm -f streamer-*
rm -f $(GRAPES)/src/net_helper-ml.o
rm -f $(GRAPES)/src/net_helper.o
rm -f *.o
rm -f Chunkiser/*.o
rm -f version.h
rm -f *.d
distclean: clean
rm -f config.mak
### Automatic generation of headers dependencies ###
%.d: %.c
$(CC) $(CPPFLAGS) -MM -MF $@ $<
%.o: %.d
-include $(OBJS:.o=.d) streamer.d