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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
|
From 2fe4faa9d8eab6068976c7981bc166f576869b36 Mon Sep 17 00:00:00 2001
From: Tzu-Jung Lee <tjlee@ambarella.com>
Date: Sun, 28 Jul 2013 19:40:27 +0800
Subject: [PATCH 1/1] build: fix parallel build failure
This is back ported from recent upstream commit
0e8463ea1dc55f566a88bb3df29cf3d5f23cc326
Once the upstream update the download page with more
recent source tarball, this will no longer be needed.
Signed-off-by: Tzu-Jung Lee <tjlee@ambarella.com>
---
Makefile | 222 +++++++++++++++++++++++++++++++++------------------------------
1 file changed, 115 insertions(+), 107 deletions(-)
diff --git a/Makefile b/Makefile
index b79a573..ad7f163 100644
--- a/Makefile
+++ b/Makefile
@@ -67,67 +67,49 @@ LFS_FLAGS = -D_FILE_OFFSET_BITS=64
# sort of thing (presumably Linux or BSD)
ifeq ($(shell uname -s), Darwin)
SYSTEM = "macosx"
- ARCH_FLAGS = -arch ppc -arch i386
+ ARCH_FLAGS =
+ # If you're still building on a version of Mac OS X that supports powerpc,
+ # then you may want to uncomment the next line. Obviously, this no longer
+ # works in Lion, which doesn't support powerpc machines any more.
+ #ARCH_FLAGS = -arch ppc -arch i386
else
SYSTEM = "other"
- ARCH_FLAGS =
+ ARCH_FLAGS = -fPIC
endif
CFLAGS = $(WARNING_FLAGS) $(OPTIMISE_FLAGS) $(LFS_FLAGS) -I. $(PROFILE_FLAGS) $(ARCH_FLAGS)
-LDFLAGS = -g -lm $(PROFILE_FLAGS) $(ARCH_FLAGS)
+LDFLAGS = -g $(PROFILE_FLAGS) $(ARCH_FLAGS) -lm
# Target directories
OBJDIR = obj
LIBDIR = lib
BINDIR = bin
-# All of our non-program source files
-SRCS = \
- accessunit.c \
- ac3.c \
- adts.c \
- avs.c \
- bitdata.c \
- es.c \
- fmtx.c \
- h222.c \
- h262.c \
- audio.c \
- l2audio.c \
- misc.c \
- nalunit.c \
- ps.c \
- pes.c \
- pidint.c \
- ts.c \
- tswrite.c \
- pcap.c
-
# All of our non-program object modules
OBJS = \
- accessunit.o \
- avs.o \
- ac3.o \
- adts.o \
- bitdata.o \
- es.o \
- filter.o \
- fmtx.o \
- h222.o \
- h262.o \
- audio.o \
- l2audio.o \
- misc.o \
- nalunit.o \
- ps.o \
- pes.o \
- pidint.o \
- reverse.o \
- ts.o \
- tswrite.o \
- pcap.o \
- ethernet.o \
- ipv4.o
+ $(OBJDIR)/accessunit.o \
+ $(OBJDIR)/avs.o \
+ $(OBJDIR)/ac3.o \
+ $(OBJDIR)/adts.o \
+ $(OBJDIR)/bitdata.o \
+ $(OBJDIR)/es.o \
+ $(OBJDIR)/filter.o \
+ $(OBJDIR)/fmtx.o \
+ $(OBJDIR)/h222.o \
+ $(OBJDIR)/h262.o \
+ $(OBJDIR)/audio.o \
+ $(OBJDIR)/l2audio.o \
+ $(OBJDIR)/misc.o \
+ $(OBJDIR)/nalunit.o \
+ $(OBJDIR)/ps.o \
+ $(OBJDIR)/pes.o \
+ $(OBJDIR)/pidint.o \
+ $(OBJDIR)/reverse.o \
+ $(OBJDIR)/ts.o \
+ $(OBJDIR)/tswrite.o \
+ $(OBJDIR)/pcap.o \
+ $(OBJDIR)/ethernet.o \
+ $(OBJDIR)/ipv4.o
# Our program object modules
PROG_OBJS = \
@@ -161,9 +143,14 @@ TEST_OBJS = \
$(OBJDIR)/test_es_unit_list.o
# Our library
-LIB = $(LIBDIR)/libtstools.a
-LIBOPTS = -L$(LIBDIR) -ltstools $(ARCH_FLAGS)
+STATIC_LIB = $(LIBDIR)/libtstools.a
+LIBOPTS = $(ARCH_FLAGS) $(STATIC_LIB)
+ifeq ($(shell uname -s), Darwin)
+SHARED_LIB = $(LIBDIR)/libtstools.xxx
+else
+SHARED_LIB = $(LIBDIR)/libtstools.so
+endif
# All of our programs (except the testing ones)
PROGS = \
$(BINDIR)/esfilter \
@@ -197,7 +184,7 @@ TEST_PES_PROG = $(BINDIR)/test_pes
TEST_PROGS = test_nal_unit_list test_es_unit_list
# ------------------------------------------------------------
-all: $(BINDIR) $(LIBDIR) $(OBJDIR) $(PROGS)
+all: $(BINDIR) $(LIBDIR) $(OBJDIR) $(PROGS) $(SHARED_LIB)
# ts2ps is not yet an offical program, so for the moment build
# it separately
@@ -205,82 +192,97 @@ all: $(BINDIR) $(LIBDIR) $(OBJDIR) $(PROGS)
ts2ps: $(TS2PS_PROG)
ifeq ($(shell uname -s), Darwin)
-# Try getting a library containing universal objects on Mac
-$(LIB): $(OBJS)
- libtool -static $(OBJS) -o $(LIB)
+# Make libraries containing universal objects on Mac
+$(STATIC_LIB): $(OBJS)
+ libtool -static $(OBJS) -o $(STATIC_LIB)
+$(SHARED_LIB): $(OBJS)
+ libtool -dynamic $(OBJS) -o $(SHARED_LIB)
else
-$(LIB): $(LIB)($(OBJS))
+$(STATIC_LIB): $(OBJS)
+ rm -f $(STATIC_LIB)
+ ar rc $(STATIC_LIB) $(OBJS)
+
+$(SHARED_LIB): $(OBJS)
+ $(LD) -shared -o $(SHARED_LIB) $(OBJS) -lc
endif
-$(BINDIR)/esfilter: $(OBJDIR)/esfilter.o $(LIB)
- $(CC) $< -o $(BINDIR)/esfilter $(LDFLAGS) $(LIBOPTS)
+# Build all of the utilities with the static library, so that they can
+# be copied around, shared, etc., without having to think about it
+
+$(BINDIR)/esfilter: $(OBJDIR)/esfilter.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/esfilter $(LIBOPTS) $(LDFLAGS)
+
+$(BINDIR)/ts2es: $(OBJDIR)/ts2es.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/ts2es $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/ts2es: $(OBJDIR)/ts2es.o $(LIB)
- $(CC) $< -o $(BINDIR)/ts2es $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/es2ts: $(OBJDIR)/es2ts.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/es2ts $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/es2ts: $(OBJDIR)/es2ts.o $(LIB)
- $(CC) $< -o $(BINDIR)/es2ts $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/esdots: $(OBJDIR)/esdots.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/esdots $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/esdots: $(OBJDIR)/esdots.o $(LIB)
- $(CC) $< -o $(BINDIR)/esdots $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/esmerge: $(OBJDIR)/esmerge.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/esmerge $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/esmerge: $(OBJDIR)/esmerge.o $(LIB)
- $(CC) $< -o $(BINDIR)/esmerge $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/esreport: $(OBJDIR)/esreport.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/esreport $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/esreport: $(OBJDIR)/esreport.o $(LIB)
- $(CC) $< -o $(BINDIR)/esreport $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/esreverse: $(OBJDIR)/esreverse.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/esreverse $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/esreverse: $(OBJDIR)/esreverse.o $(LIB)
- $(CC) $< -o $(BINDIR)/esreverse $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/stream_type: $(OBJDIR)/stream_type.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/stream_type $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/stream_type: $(OBJDIR)/stream_type.o $(LIB)
- $(CC) $< -o $(BINDIR)/stream_type $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/psreport: $(OBJDIR)/psreport.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/psreport $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/psreport: $(OBJDIR)/psreport.o $(LIB)
- $(CC) $< -o $(BINDIR)/psreport $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/psdots: $(OBJDIR)/psdots.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/psdots $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/psdots: $(OBJDIR)/psdots.o $(LIB)
- $(CC) $< -o $(BINDIR)/psdots $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/ps2ts: $(OBJDIR)/ps2ts.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/ps2ts $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/ps2ts: $(OBJDIR)/ps2ts.o $(LIB)
- $(CC) $< -o $(BINDIR)/ps2ts $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/tsinfo: $(OBJDIR)/tsinfo.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/tsinfo $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/tsinfo: $(OBJDIR)/tsinfo.o $(LIB)
- $(CC) $< -o $(BINDIR)/tsinfo $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/tsreport: $(OBJDIR)/tsreport.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/tsreport $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/tsreport: $(OBJDIR)/tsreport.o $(LIB)
- $(CC) $< -o $(BINDIR)/tsreport $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/tsserve: $(OBJDIR)/tsserve.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/tsserve $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/tsserve: $(OBJDIR)/tsserve.o $(LIB)
- $(CC) $< -o $(BINDIR)/tsserve $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/tsplay: $(OBJDIR)/tsplay.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/tsplay $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/tsplay: $(OBJDIR)/tsplay.o $(LIB)
- $(CC) $< -o $(BINDIR)/tsplay $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/test_ps: $(OBJDIR)/test_ps.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/test_ps $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/test_ps: $(OBJDIR)/test_ps.o $(LIB)
- $(CC) $< -o $(BINDIR)/test_ps $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/ts2ps: $(OBJDIR)/ts2ps.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/ts2ps $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/ts2ps: $(OBJDIR)/ts2ps.o $(LIB)
- $(CC) $< -o $(BINDIR)/ts2ps $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/ts_packet_insert: $(OBJDIR)/ts_packet_insert.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/ts_packet_insert $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/ts_packet_insert: $(OBJDIR)/ts_packet_insert.o $(LIB)
- $(CC) $< -o $(BINDIR)/ts_packet_insert $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/m2ts2ts: $(OBJDIR)/m2ts2ts.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/m2ts2ts $(LIBOPTS) $(LDFLAGS)
+$(BINDIR)/pcapreport: $(OBJDIR)/pcapreport.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/pcapreport $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/m2ts2ts: $(OBJDIR)/m2ts2ts.o $(LIB)
- $(CC) $< -o $(BINDIR)/m2ts2ts $(LDFLAGS) $(LIBOPTS)
-$(BINDIR)/pcapreport: $(OBJDIR)/pcapreport.o $(LIB)
- $(CC) $< -o $(BINDIR)/pcapreport $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/tsfilter: $(OBJDIR)/tsfilter.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/tsfilter $(LIBOPTS) $(LDFLAGS)
+$(BINDIR)/tsdvbsub: $(OBJDIR)/tsdvbsub.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/tsdvbsub $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/test_pes: $(OBJDIR)/test_pes.o $(LIB)
- $(CC) $< -o $(BINDIR)/test_pes $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/test_pes: $(OBJDIR)/test_pes.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/test_pes $(LIBOPTS) $(LDFLAGS)
-$(BINDIR)/test_nal_unit_list: $(OBJDIR)/test_nal_unit_list.o $(LIB)
- $(CC) $< -o $(BINDIR)/test_nal_unit_list $(LDFLAGS) $(LIBOPTS)
-$(BINDIR)/test_es_unit_list: $(OBJDIR)/test_es_unit_list.o $(LIB)
- $(CC) $< -o $(BINDIR)/test_es_unit_list $(LDFLAGS) $(LIBOPTS)
+$(BINDIR)/test_nal_unit_list: $(OBJDIR)/test_nal_unit_list.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/test_nal_unit_list $(LIBOPTS) $(LDFLAGS)
+$(BINDIR)/test_es_unit_list: $(OBJDIR)/test_es_unit_list.o $(STATIC_LIB)
+ $(CC) $< -o $(BINDIR)/test_es_unit_list $(LIBOPTS) $(LDFLAGS)
# Some header files depend upon others, so including one requires
# the others as well
@@ -299,14 +301,19 @@ REVERSE_H = reverse_fns.h reverse_defns.h
FILTER_H = filter_fns.h filter_defns.h $(REVERSE_H)
AUDIO_H = adts_fns.h l2audio_fns.h ac3_fns.h audio_fns.h audio_defns.h adts_defns.h
-# Everyone depends upon the basic configuration file
-$(LIB)($(OBJS)) $(TEST_OBJS) $(PROG_OBJS): compat.h
+# Everyone depends upon the basic configuration file, and I assert they all
+# want (or may want) printing...
+$(OBJS) $(TEST_OBJS) $(PROG_OBJS): compat.h
# Which library modules depend on which header files is complex, so
# lets just be simple
-$(LIB)($(OBJS)): $(ACCESSUNIT_H) $(NALUNIT_H) $(TS_H) $(ES_H) $(PES_H) \
- misc_fns.h $(PS_H) $(H262_H) $(TSWRITE_H) $(AVS_H) \
- $(REVERSE_H) $(FILTER_H) $(AUDIO_H)
+$(OBJS): \
+ $(ACCESSUNIT_H) $(NALUNIT_H) $(TS_H) $(ES_H) $(PES_H) \
+ misc_fns.h $(PS_H) $(H262_H) \
+ $(TSWRITE_H) $(AVS_H) $(REVERSE_H) $(FILTER_H) $(AUDIO_H)
+
+$(OBJDIR)/%.o: %.c
+ $(CC) -c $< -o $@ $(CFLAGS)
$(OBJDIR)/es2ts.o: es2ts.c $(ES_H) $(TS_H) misc_fns.h version.h
$(CC) -c $< -o $@ $(CFLAGS)
@@ -389,7 +396,8 @@ objclean:
.PHONY: clean
clean: objclean
-rm -f $(PROGS)
- -rm -f $(LIB)
+ -rm -f $(STATIC_LIB)
+ -rm -f $(SHARED_LIB)
-rm -f $(PROG_OBJS)
.PHONY: distclean
--
1.8.3.2
|