-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMakefile
156 lines (131 loc) · 5.1 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
WORKBENCH_BASE ?= .
include $(WORKBENCH_BASE)/Makeconf
COMPONENTS = $(patsubst %.c,%.o,$(wildcard Components/*.c))
FFMPEG_LIBS = \
FFmpeg/libavdevice/libavdevice.a \
FFmpeg/libavfilter/libavfilter.a \
FFmpeg/libavformat/libavformat.a \
FFmpeg/libavcodec/libavcodec.a \
FFmpeg/libswresample/libswresample.a \
FFmpeg/libswscale/libswscale.a \
FFmpeg/libavutil/libavutil.a
.PHONY: all debug clean cleanall force .Components .FFmpeg
BUILD_WORKBENCH ?= $(wildcard h264_workbench.c)
ifneq ($(BUILD_WORKBENCH),)
h264_workbench: %: %.c $(COMPONENTS) $(FFMPEG_LIBS) Makefile $(WORKBENCH_BASE)/Makefile $(WORKBENCH_BASE)/Makeconf $(wildcard $(WORKBENCH_BASE)/Makeconf.local)
-$(CC) $(CPPFLAGS) -MM $< > .$*.d 2> /dev/null
$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ "$(realpath $<)" $(COMPONENTS) $(FFMPEG_LIBS) $(LDFLAGS)
clean::
rm -f h264_workbench
endif
BUILD_FFMPEG ?= $(filter .,$(WORKBENCH_BASE))$(wildcard FFmpeg)
ifneq ($(BUILD_FFMPEG),)
ffplay: %: FFmpeg/%.c FFmpeg/cmdutils.o $(COMPONENTS) $(FFMPEG_LIBS) Makefile $(WORKBENCH_BASE)/Makefile $(WORKBENCH_BASE)/Makeconf $(wildcard $(WORKBENCH_BASE)/Makeconf.local)
-$(CC) $(CPPFLAGS) -MM $< > .$*.d 2> /dev/null
$(CC) $(CPPFLAGS) $(filter-out -Weverything,-Wall $(CFLAGS)) $(shell sdl-config --cflags) -o $@ "$(realpath $<)" FFmpeg/cmdutils.o $(COMPONENTS) $(FFMPEG_LIBS) $(shell sdl-config --libs) $(LDFLAGS)
clean::
rm -f ffplay
FFmpeg/ffplay.c FFmpeg/cmdutils.o $(FFMPEG_LIBS): .FFmpeg
FFmpeg $(wildcard FFmpeg/) .FFmpeg: FFmpeg/config.mak force
$(MAKE) -j$(CPUS) -C FFmpeg
FFmpeg/config.mak: FFmpeg/configure
cd $(@D) && CPPFLAGS= CFLAGS= ./configure \
--cc=$(CC) --cpu=$(ARCH) --disable-everything --enable-pthreads \
--disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver \
--enable-protocol=file --enable-parser=h264 --enable-demuxer=h264 --enable-decoder=h264 --enable-rdft
FFmpeg/configure: FFmpeg/.git/config FFmpeg.patch $(WORKBENCH_BASE)/Makefile
cd $(@D) && git diff --name-status --exit-code
cd $(@D) && git fetch --prune
cd $(@D) && git reset --hard 39fe8033bbf94cac7935d749849fdf67ba8fc16a # n0.11.1
# cd $(@D) && git reset --hard a74f292d4ab3e800853c3ab7536418e6eb584b27 # n1.0
cd $(@D) && git clean -dfx
patch -d $(@D) -p1 < FFmpeg.patch
cd $(@D) && git add --all
touch $@
FFmpeg/.git/config:
git clone --single-branch --no-checkout git://source.ffmpeg.org/ffmpeg.git FFmpeg
endif
BUILD_COMPONENTS ?= $(wildcard Components)
ifneq ($(BUILD_COMPONENTS),)
$(COMPONENTS): .Components
Components $(wildcard Components/) .Components: $(if $(BUILD_FFMPEG),.FFmpeg,) force
$(MAKE) -j$(CPUS) -C Components
clean::
$(MAKE) -C Components $@
endif
BUILD_X264 ?= $(filter .,$(WORKBENCH_BASE))$(wildcard x264)
ifneq ($(BUILD_X264),)
Samples Samples/:: x264
x264 $(wildcard x264/): x264/config.mak force
$(MAKE) -j$(CPUS) -C $@
x264/config.mak: x264/configure
cd $(@D) && CC=$(CC) CPPFLAGS= CFLAGS= ./configure --extra-cflags=-march=$(ARCH)
x264/configure: x264/.git/config $(WORKBENCH_BASE)/Makefile
cd $(@D) && git diff --name-status --exit-code
cd $(@D) && git fetch --prune
cd $(@D) && git reset --hard c8a773ebfca148ef04f5a60d42cbd7336af0baf6
cd $(@D) && git clean -dfx
touch $@
x264/.git/config:
git clone --single-branch --no-checkout git://git.videolan.org/x264.git x264
endif
BUILD_LINUX ?= $(filter .,$(WORKBENCH_BASE))$(wildcard Linux)
ifneq ($(BUILD_LINUX),)
all:: Linux
Linux $(wildcard Linux/): Linux/.config force
$(MAKE) -j$(CPUS) -C $@ KERNELVERSION=3.5.0-19-atlas bzImage
Linux/.config: Linux/debian
cd $(@D) && unset MAKELEVEL && \
fakeroot debian/rules clean && \
fakeroot debian/rules binary-indep && \
fakeroot debian/rules binary-perarch && \
fakeroot debian/rules binary-atlas
touch $(@D)/.scmversion # prevent kernel build from using git for version string
cp $(@D)/debian/build/build-atlas/.config $(@D)
cd $(@D) && git clean -df
touch $@
@echo '*** Install the kernel packages and come back here afterwards. ***'
@false
Linux/debian: Linux/.git/config Linux.patch $(WORKBENCH_BASE)/Makefile
cd $(@D) && git diff --name-status --exit-code
cd $(@D) && git fetch --prune
cd $(@D) && git reset --hard 7340a183c5702144b5c62cc78b78791f2783695c # Ubuntu-lts-3.5.0-19.30
cd $(@D) && git clean -dfx
patch -d $(@D) -p1 < Linux.patch
cd $(@D) && \
git add --all debian.quantal && \
git commit --message='build infrastructure' && \
git add --all
touch $@
Linux/.git/config:
git clone --single-branch --no-checkout git://kernel.ubuntu.com/ubuntu/ubuntu-precise.git Linux
endif
BUILD_SAMPLES ?= $(wildcard Samples)
ifneq ($(BUILD_SAMPLES),)
all:: Samples
.PRECIOUS: Samples/%.cfg Samples/%.h264 Samples/%.h264_metrics
Samples/%.h264: Samples/%.cfg
Samples/%.h264 Samples/%.cfg: force
$(MAKE) -C $(@D) $(@F)
Samples Samples/:: force
$(MAKE) -C $@
endif
BUILD_EXPERIMENTS ?= $(wildcard Experiments)
ifneq ($(BUILD_EXPERIMENTS),)
all:: Experiments
Experiments Experiments/: force
$(MAKE) -C $@
endif
debug:
$(MAKE) DEBUG=true
clean::
rm -f .*.d
rm -rf *.dSYM
cleanall: clean
$(MAKE) -C Samples cleanall
$(MAKE) -C Experiments clean
-$(MAKE) -C FFmpeg distclean
-$(MAKE) -C x264 clean
-$(MAKE) -C Linux distclean
force:
-include $(wildcard .*.d)