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 ASM
:=$(if
$(filter yes
,$(CONFIG_GCC
)),.asm.s
,.asm
)
14 CODEC_SRCS-yes
+= libs.mk
16 include $(SRC_PATH_BARE
)/vpx
/vpx_codec.mk
17 CODEC_SRCS-yes
+= $(addprefix vpx
/,$(call enabled
,API_SRCS
))
19 include $(SRC_PATH_BARE
)/vpx_mem
/vpx_mem.mk
20 CODEC_SRCS-yes
+= $(addprefix vpx_mem
/,$(call enabled
,MEM_SRCS
))
22 include $(SRC_PATH_BARE
)/vpx_scale
/vpx_scale.mk
23 CODEC_SRCS-yes
+= $(addprefix vpx_scale
/,$(call enabled
,SCALE_SRCS
))
26 ifeq ($(CONFIG_VP8_ENCODER
),yes
)
28 include $(SRC_PATH_BARE
)/$(VP8_PREFIX
)vp8cx.mk
29 CODEC_SRCS-yes
+= $(addprefix $(VP8_PREFIX
),$(call enabled
,VP8_CX_SRCS
))
30 CODEC_EXPORTS-yes
+= $(addprefix $(VP8_PREFIX
),$(VP8_CX_EXPORTS
))
31 CODEC_SRCS-yes
+= $(VP8_PREFIX
)vp8cx.mk vpx
/vp8.h vpx
/vp8cx.h vpx
/vp8e.h
32 INSTALL-LIBS-yes
+= include/vpx
/vp8.h
include/vpx
/vp8e.h
include/vpx
/vp8cx.h
33 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/$(VP8_PREFIX
)/%
34 CODEC_DOC_SRCS
+= vpx
/vp8.h vpx
/vp8cx.h
35 CODEC_DOC_SECTIONS
+= vp8 vp8_encoder
38 ifeq ($(CONFIG_VP8_DECODER
),yes
)
40 include $(SRC_PATH_BARE
)/$(VP8_PREFIX
)vp8dx.mk
41 CODEC_SRCS-yes
+= $(addprefix $(VP8_PREFIX
),$(call enabled
,VP8_DX_SRCS
))
42 CODEC_EXPORTS-yes
+= $(addprefix $(VP8_PREFIX
),$(VP8_DX_EXPORTS
))
43 CODEC_SRCS-yes
+= $(VP8_PREFIX
)vp8dx.mk vpx
/vp8.h vpx
/vp8dx.h
44 INSTALL-LIBS-yes
+= include/vpx
/vp8.h
include/vpx
/vp8dx.h
45 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/$(VP8_PREFIX
)/%
46 CODEC_DOC_SRCS
+= vpx
/vp8.h vpx
/vp8dx.h
47 CODEC_DOC_SECTIONS
+= vp8 vp8_decoder
51 ifeq ($(CONFIG_ENCODERS
),yes
)
52 CODEC_DOC_SECTIONS
+= encoder
54 ifeq ($(CONFIG_DECODERS
),yes
)
55 CODEC_DOC_SECTIONS
+= decoder
59 ifeq ($(CONFIG_MSVS
),yes
)
60 CODEC_LIB
=$(if
$(CONFIG_STATIC_MSVCRT
),vpxmt
,vpxmd
)
61 # This variable uses deferred expansion intentionally, since the results of
62 # $(wildcard) may change during the course of the Make.
63 VS_PLATFORMS
= $(foreach d
,$(wildcard */Release
/$(CODEC_LIB
).lib
),$(word 1,$(subst /, ,$(d
))))
66 # The following pairs define a mapping of locations in the distribution
67 # tree to locations in the source/build trees.
68 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/vpx
/%
69 INSTALL_MAPS
+= include/vpx
/% $(SRC_PATH_BARE
)/vpx_ports
/%
70 INSTALL_MAPS
+= $(LIBSUBDIR
)/% %
71 INSTALL_MAPS
+= src
/% $(SRC_PATH_BARE
)/%
72 ifeq ($(CONFIG_MSVS
),yes
)
73 INSTALL_MAPS
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/% $(p
)/Release
/%)
74 INSTALL_MAPS
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/% $(p
)/Debug
/%)
77 # If this is a universal (fat) binary, then all the subarchitectures have
78 # already been built and our job is to stitch them together. The
79 # BUILD_LIBVPX variable indicates whether we should be building
80 # (compiling, linking) the library. The LIPO_LIBVPX variable indicates
81 # that we're stitching.
82 $(eval
$(if
$(filter universal
%,$(TOOLCHAIN
)),LIPO_LIBVPX
,BUILD_LIBVPX
):=yes
)
84 CODEC_SRCS-
$(BUILD_LIBVPX
) += build
/make
/version.sh
85 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx
/vpx_integer.h
86 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/vpx_timer.h
87 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/mem.h
88 CODEC_SRCS-
$(BUILD_LIBVPX
) += $(BUILD_PFX
)vpx_config.c
89 INSTALL-SRCS-no
+= $(BUILD_PFX
)vpx_config.c
90 ifeq ($(ARCH_X86
)$(ARCH_X86_64
),yes
)
91 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/emms.asm
92 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/x86.h
93 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/x86_abi_support.asm
94 CODEC_SRCS-
$(BUILD_LIBVPX
) += vpx_ports
/x86_cpuid.c
96 CODEC_SRCS-
$(ARCH_ARM
) += vpx_ports
/arm_cpudetect.c
97 CODEC_SRCS-
$(ARCH_ARM
) += $(BUILD_PFX
)vpx_config.asm
98 CODEC_EXPORTS-
$(BUILD_LIBVPX
) += vpx
/exports_com
99 CODEC_EXPORTS-
$(CONFIG_ENCODERS
) += vpx
/exports_enc
100 CODEC_EXPORTS-
$(CONFIG_DECODERS
) += vpx
/exports_dec
102 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec.h
103 INSTALL-LIBS-yes
+= include/vpx
/vpx_image.h
104 INSTALL-LIBS-yes
+= include/vpx
/vpx_integer.h
105 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec_impl_top.h
106 INSTALL-LIBS-yes
+= include/vpx
/vpx_codec_impl_bottom.h
107 INSTALL-LIBS-
$(CONFIG_DECODERS
) += include/vpx
/vpx_decoder.h
108 INSTALL-LIBS-
$(CONFIG_DECODERS
) += include/vpx
/vpx_decoder_compat.h
109 INSTALL-LIBS-
$(CONFIG_ENCODERS
) += include/vpx
/vpx_encoder.h
110 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
111 ifeq ($(CONFIG_MSVS
),yes
)
112 INSTALL-LIBS-yes
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/$(CODEC_LIB
).lib
)
113 INSTALL-LIBS-
$(CONFIG_DEBUG_LIBS
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/$(CODEC_LIB
)d.lib
)
114 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/vpx.dll
)
115 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/vpx.exp
)
118 INSTALL-LIBS-yes
+= $(LIBSUBDIR
)/libvpx.a
119 INSTALL-LIBS-
$(CONFIG_DEBUG_LIBS
) += $(LIBSUBDIR
)/libvpx_g.a
122 CODEC_SRCS
=$(call enabled
,CODEC_SRCS
)
123 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(CODEC_SRCS
)
124 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(call enabled
,CODEC_EXPORTS
)
126 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
127 ifeq ($(CONFIG_MSVS
),yes
)
129 vpx.def
: $(call enabled
,CODEC_EXPORTS
)
131 $(SRC_PATH_BARE
)/build
/make
/gen_msvs_def.sh\
134 CLEAN-OBJS
+= vpx.def
136 vpx.vcproj
: $(CODEC_SRCS
) vpx.def
138 $(SRC_PATH_BARE
)/build
/make
/gen_msvs_proj.sh\
140 --target
=$(TOOLCHAIN
)\
141 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
143 --proj-guid
=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74\
144 --module-def
=vpx.def\
145 --ver
=$(CONFIG_VS_VERSION
)\
146 --out
=$@
$(CFLAGS
) $^\
148 PROJECTS-
$(BUILD_LIBVPX
) += vpx.vcproj
150 vpx.vcproj
: vpx_config.asm
154 LIBVPX_OBJS
=$(call objs
,$(CODEC_SRCS
))
155 OBJS-
$(BUILD_LIBVPX
) += $(LIBVPX_OBJS
)
156 LIBS-
$(BUILD_LIBVPX
) += $(BUILD_PFX
)libvpx.a
$(BUILD_PFX
)libvpx_g.a
157 $(BUILD_PFX
)libvpx_g.a
: $(LIBVPX_OBJS
)
159 BUILD_LIBVPX_SO
:= $(if
$(BUILD_LIBVPX
),$(CONFIG_SHARED
))
160 LIBVPX_SO
:= libvpx.so.
$(VERSION_MAJOR
).
$(VERSION_MINOR
).
$(VERSION_PATCH
)
161 LIBS-
$(BUILD_LIBVPX_SO
) += $(BUILD_PFX
)$(LIBVPX_SO
)
162 $(BUILD_PFX
)$(LIBVPX_SO
): $(LIBVPX_OBJS
) libvpx.ver
163 $(BUILD_PFX
)$(LIBVPX_SO
): extralibs
+= -lm
-pthread
164 $(BUILD_PFX
)$(LIBVPX_SO
): SONAME
= libvpx.so.
$(VERSION_MAJOR
)
165 $(BUILD_PFX
)$(LIBVPX_SO
): SO_VERSION_SCRIPT
= libvpx.ver
166 LIBVPX_SO_SYMLINKS
:= $(addprefix $(LIBSUBDIR
)/, \
167 libvpx.so libvpx.so.
$(VERSION_MAJOR
) \
168 libvpx.so.
$(VERSION_MAJOR
).
$(VERSION_MINOR
))
170 libvpx.ver
: $(call enabled
,CODEC_EXPORTS
)
172 $(qexec
)echo
"{ global:" > $@
173 $(qexec
)for f in
$?
; do awk
'{print $$2";"}' < $$f >>$@
; done
174 $(qexec
)echo
"local: *; };" >> $@
175 CLEAN-OBJS
+= libvpx.ver
177 $(addprefix $(DIST_DIR
)/,$(LIBVPX_SO_SYMLINKS
)):
179 $(qexec
)ln
-sf
$(LIBVPX_SO
) $@
181 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(LIBVPX_SO_SYMLINKS
)
182 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(LIBSUBDIR
)/$(LIBVPX_SO
)
185 LIBS-
$(LIPO_LIBVPX
) += libvpx.a
186 $(eval
$(if
$(LIPO_LIBVPX
),$(call lipo_lib_template
,libvpx.a
)))
189 # Rule to make assembler configuration file from C configuration file
191 ifeq ($(ARCH_X86
)$(ARCH_X86_64
),yes
)
193 $(BUILD_PFX
)vpx_config.asm
: $(BUILD_PFX
)vpx_config.h
195 @egrep
"#define [A-Z0-9_]+ [01]" $< \
196 | awk
'{print $$2 " equ " $$3}' > $@
198 ADS2GAS
=$(if
$(filter yes
,$(CONFIG_GCC
)),|
$(ASM_CONVERSION
))
199 $(BUILD_PFX
)vpx_config.asm
: $(BUILD_PFX
)vpx_config.h
201 @egrep
"#define [A-Z0-9_]+ [01]" $< \
202 | awk
'{print $$2 " EQU " $$3}' $(ADS2GAS
) > $@
203 @echo
" END" $(ADS2GAS
) >> $@
204 CLEAN-OBJS
+= $(BUILD_PFX
)vpx_config.asm
208 # Add assembler dependencies for configuration and offsets
210 $(filter %.s.o
,$(OBJS-yes
)): $(BUILD_PFX
)vpx_config.asm
211 $(filter %.asm.o
,$(OBJS-yes
)): $(BUILD_PFX
)vpx_config.asm
214 # Calculate platform- and compiler-specific offsets for hand coded assembly
216 ifeq ($(ARCH_ARM
), yes
)
217 asm_com_offsets.asm
: obj_int_extract
218 asm_com_offsets.asm
: $(VP8_PREFIX
)common
/asm_com_offsets.c.o
219 .
/obj_int_extract rvds
$< $(ADS2GAS
) > $@
220 OBJS-yes
+= $(VP8_PREFIX
)common
/asm_com_offsets.c.o
221 CLEAN-OBJS
+= asm_com_offsets.asm
222 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)asm_com_offsets.asm
224 ifeq ($(CONFIG_VP8_ENCODER
), yes
)
225 asm_enc_offsets.asm
: obj_int_extract
226 asm_enc_offsets.asm
: $(VP8_PREFIX
)encoder
/asm_enc_offsets.c.o
227 .
/obj_int_extract rvds
$< $(ADS2GAS
) > $@
228 OBJS-yes
+= $(VP8_PREFIX
)encoder
/asm_enc_offsets.c.o
229 CLEAN-OBJS
+= asm_enc_offsets.asm
230 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)asm_enc_offsets.asm
233 ifeq ($(CONFIG_VP8_DECODER
), yes
)
234 asm_dec_offsets.asm
: obj_int_extract
235 asm_dec_offsets.asm
: $(VP8_PREFIX
)decoder
/asm_dec_offsets.c.o
236 .
/obj_int_extract rvds
$< $(ADS2GAS
) > $@
237 OBJS-yes
+= $(VP8_PREFIX
)decoder
/asm_dec_offsets.c.o
238 CLEAN-OBJS
+= asm_dec_offsets.asm
239 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)asm_dec_offsets.asm
243 $(shell $(SRC_PATH_BARE
)/build
/make
/version.sh
"$(SRC_PATH_BARE)" $(BUILD_PFX
)vpx_version.h
)
244 CLEAN-OBJS
+= $(BUILD_PFX
)vpx_version.h
246 CODEC_DOC_SRCS
+= vpx
/vpx_codec.h \
251 CLEAN-OBJS
+= libs.doxy
252 DOCS-yes
+= libs.doxy
253 libs.doxy
: $(CODEC_DOC_SRCS
)
256 @echo
"INPUT += $^" >> $@
257 @echo
"PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
258 @echo
"INCLUDE_PATH += ." >> $@
;
259 @echo
"ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@