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 INSTALL-LIBS-yes
+= include/vpx
/vp8.h
include/vpx
/vp8e.h
include/vpx
/vp8cx.h
39 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/$(VP8_PREFIX
)/%
40 CODEC_DOC_SRCS
+= vpx
/vp8.h vpx
/vp8cx.h
41 CODEC_DOC_SECTIONS
+= vp8 vp8_encoder
44 ifeq ($(CONFIG_VP8_DECODER
),yes
)
46 include $(SRC_PATH_BARE
)/$(VP8_PREFIX
)vp8dx.mk
47 CODEC_SRCS-yes
+= $(addprefix $(VP8_PREFIX
),$(call enabled
,VP8_DX_SRCS
))
48 CODEC_EXPORTS-yes
+= $(addprefix $(VP8_PREFIX
),$(VP8_DX_EXPORTS
))
49 CODEC_SRCS-yes
+= $(VP8_PREFIX
)vp8dx.mk vpx
/vp8.h vpx
/vp8dx.h
50 INSTALL-LIBS-yes
+= include/vpx
/vp8.h
include/vpx
/vp8dx.h
51 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/$(VP8_PREFIX
)/%
52 CODEC_DOC_SRCS
+= vpx
/vp8.h vpx
/vp8dx.h
53 CODEC_DOC_SECTIONS
+= vp8 vp8_decoder
57 ifeq ($(CONFIG_ENCODERS
),yes
)
58 CODEC_DOC_SECTIONS
+= encoder
60 ifeq ($(CONFIG_DECODERS
),yes
)
61 CODEC_DOC_SECTIONS
+= decoder
65 ifeq ($(CONFIG_MSVS
),yes
)
66 CODEC_LIB
=$(if
$(CONFIG_STATIC_MSVCRT
),vpxmt
,vpxmd
)
67 # This variable uses deferred expansion intentionally, since the results of
68 # $(wildcard) may change during the course of the Make.
69 VS_PLATFORMS
= $(foreach d
,$(wildcard */Release
/$(CODEC_LIB
).lib
),$(word 1,$(subst /, ,$(d
))))
72 # The following pairs define a mapping of locations in the distribution
73 # tree to locations in the source/build trees.
74 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/vpx
/%
75 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/vpx_ports
/%
76 INSTALL_MAPS
+= $(LIBSUBDIR
)/% %
77 INSTALL_MAPS
+= src
/% $(SRC_PATH_BARE
)/%
78 ifeq ($(CONFIG_MSVS
),yes
)
79 INSTALL_MAPS
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/% $(p
)/Release
/%)
80 INSTALL_MAPS
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/% $(p
)/Debug
/%)
83 # If this is a universal (fat) binary, then all the subarchitectures have
84 # already been built and our job is to stitch them together. The
85 # BUILD_LIBVPX variable indicates whether we should be building
86 # (compiling, linking) the library. The LIPO_LIBVPX variable indicates
87 # that we're stitching.
88 $(eval
$(if
$(filter universal
%,$(TOOLCHAIN
)),LIPO_LIBVPX
,BUILD_LIBVPX
):=yes
)
90 CODEC_SRCS-
$(BUILD_LIBVPX
) += build
/make
/version.sh
91 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx
/vpx_integer.h
92 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/vpx_timer.h
93 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/mem.h
94 CODEC_SRCS-
$(BUILD_LIBVPX
) += $(BUILD_PFX
)vpx_config.c
95 INSTALL-SRCS-no
+= $(BUILD_PFX
)vpx_config.c
96 ifeq ($(ARCH_X86
)$(ARCH_X86_64
),yes
)
97 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/emms.asm
98 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/x86.h
99 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/x86_abi_support.asm
100 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/x86_cpuid.c
102 CODEC_SRCS-
$(ARCH_ARM
) += vpx_ports
/arm_cpudetect.c
103 CODEC_SRCS-
$(ARCH_ARM
) += $(BUILD_PFX
)vpx_config.asm
104 CODEC_EXPORTS-
$(BUILD_LIBVPX
) += vpx
/exports_com
105 CODEC_EXPORTS-
$(CONFIG_ENCODERS
) += vpx
/exports_enc
106 CODEC_EXPORTS-
$(CONFIG_DECODERS
) += vpx
/exports_dec
108 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec.h
109 INSTALL-LIBS-yes
+= include/vpx
/vpx_image.h
110 INSTALL-LIBS-yes
+= include/vpx
/vpx_integer.h
111 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec_impl_top.h
112 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec_impl_bottom.h
113 INSTALL-LIBS-
$(CONFIG_DECODERS
) += include/vpx
/vpx_decoder.h
114 INSTALL-LIBS-
$(CONFIG_DECODERS
) += include/vpx
/vpx_decoder_compat.h
115 INSTALL-LIBS-
$(CONFIG_ENCODERS
) += include/vpx
/vpx_encoder.h
116 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
117 ifeq ($(CONFIG_MSVS
),yes
)
118 INSTALL-LIBS-yes
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/$(CODEC_LIB
).lib
)
119 INSTALL-LIBS-
$(CONFIG_DEBUG_LIBS
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/$(CODEC_LIB
)d.lib
)
120 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/vpx.dll
)
121 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/vpx.exp
)
124 INSTALL-LIBS-yes
+= $(LIBSUBDIR
)/libvpx.a
125 INSTALL-LIBS-
$(CONFIG_DEBUG_LIBS
) += $(LIBSUBDIR
)/libvpx_g.a
128 CODEC_SRCS
=$(call enabled
,CODEC_SRCS
)
129 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(CODEC_SRCS
)
130 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(call enabled
,CODEC_EXPORTS
)
132 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
133 ifeq ($(CONFIG_MSVS
),yes
)
135 obj_int_extract.vcproj
: $(SRC_PATH_BARE
)/build
/make
/obj_int_extract.c
136 @cp
$(SRC_PATH_BARE
)/build
/x86-msvs
/obj_int_extract.bat .
138 $(SRC_PATH_BARE
)/build
/make
/gen_msvs_proj.sh \
140 --target
=$(TOOLCHAIN
) \
141 --name
=obj_int_extract \
142 --ver
=$(CONFIG_VS_VERSION
) \
143 --proj-guid
=E1360C65-D375-4335-8057-7ED99CC3F9B2 \
144 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
147 -I
"$(SRC_PATH_BARE)" \
149 PROJECTS-
$(BUILD_LIBVPX
) += obj_int_extract.vcproj
150 PROJECTS-
$(BUILD_LIBVPX
) += obj_int_extract.bat
152 vpx.def
: $(call enabled
,CODEC_EXPORTS
)
154 $(SRC_PATH_BARE
)/build
/make
/gen_msvs_def.sh\
157 CLEAN-OBJS
+= vpx.def
159 vpx.vcproj
: $(CODEC_SRCS
) vpx.def
161 $(SRC_PATH_BARE
)/build
/make
/gen_msvs_proj.sh \
163 --target
=$(TOOLCHAIN
) \
164 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
166 --proj-guid
=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74 \
167 --module-def
=vpx.def \
168 --ver
=$(CONFIG_VS_VERSION
) \
169 --out
=$@
$(CFLAGS
) $^ \
170 --src-path-bare
="$(SRC_PATH_BARE)" \
172 PROJECTS-
$(BUILD_LIBVPX
) += vpx.vcproj
174 vpx.vcproj
: vpx_config.asm
178 LIBVPX_OBJS
=$(call objs
,$(CODEC_SRCS
))
179 OBJS-
$(BUILD_LIBVPX
) += $(LIBVPX_OBJS
)
180 LIBS-
$(BUILD_LIBVPX
) += $(BUILD_PFX
)libvpx.a
$(BUILD_PFX
)libvpx_g.a
181 $(BUILD_PFX
)libvpx_g.a
: $(LIBVPX_OBJS
)
183 BUILD_LIBVPX_SO
:= $(if
$(BUILD_LIBVPX
),$(CONFIG_SHARED
))
184 LIBVPX_SO
:= libvpx.so.
$(VERSION_MAJOR
).
$(VERSION_MINOR
).
$(VERSION_PATCH
)
185 LIBS-
$(BUILD_LIBVPX_SO
) += $(BUILD_PFX
)$(LIBVPX_SO
)
186 $(BUILD_PFX
)$(LIBVPX_SO
): $(LIBVPX_OBJS
) libvpx.ver
187 $(BUILD_PFX
)$(LIBVPX_SO
): extralibs
+= -lm
-pthread
188 $(BUILD_PFX
)$(LIBVPX_SO
): SONAME
= libvpx.so.
$(VERSION_MAJOR
)
189 $(BUILD_PFX
)$(LIBVPX_SO
): SO_VERSION_SCRIPT
= libvpx.ver
190 LIBVPX_SO_SYMLINKS
:= $(addprefix $(LIBSUBDIR
)/, \
191 libvpx.so libvpx.so.
$(VERSION_MAJOR
) \
192 libvpx.so.
$(VERSION_MAJOR
).
$(VERSION_MINOR
))
194 libvpx.ver
: $(call enabled
,CODEC_EXPORTS
)
196 $(qexec
)echo
"{ global:" > $@
197 $(qexec
)for f in
$?
; do awk
'{print $$2";"}' < $$f >>$@
; done
198 $(qexec
)echo
"local: *; };" >> $@
199 CLEAN-OBJS
+= libvpx.ver
201 $(addprefix $(DIST_DIR
)/,$(LIBVPX_SO_SYMLINKS
)):
203 $(qexec
)ln
-sf
$(LIBVPX_SO
) $@
205 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(LIBVPX_SO_SYMLINKS
)
206 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(LIBSUBDIR
)/$(LIBVPX_SO
)
208 LIBS-
$(BUILD_LIBVPX
) += vpx.
pc
209 vpx.
pc: config.mk libs.mk
211 $(qexec
)echo
'# pkg-config file from libvpx $(VERSION_STRING)' > $@
212 $(qexec
)echo
'prefix=$(PREFIX)' >> $@
213 $(qexec
)echo
'exec_prefix=$${prefix}' >> $@
214 $(qexec
)echo
'libdir=$${prefix}/lib' >> $@
215 $(qexec
)echo
'includedir=$${prefix}/include' >> $@
216 $(qexec
)echo
'' >> $@
217 $(qexec
)echo
'Name: vpx' >> $@
218 $(qexec
)echo
'Description: WebM Project VPx codec implementation' >> $@
219 $(qexec
)echo
'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
220 $(qexec
)echo
'Requires:' >> $@
221 $(qexec
)echo
'Conflicts:' >> $@
222 $(qexec
)echo
'Libs: -L$${libdir} -lvpx' >> $@
223 $(qexec
)echo
'Cflags: -I$${includedir}' >> $@
224 INSTALL-LIBS-yes
+= $(LIBSUBDIR
)/pkgconfig
/vpx.
pc
225 INSTALL_MAPS
+= $(LIBSUBDIR
)/pkgconfig
/%.
pc %.
pc
229 LIBS-
$(LIPO_LIBVPX
) += libvpx.a
230 $(eval
$(if
$(LIPO_LIBVPX
),$(call lipo_lib_template
,libvpx.a
)))
233 # Rule to make assembler configuration file from C configuration file
235 ifeq ($(ARCH_X86
)$(ARCH_X86_64
),yes
)
237 $(BUILD_PFX
)vpx_config.asm
: $(BUILD_PFX
)vpx_config.h
239 @egrep
"#define [A-Z0-9_]+ [01]" $< \
240 | awk
'{print $$2 " equ " $$3}' > $@
242 ADS2GAS
=$(if
$(filter yes
,$(CONFIG_GCC
)),|
$(ASM_CONVERSION
))
243 $(BUILD_PFX
)vpx_config.asm
: $(BUILD_PFX
)vpx_config.h
245 @egrep
"#define [A-Z0-9_]+ [01]" $< \
246 | awk
'{print $$2 " EQU " $$3}' $(ADS2GAS
) > $@
247 @echo
" END" $(ADS2GAS
) >> $@
248 CLEAN-OBJS
+= $(BUILD_PFX
)vpx_config.asm
252 # Add assembler dependencies for configuration and offsets
254 $(filter %.s.o
,$(OBJS-yes
)): $(BUILD_PFX
)vpx_config.asm
255 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)vpx_config.asm
258 # Calculate platform- and compiler-specific offsets for hand coded assembly
260 ifeq ($(CONFIG_EXTERNAL_BUILD
),) # Visual Studio uses obj_int_extract.bat
261 ifeq ($(ARCH_ARM
), yes
)
262 asm_com_offsets.asm
: obj_int_extract
263 asm_com_offsets.asm
: $(VP8_PREFIX
)common
/asm_com_offsets.c.o
264 .
/obj_int_extract rvds
$< $(ADS2GAS
) > $@
265 OBJS-yes
+= $(VP8_PREFIX
)common
/asm_com_offsets.c.o
266 CLEAN-OBJS
+= asm_com_offsets.asm
267 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)asm_com_offsets.asm
270 ifeq ($(ARCH_ARM
)$(ARCH_X86
)$(ARCH_X86_64
), yes
)
271 ifeq ($(CONFIG_VP8_ENCODER
), yes
)
272 asm_enc_offsets.asm
: obj_int_extract
273 asm_enc_offsets.asm
: $(VP8_PREFIX
)encoder
/asm_enc_offsets.c.o
274 .
/obj_int_extract rvds
$< $(ADS2GAS
) > $@
275 OBJS-yes
+= $(VP8_PREFIX
)encoder
/asm_enc_offsets.c.o
276 CLEAN-OBJS
+= asm_enc_offsets.asm
277 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)asm_enc_offsets.asm
281 ifeq ($(ARCH_ARM
), yes
)
282 ifeq ($(CONFIG_VP8_DECODER
), yes
)
283 asm_dec_offsets.asm
: obj_int_extract
284 asm_dec_offsets.asm
: $(VP8_PREFIX
)decoder
/asm_dec_offsets.c.o
285 .
/obj_int_extract rvds
$< $(ADS2GAS
) > $@
286 OBJS-yes
+= $(VP8_PREFIX
)decoder
/asm_dec_offsets.c.o
287 CLEAN-OBJS
+= asm_dec_offsets.asm
288 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)asm_dec_offsets.asm
293 $(shell $(SRC_PATH_BARE
)/build
/make
/version.sh
"$(SRC_PATH_BARE)" $(BUILD_PFX
)vpx_version.h
)
294 CLEAN-OBJS
+= $(BUILD_PFX
)vpx_version.h
296 CODEC_DOC_SRCS
+= vpx
/vpx_codec.h \
301 CLEAN-OBJS
+= libs.doxy
302 DOCS-yes
+= libs.doxy
303 libs.doxy
: $(CODEC_DOC_SRCS
)
306 @echo
"INPUT += $^" >> $@
307 @echo
"PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
308 @echo
"INCLUDE_PATH += ." >> $@
;
309 @echo
"ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@