2 ## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
4 ## Use of this source code is governed by a BSD-style license
5 ## that can be found in the LICENSE file in the root of the source
6 ## tree. An additional intellectual property rights grant can be found
7 ## in the file PATENTS. All contributing project authors may
8 ## be found in the AUTHORS file in the root of the source tree.
12 # ARM assembly files are written in RVCT-style. We use some make magic to
13 # filter those files to allow GCC compilation
14 ifeq ($(ARCH_ARM
),yes
)
15 ASM
:=$(if
$(filter yes
,$(CONFIG_GCC
)),.asm.s
,.asm
)
20 CODEC_SRCS-yes
+= libs.mk
22 include $(SRC_PATH_BARE
)/vpx
/vpx_codec.mk
23 CODEC_SRCS-yes
+= $(addprefix vpx
/,$(call enabled
,API_SRCS
))
25 include $(SRC_PATH_BARE
)/vpx_mem
/vpx_mem.mk
26 CODEC_SRCS-yes
+= $(addprefix vpx_mem
/,$(call enabled
,MEM_SRCS
))
28 include $(SRC_PATH_BARE
)/vpx_scale
/vpx_scale.mk
29 CODEC_SRCS-yes
+= $(addprefix vpx_scale
/,$(call enabled
,SCALE_SRCS
))
32 ifeq ($(CONFIG_VP8_ENCODER
),yes
)
34 include $(SRC_PATH_BARE
)/$(VP8_PREFIX
)vp8cx.mk
35 CODEC_SRCS-yes
+= $(addprefix $(VP8_PREFIX
),$(call enabled
,VP8_CX_SRCS
))
36 CODEC_EXPORTS-yes
+= $(addprefix $(VP8_PREFIX
),$(VP8_CX_EXPORTS
))
37 CODEC_SRCS-yes
+= $(VP8_PREFIX
)vp8cx.mk vpx
/vp8.h vpx
/vp8cx.h vpx
/vp8e.h
38 CODEC_SRCS-
$(ARCH_ARM
) += $(VP8_PREFIX
)vp8cx_arm.mk
39 INSTALL-LIBS-yes
+= include/vpx
/vp8.h
include/vpx
/vp8e.h
include/vpx
/vp8cx.h
40 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/$(VP8_PREFIX
)/%
41 CODEC_DOC_SRCS
+= vpx
/vp8.h vpx
/vp8cx.h
42 CODEC_DOC_SECTIONS
+= vp8 vp8_encoder
45 ifeq ($(CONFIG_VP8_DECODER
),yes
)
47 include $(SRC_PATH_BARE
)/$(VP8_PREFIX
)vp8dx.mk
48 CODEC_SRCS-yes
+= $(addprefix $(VP8_PREFIX
),$(call enabled
,VP8_DX_SRCS
))
49 CODEC_EXPORTS-yes
+= $(addprefix $(VP8_PREFIX
),$(VP8_DX_EXPORTS
))
50 CODEC_SRCS-yes
+= $(VP8_PREFIX
)vp8dx.mk vpx
/vp8.h vpx
/vp8dx.h
51 CODEC_SRCS-
$(ARCH_ARM
) += $(VP8_PREFIX
)vp8dx_arm.mk
52 INSTALL-LIBS-yes
+= include/vpx
/vp8.h
include/vpx
/vp8dx.h
53 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/$(VP8_PREFIX
)/%
54 CODEC_DOC_SRCS
+= vpx
/vp8.h vpx
/vp8dx.h
55 CODEC_DOC_SECTIONS
+= vp8 vp8_decoder
59 ifeq ($(CONFIG_ENCODERS
),yes
)
60 CODEC_DOC_SECTIONS
+= encoder
62 ifeq ($(CONFIG_DECODERS
),yes
)
63 CODEC_DOC_SECTIONS
+= decoder
67 ifeq ($(CONFIG_MSVS
),yes
)
68 CODEC_LIB
=$(if
$(CONFIG_STATIC_MSVCRT
),vpxmt
,vpxmd
)
69 # This variable uses deferred expansion intentionally, since the results of
70 # $(wildcard) may change during the course of the Make.
71 VS_PLATFORMS
= $(foreach d
,$(wildcard */Release
/$(CODEC_LIB
).lib
),$(word 1,$(subst /, ,$(d
))))
74 # The following pairs define a mapping of locations in the distribution
75 # tree to locations in the source/build trees.
76 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/vpx
/%
77 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/vpx_ports
/%
78 INSTALL_MAPS
+= $(LIBSUBDIR
)/% %
79 INSTALL_MAPS
+= src
/% $(SRC_PATH_BARE
)/%
80 ifeq ($(CONFIG_MSVS
),yes
)
81 INSTALL_MAPS
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/% $(p
)/Release
/%)
82 INSTALL_MAPS
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/% $(p
)/Debug
/%)
85 # If this is a universal (fat) binary, then all the subarchitectures have
86 # already been built and our job is to stitch them together. The
87 # BUILD_LIBVPX variable indicates whether we should be building
88 # (compiling, linking) the library. The LIPO_LIBVPX variable indicates
89 # that we're stitching.
90 $(eval
$(if
$(filter universal
%,$(TOOLCHAIN
)),LIPO_LIBVPX
,BUILD_LIBVPX
):=yes
)
92 CODEC_SRCS-
$(BUILD_LIBVPX
) += build
/make
/version.sh
93 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx
/vpx_integer.h
94 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/asm_offsets.h
95 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/vpx_timer.h
96 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/mem.h
97 CODEC_SRCS-
$(BUILD_LIBVPX
) += $(BUILD_PFX
)vpx_config.c
98 INSTALL-SRCS-no
+= $(BUILD_PFX
)vpx_config.c
99 ifeq ($(ARCH_X86
)$(ARCH_X86_64
),yes
)
100 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/emms.asm
101 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/x86.h
102 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/x86_abi_support.asm
103 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/x86_cpuid.c
105 CODEC_SRCS-
$(ARCH_ARM
) += vpx_ports
/arm_cpudetect.c
106 CODEC_SRCS-
$(ARCH_ARM
) += vpx_ports
/arm.h
107 CODEC_EXPORTS-
$(BUILD_LIBVPX
) += vpx
/exports_com
108 CODEC_EXPORTS-
$(CONFIG_ENCODERS
) += vpx
/exports_enc
109 CODEC_EXPORTS-
$(CONFIG_DECODERS
) += vpx
/exports_dec
111 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec.h
112 INSTALL-LIBS-yes
+= include/vpx
/vpx_image.h
113 INSTALL-LIBS-yes
+= include/vpx
/vpx_integer.h
114 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec_impl_top.h
115 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec_impl_bottom.h
116 INSTALL-LIBS-
$(CONFIG_DECODERS
) += include/vpx
/vpx_decoder.h
117 INSTALL-LIBS-
$(CONFIG_DECODERS
) += include/vpx
/vpx_decoder_compat.h
118 INSTALL-LIBS-
$(CONFIG_ENCODERS
) += include/vpx
/vpx_encoder.h
119 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
120 ifeq ($(CONFIG_MSVS
),yes
)
121 INSTALL-LIBS-yes
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/$(CODEC_LIB
).lib
)
122 INSTALL-LIBS-
$(CONFIG_DEBUG_LIBS
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/$(CODEC_LIB
)d.lib
)
123 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/vpx.dll
)
124 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/vpx.exp
)
127 INSTALL-LIBS-
$(CONFIG_STATIC
) += $(LIBSUBDIR
)/libvpx.a
128 INSTALL-LIBS-
$(CONFIG_DEBUG_LIBS
) += $(LIBSUBDIR
)/libvpx_g.a
131 CODEC_SRCS
=$(call enabled
,CODEC_SRCS
)
132 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(CODEC_SRCS
)
133 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(call enabled
,CODEC_EXPORTS
)
136 # Generate a list of all enabled sources, in particular for exporting to gyp
137 # based build systems.
140 @echo
$(CODEC_SRCS
) | xargs
-n1 echo |
sort -u
> $@
143 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
144 ifeq ($(CONFIG_MSVS
),yes
)
146 obj_int_extract.vcproj
: $(SRC_PATH_BARE
)/build
/make
/obj_int_extract.c
147 @cp
$(SRC_PATH_BARE
)/build
/x86-msvs
/obj_int_extract.bat .
149 $(SRC_PATH_BARE
)/build
/make
/gen_msvs_proj.sh \
151 --target
=$(TOOLCHAIN
) \
152 --name
=obj_int_extract \
153 --ver
=$(CONFIG_VS_VERSION
) \
154 --proj-guid
=E1360C65-D375-4335-8057-7ED99CC3F9B2 \
155 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
158 -I
"$(SRC_PATH_BARE)" \
160 PROJECTS-
$(BUILD_LIBVPX
) += obj_int_extract.vcproj
161 PROJECTS-
$(BUILD_LIBVPX
) += obj_int_extract.bat
163 vpx.def
: $(call enabled
,CODEC_EXPORTS
)
165 $(SRC_PATH_BARE
)/build
/make
/gen_msvs_def.sh\
168 CLEAN-OBJS
+= vpx.def
170 vpx.vcproj
: $(CODEC_SRCS
) vpx.def
172 $(SRC_PATH_BARE
)/build
/make
/gen_msvs_proj.sh \
174 --target
=$(TOOLCHAIN
) \
175 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
177 --proj-guid
=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74 \
178 --module-def
=vpx.def \
179 --ver
=$(CONFIG_VS_VERSION
) \
180 --out
=$@
$(CFLAGS
) $^ \
181 --src-path-bare
="$(SRC_PATH_BARE)" \
183 PROJECTS-
$(BUILD_LIBVPX
) += vpx.vcproj
185 vpx.vcproj
: vpx_config.asm
189 LIBVPX_OBJS
=$(call objs
,$(CODEC_SRCS
))
190 OBJS-
$(BUILD_LIBVPX
) += $(LIBVPX_OBJS
)
191 LIBS-
$(if
$(BUILD_LIBVPX
),$(CONFIG_STATIC
)) += $(BUILD_PFX
)libvpx.a
$(BUILD_PFX
)libvpx_g.a
192 $(BUILD_PFX
)libvpx_g.a
: $(LIBVPX_OBJS
)
194 BUILD_LIBVPX_SO
:= $(if
$(BUILD_LIBVPX
),$(CONFIG_SHARED
))
195 LIBVPX_SO
:= libvpx.so.
$(VERSION_MAJOR
).
$(VERSION_MINOR
).
$(VERSION_PATCH
)
196 LIBS-
$(BUILD_LIBVPX_SO
) += $(BUILD_PFX
)$(LIBVPX_SO
)\
197 $(notdir $(LIBVPX_SO_SYMLINKS
))
198 $(BUILD_PFX
)$(LIBVPX_SO
): $(LIBVPX_OBJS
) libvpx.ver
199 $(BUILD_PFX
)$(LIBVPX_SO
): extralibs
+= -lm
200 $(BUILD_PFX
)$(LIBVPX_SO
): SONAME
= libvpx.so.
$(VERSION_MAJOR
)
201 $(BUILD_PFX
)$(LIBVPX_SO
): SO_VERSION_SCRIPT
= libvpx.ver
202 LIBVPX_SO_SYMLINKS
:= $(addprefix $(LIBSUBDIR
)/, \
203 libvpx.so libvpx.so.
$(VERSION_MAJOR
) \
204 libvpx.so.
$(VERSION_MAJOR
).
$(VERSION_MINOR
))
206 libvpx.ver
: $(call enabled
,CODEC_EXPORTS
)
208 $(qexec
)echo
"{ global:" > $@
209 $(qexec
)for f in
$?
; do awk
'{print $$2";"}' < $$f >>$@
; done
210 $(qexec
)echo
"local: *; };" >> $@
211 CLEAN-OBJS
+= libvpx.ver
213 define libvpx_symlink_template
216 $(qexec
)ln
-sf
$(LIBVPX_SO
) $$@
219 $(eval
$(call libvpx_symlink_template
,\
220 $(addprefix $(BUILD_PFX
),$(notdir $(LIBVPX_SO_SYMLINKS
))),\
221 $(BUILD_PFX
)$(LIBVPX_SO
)))
222 $(eval
$(call libvpx_symlink_template
,\
223 $(addprefix $(DIST_DIR
)/,$(LIBVPX_SO_SYMLINKS
)),\
224 $(DIST_DIR
)/$(LIBSUBDIR
)/$(LIBVPX_SO
)))
226 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(LIBVPX_SO_SYMLINKS
)
227 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(LIBSUBDIR
)/$(LIBVPX_SO
)
229 LIBS-
$(BUILD_LIBVPX
) += vpx.
pc
230 vpx.
pc: config.mk libs.mk
232 $(qexec
)echo
'# pkg-config file from libvpx $(VERSION_STRING)' > $@
233 $(qexec
)echo
'prefix=$(PREFIX)' >> $@
234 $(qexec
)echo
'exec_prefix=$${prefix}' >> $@
235 $(qexec
)echo
'libdir=$${prefix}/lib' >> $@
236 $(qexec
)echo
'includedir=$${prefix}/include' >> $@
237 $(qexec
)echo
'' >> $@
238 $(qexec
)echo
'Name: vpx' >> $@
239 $(qexec
)echo
'Description: WebM Project VPx codec implementation' >> $@
240 $(qexec
)echo
'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
241 $(qexec
)echo
'Requires:' >> $@
242 $(qexec
)echo
'Conflicts:' >> $@
243 $(qexec
)echo
'Libs: -L$${libdir} -lvpx' >> $@
244 $(qexec
)echo
'Cflags: -I$${includedir}' >> $@
245 INSTALL-LIBS-yes
+= $(LIBSUBDIR
)/pkgconfig
/vpx.
pc
246 INSTALL_MAPS
+= $(LIBSUBDIR
)/pkgconfig
/%.
pc %.
pc
250 LIBS-
$(LIPO_LIBVPX
) += libvpx.a
251 $(eval
$(if
$(LIPO_LIBVPX
),$(call lipo_lib_template
,libvpx.a
)))
254 # Rule to make assembler configuration file from C configuration file
256 ifeq ($(ARCH_X86
)$(ARCH_X86_64
),yes
)
258 $(BUILD_PFX
)vpx_config.asm
: $(BUILD_PFX
)vpx_config.h
260 @egrep
"#define [A-Z0-9_]+ [01]" $< \
261 | awk
'{print $$2 " equ " $$3}' > $@
263 ADS2GAS
=$(if
$(filter yes
,$(CONFIG_GCC
)),|
$(ASM_CONVERSION
))
264 $(BUILD_PFX
)vpx_config.asm
: $(BUILD_PFX
)vpx_config.h
266 @egrep
"#define [A-Z0-9_]+ [01]" $< \
267 | awk
'{print $$2 " EQU " $$3}' $(ADS2GAS
) > $@
268 @echo
" END" $(ADS2GAS
) >> $@
269 CLEAN-OBJS
+= $(BUILD_PFX
)vpx_config.asm
273 # Add assembler dependencies for configuration and offsets
275 $(filter %.s.o
,$(OBJS-yes
)): $(BUILD_PFX
)vpx_config.asm
276 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)vpx_config.asm
279 # Calculate platform- and compiler-specific offsets for hand coded assembly
282 ifeq ($(filter icc gcc
,$(TGT_CC
)), $(TGT_CC
))
283 $(BUILD_PFX
)asm_com_offsets.asm
: $(BUILD_PFX
)$(VP8_PREFIX
)common
/asm_com_offsets.c.S
284 grep
-w EQU
$< | tr
-d
'$$\#' $(ADS2GAS
) > $@
285 $(BUILD_PFX
)$(VP8_PREFIX
)common
/asm_com_offsets.c.S
: $(VP8_PREFIX
)common
/asm_com_offsets.c
286 CLEAN-OBJS
+= $(BUILD_PFX
)asm_com_offsets.asm
$(BUILD_PFX
)$(VP8_PREFIX
)common
/asm_com_offsets.c.S
288 $(BUILD_PFX
)asm_enc_offsets.asm
: $(BUILD_PFX
)$(VP8_PREFIX
)encoder
/asm_enc_offsets.c.S
289 grep
-w EQU
$< | tr
-d
'$$\#' $(ADS2GAS
) > $@
290 $(BUILD_PFX
)$(VP8_PREFIX
)encoder
/asm_enc_offsets.c.S
: $(VP8_PREFIX
)encoder
/asm_enc_offsets.c
291 CLEAN-OBJS
+= $(BUILD_PFX
)asm_enc_offsets.asm
$(BUILD_PFX
)$(VP8_PREFIX
)encoder
/asm_enc_offsets.c.S
293 $(BUILD_PFX
)asm_dec_offsets.asm
: $(BUILD_PFX
)$(VP8_PREFIX
)decoder
/asm_dec_offsets.c.S
294 grep
-w EQU
$< | tr
-d
'$$\#' $(ADS2GAS
) > $@
295 $(BUILD_PFX
)$(VP8_PREFIX
)decoder
/asm_dec_offsets.c.S
: $(VP8_PREFIX
)decoder
/asm_dec_offsets.c
296 CLEAN-OBJS
+= $(BUILD_PFX
)asm_dec_offsets.asm
$(BUILD_PFX
)$(VP8_PREFIX
)decoder
/asm_dec_offsets.c.S
298 ifeq ($(filter rvct
,$(TGT_CC
)), $(TGT_CC
))
299 asm_com_offsets.asm
: obj_int_extract
300 asm_com_offsets.asm
: $(VP8_PREFIX
)common
/asm_com_offsets.c.o
301 .
/obj_int_extract rvds
$< $(ADS2GAS
) > $@
302 OBJS-yes
+= $(VP8_PREFIX
)common
/asm_com_offsets.c.o
303 CLEAN-OBJS
+= asm_com_offsets.asm
304 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)asm_com_offsets.asm
306 asm_enc_offsets.asm
: obj_int_extract
307 asm_enc_offsets.asm
: $(VP8_PREFIX
)encoder
/asm_enc_offsets.c.o
308 .
/obj_int_extract rvds
$< $(ADS2GAS
) > $@
309 OBJS-yes
+= $(VP8_PREFIX
)encoder
/asm_enc_offsets.c.o
310 CLEAN-OBJS
+= asm_enc_offsets.asm
311 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)asm_enc_offsets.asm
313 asm_dec_offsets.asm
: obj_int_extract
314 asm_dec_offsets.asm
: $(VP8_PREFIX
)decoder
/asm_dec_offsets.c.o
315 .
/obj_int_extract rvds
$< $(ADS2GAS
) > $@
316 OBJS-yes
+= $(VP8_PREFIX
)decoder
/asm_dec_offsets.c.o
317 CLEAN-OBJS
+= asm_dec_offsets.asm
318 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)asm_dec_offsets.asm
322 $(shell $(SRC_PATH_BARE
)/build
/make
/version.sh
"$(SRC_PATH_BARE)" $(BUILD_PFX
)vpx_version.h
)
323 CLEAN-OBJS
+= $(BUILD_PFX
)vpx_version.h
325 CODEC_DOC_SRCS
+= vpx
/vpx_codec.h \
330 CLEAN-OBJS
+= libs.doxy
331 DOCS-yes
+= libs.doxy
332 libs.doxy
: $(CODEC_DOC_SRCS
)
335 @echo
"INPUT += $^" >> $@
336 @echo
"PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
337 @echo
"INCLUDE_PATH += ." >> $@
;
338 @echo
"ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@