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)
22 # Calculate platform- and compiler-specific offsets for hand coded assembly
24 ifeq ($(filter icc gcc,$(TGT_CC)), $(TGT_CC))
25 OFFSET_PATTERN:='^[a-zA-Z0-9_]* EQU'
26 define asm_offsets_template
27 $$(BUILD_PFX)$(1): $$(BUILD_PFX)$(2).S
29 $$(qexec)LC_ALL=C grep $$(OFFSET_PATTERN) $$< | tr -d '$$$$\#' $$(ADS2GAS) > $$@
30 $$(BUILD_PFX)$(2).S: $(2)
31 CLEAN-OBJS += $$(BUILD_PFX)$(1) $(2).S
34 ifeq ($(filter rvct,$(TGT_CC)), $(TGT_CC))
35 define asm_offsets_template
36 $$(BUILD_PFX)$(1): obj_int_extract
37 $$(BUILD_PFX)$(1): $$(BUILD_PFX)$(2).o
39 $$(qexec)./obj_int_extract rvds $$< $$(ADS2GAS) > $$@
40 OBJS-yes += $$(BUILD_PFX)$(2).o
41 CLEAN-OBJS += $$(BUILD_PFX)$(1)
42 $$(filter %$$(ASM).o,$$(OBJS-yes)): $$(BUILD_PFX)$(1)
48 CODEC_SRCS-yes += CHANGELOG
49 CODEC_SRCS-yes += libs.mk
51 include $(SRC_PATH_BARE)/vpx/vpx_codec.mk
52 CODEC_SRCS-yes += $(addprefix vpx/,$(call enabled,API_SRCS))
54 include $(SRC_PATH_BARE)/vpx_mem/vpx_mem.mk
55 CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS))
57 include $(SRC_PATH_BARE)/vpx_scale/vpx_scale.mk
58 CODEC_SRCS-yes += $(addprefix vpx_scale/,$(call enabled,SCALE_SRCS))
60 ifneq ($(CONFIG_VP8_ENCODER)$(CONFIG_VP8_DECODER),)
62 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8_common.mk
65 ifeq ($(CONFIG_VP8_ENCODER),yes)
66 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk
67 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
68 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))
69 CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk vpx/vp8.h vpx/vp8cx.h
70 CODEC_SRCS-$(ARCH_ARM) += $(VP8_PREFIX)vp88cx_arm.mk
71 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
72 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
73 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
74 CODEC_DOC_SECTIONS += vp8 vp8_encoder
77 ifeq ($(CONFIG_VP8_DECODER),yes)
78 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8dx.mk
79 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_DX_SRCS))
80 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_DX_EXPORTS))
81 CODEC_SRCS-yes += $(VP8_PREFIX)vp8dx.mk vpx/vp8.h vpx/vp8dx.h
82 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
83 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
84 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h
85 CODEC_DOC_SECTIONS += vp8 vp8_decoder
88 ifneq ($(CONFIG_VP9_ENCODER)$(CONFIG_VP9_DECODER),)
90 include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9_common.mk
93 ifeq ($(CONFIG_VP9_ENCODER),yes)
95 include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9cx.mk
96 CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_CX_SRCS))
97 CODEC_EXPORTS-yes += $(addprefix $(VP9_PREFIX),$(VP9_CX_EXPORTS))
98 CODEC_SRCS-yes += $(VP9_PREFIX)vp9cx.mk vpx/vp8.h vpx/vp8cx.h
99 CODEC_SRCS-$(ARCH_ARM) += $(VP9_PREFIX)vp98cx_arm.mk
100 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h
101 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP9_PREFIX)/%
102 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
103 CODEC_DOC_SECTIONS += vp9 vp9_encoder
106 ifeq ($(CONFIG_VP9_DECODER),yes)
108 include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9dx.mk
109 CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_DX_SRCS))
110 CODEC_EXPORTS-yes += $(addprefix $(VP9_PREFIX),$(VP9_DX_EXPORTS))
111 CODEC_SRCS-yes += $(VP9_PREFIX)vp9dx.mk vpx/vp8.h vpx/vp8dx.h
112 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
113 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP9_PREFIX)/%
114 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h
115 CODEC_DOC_SECTIONS += vp9 vp9_decoder
119 ifeq ($(CONFIG_ENCODERS),yes)
120 CODEC_DOC_SECTIONS += encoder
122 ifeq ($(CONFIG_DECODERS),yes)
123 CODEC_DOC_SECTIONS += decoder
127 ifeq ($(CONFIG_MSVS),yes)
128 CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd)
129 GTEST_LIB=$(if $(CONFIG_STATIC_MSVCRT),gtestmt,gtestmd)
130 # This variable uses deferred expansion intentionally, since the results of
131 # $(wildcard) may change during the course of the Make.
132 VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
135 # The following pairs define a mapping of locations in the distribution
136 # tree to locations in the source/build trees.
137 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/%
138 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/%
139 INSTALL_MAPS += $(LIBSUBDIR)/% %
140 INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
141 ifeq ($(CONFIG_MSVS),yes)
142 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%)
143 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%)
146 # If this is a universal (fat) binary, then all the subarchitectures have
147 # already been built and our job is to stitch them together. The
148 # BUILD_LIBVPX variable indicates whether we should be building
149 # (compiling, linking) the library. The LIPO_LIBVPX variable indicates
150 # that we're stitching.
151 $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_LIBVPX,BUILD_LIBVPX):=yes)
153 CODEC_SRCS-$(BUILD_LIBVPX) += build/make/version.sh
154 CODEC_SRCS-$(BUILD_LIBVPX) += build/make/rtcd.sh
155 CODEC_SRCS-$(BUILD_LIBVPX) += vpx/vpx_integer.h
156 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/asm_offsets.h
157 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/vpx_timer.h
158 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/mem.h
159 CODEC_SRCS-$(BUILD_LIBVPX) += $(BUILD_PFX)vpx_config.c
160 INSTALL-SRCS-no += $(BUILD_PFX)vpx_config.c
161 ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
162 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/emms.asm
163 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86.h
164 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86_abi_support.asm
165 CODEC_SRCS-$(BUILD_LIBVPX) += third_party/x86inc/x86inc.asm
166 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86_cpuid.c
168 CODEC_SRCS-$(ARCH_ARM) += vpx_ports/arm_cpudetect.c
169 CODEC_SRCS-$(ARCH_ARM) += vpx_ports/arm.h
170 CODEC_EXPORTS-$(BUILD_LIBVPX) += vpx/exports_com
171 CODEC_EXPORTS-$(CONFIG_ENCODERS) += vpx/exports_enc
172 CODEC_EXPORTS-$(CONFIG_DECODERS) += vpx/exports_dec
174 INSTALL-LIBS-yes += include/vpx/vpx_codec.h
175 INSTALL-LIBS-yes += include/vpx/vpx_image.h
176 INSTALL-LIBS-yes += include/vpx/vpx_integer.h
177 INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_top.h
178 INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_bottom.h
179 INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h
180 INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
181 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
182 ifeq ($(CONFIG_MSVS),yes)
183 INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib)
184 INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB)d.lib)
185 INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.dll)
186 INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.exp)
189 INSTALL-LIBS-$(CONFIG_STATIC) += $(LIBSUBDIR)/libvpx.a
190 INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
193 CODEC_SRCS=$(filter-out %_test.cc,$(call enabled,CODEC_SRCS))
194 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(CODEC_SRCS)
195 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(call enabled,CODEC_EXPORTS)
198 # Generate a list of all enabled sources, in particular for exporting to gyp
199 # based build systems.
202 @echo $(CODEC_SRCS) | xargs -n1 echo | sort -u > $@
205 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
206 ifeq ($(CONFIG_MSVS),yes)
208 obj_int_extract.vcproj: $(SRC_PATH_BARE)/build/make/obj_int_extract.c
209 @cp $(SRC_PATH_BARE)/build/x86-msvs/obj_int_extract.bat .
211 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
213 --target=$(TOOLCHAIN) \
214 --name=obj_int_extract \
215 --ver=$(CONFIG_VS_VERSION) \
216 --proj-guid=E1360C65-D375-4335-8057-7ED99CC3F9B2 \
217 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
220 -I"$(SRC_PATH_BARE)" \
222 PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.vcproj
223 PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.bat
225 vpx.def: $(call enabled,CODEC_EXPORTS)
227 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_def.sh\
230 CLEAN-OBJS += vpx.def
232 vpx.vcproj: $(CODEC_SRCS) vpx.def
234 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
235 $(if $(CONFIG_SHARED),--dll,--lib) \
236 --target=$(TOOLCHAIN) \
237 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
239 --proj-guid=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74 \
240 --module-def=vpx.def \
241 --ver=$(CONFIG_VS_VERSION) \
242 --out=$@ $(CFLAGS) $^ \
243 --src-path-bare="$(SRC_PATH_BARE)" \
245 PROJECTS-$(BUILD_LIBVPX) += vpx.vcproj
247 vpx.vcproj: vpx_config.asm
248 vpx.vcproj: vpx_rtcd.h
252 LIBVPX_OBJS=$(call objs,$(CODEC_SRCS))
253 OBJS-$(BUILD_LIBVPX) += $(LIBVPX_OBJS)
254 LIBS-$(if $(BUILD_LIBVPX),$(CONFIG_STATIC)) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a
255 $(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS)
258 BUILD_LIBVPX_SO := $(if $(BUILD_LIBVPX),$(CONFIG_SHARED))
260 ifeq ($(filter darwin%,$(TGT_OS)),$(TGT_OS))
261 LIBVPX_SO := libvpx.$(VERSION_MAJOR).dylib
262 EXPORT_FILE := libvpx.syms
263 LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
266 LIBVPX_SO := libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
267 EXPORT_FILE := libvpx.ver
268 SYM_LINK := libvpx.so
269 LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
270 libvpx.so libvpx.so.$(VERSION_MAJOR) \
271 libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR))
274 LIBS-$(BUILD_LIBVPX_SO) += $(BUILD_PFX)$(LIBVPX_SO)\
275 $(notdir $(LIBVPX_SO_SYMLINKS))
276 $(BUILD_PFX)$(LIBVPX_SO): $(LIBVPX_OBJS) $(EXPORT_FILE)
277 $(BUILD_PFX)$(LIBVPX_SO): extralibs += -lm
278 $(BUILD_PFX)$(LIBVPX_SO): SONAME = libvpx.so.$(VERSION_MAJOR)
279 $(BUILD_PFX)$(LIBVPX_SO): EXPORTS_FILE = $(EXPORT_FILE)
281 libvpx.ver: $(call enabled,CODEC_EXPORTS)
283 $(qexec)echo "{ global:" > $@
284 $(qexec)for f in $?; do awk '{print $$2";"}' < $$f >>$@; done
285 $(qexec)echo "local: *; };" >> $@
286 CLEAN-OBJS += libvpx.ver
288 libvpx.syms: $(call enabled,CODEC_EXPORTS)
290 $(qexec)awk '{print "_"$$2}' $^ >$@
291 CLEAN-OBJS += libvpx.syms
293 define libvpx_symlink_template
295 @echo " [LN] $(2) $$@"
296 $(qexec)ln -sf $(2) $$@
299 $(eval $(call libvpx_symlink_template,\
300 $(addprefix $(BUILD_PFX),$(notdir $(LIBVPX_SO_SYMLINKS))),\
301 $(BUILD_PFX)$(LIBVPX_SO)))
302 $(eval $(call libvpx_symlink_template,\
303 $(addprefix $(DIST_DIR)/,$(LIBVPX_SO_SYMLINKS)),\
304 $(DIST_DIR)/$(LIBSUBDIR)/$(LIBVPX_SO)))
307 INSTALL-LIBS-$(BUILD_LIBVPX_SO) += $(LIBVPX_SO_SYMLINKS)
308 INSTALL-LIBS-$(BUILD_LIBVPX_SO) += $(LIBSUBDIR)/$(LIBVPX_SO)
311 LIBS-$(BUILD_LIBVPX) += vpx.pc
312 vpx.pc: config.mk libs.mk
314 $(qexec)echo '# pkg-config file from libvpx $(VERSION_STRING)' > $@
315 $(qexec)echo 'prefix=$(PREFIX)' >> $@
316 $(qexec)echo 'exec_prefix=$${prefix}' >> $@
317 $(qexec)echo 'libdir=$${prefix}/$(LIBSUBDIR)' >> $@
318 $(qexec)echo 'includedir=$${prefix}/include' >> $@
319 $(qexec)echo '' >> $@
320 $(qexec)echo 'Name: vpx' >> $@
321 $(qexec)echo 'Description: WebM Project VPx codec implementation' >> $@
322 $(qexec)echo 'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
323 $(qexec)echo 'Requires:' >> $@
324 $(qexec)echo 'Conflicts:' >> $@
325 $(qexec)echo 'Libs: -L$${libdir} -lvpx -lm' >> $@
326 $(qexec)echo 'Libs.private: -lm -lpthread' >> $@
327 $(qexec)echo 'Cflags: -I$${includedir}' >> $@
328 INSTALL-LIBS-yes += $(LIBSUBDIR)/pkgconfig/vpx.pc
329 INSTALL_MAPS += $(LIBSUBDIR)/pkgconfig/%.pc %.pc
333 LIBS-$(LIPO_LIBVPX) += libvpx.a
334 $(eval $(if $(LIPO_LIBVPX),$(call lipo_lib_template,libvpx.a)))
337 # Rule to make assembler configuration file from C configuration file
339 ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
341 $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
343 @egrep "#define [A-Z0-9_]+ [01]" $< \
344 | awk '{print $$2 " equ " $$3}' > $@
346 ADS2GAS=$(if $(filter yes,$(CONFIG_GCC)),| $(ASM_CONVERSION))
347 $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
349 @egrep "#define [A-Z0-9_]+ [01]" $< \
350 | awk '{print $$2 " EQU " $$3}' $(ADS2GAS) > $@
351 @echo " END" $(ADS2GAS) >> $@
352 CLEAN-OBJS += $(BUILD_PFX)vpx_config.asm
356 # Add assembler dependencies for configuration and offsets
358 $(filter %.s.o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
359 $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
362 $(shell $(SRC_PATH_BARE)/build/make/version.sh "$(SRC_PATH_BARE)" $(BUILD_PFX)vpx_version.h)
363 CLEAN-OBJS += $(BUILD_PFX)vpx_version.h
366 # Rule to generate runtime cpu detection files
368 $(BUILD_PFX)vpx_rtcd.h: $(SRC_PATH_BARE)/$(sort $(filter %rtcd_defs.sh,$(CODEC_SRCS)))
370 $(qexec)$(SRC_PATH_BARE)/build/make/rtcd.sh --arch=$(TGT_ISA) \
372 --config=$(target)$(if $(FAT_ARCHS),,-$(TOOLCHAIN)).mk \
373 $(RTCD_OPTIONS) $^ > $@
374 CLEAN-OBJS += $(BUILD_PFX)vpx_rtcd.h
377 CODEC_DOC_SRCS += vpx/vpx_codec.h \
383 ## libvpx test directives
385 ifeq ($(CONFIG_UNIT_TESTS),yes)
386 LIBVPX_TEST_DATA_PATH ?= .
388 include $(SRC_PATH_BARE)/test/test.mk
389 LIBVPX_TEST_SRCS=$(addprefix test/,$(call enabled,LIBVPX_TEST_SRCS))
390 LIBVPX_TEST_BINS=./test_libvpx
391 LIBVPX_TEST_DATA=$(addprefix $(LIBVPX_TEST_DATA_PATH)/,\
392 $(call enabled,LIBVPX_TEST_DATA))
393 libvpx_test_data_url=http://downloads.webmproject.org/test_data/libvpx/$(1)
396 @echo " [DOWNLOAD] $@"
397 $(qexec)trap 'rm -f $@' INT TERM &&\
398 curl -L -o $@ $(call libvpx_test_data_url,$(@F))
400 testdata:: $(LIBVPX_TEST_DATA)
401 $(qexec)if [ -x "$$(which sha1sum)" ]; then\
402 echo "Checking test data:";\
403 if [ -n "$(LIBVPX_TEST_DATA)" ]; then\
404 for f in $(call enabled,LIBVPX_TEST_DATA); do\
405 grep $$f $(SRC_PATH_BARE)/test/test-data.sha1 |\
406 (cd $(LIBVPX_TEST_DATA_PATH); sha1sum -c);\
410 echo "Skipping test data integrity check, sha1sum not found.";\
413 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
414 ifeq ($(CONFIG_MSVS),yes)
416 gtest.vcproj: $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc
418 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
420 --target=$(TOOLCHAIN) \
421 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
423 --proj-guid=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \
424 --ver=$(CONFIG_VS_VERSION) \
425 --src-path-bare="$(SRC_PATH_BARE)" \
426 --out=gtest.vcproj $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \
427 -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I"$(SRC_PATH_BARE)/third_party/googletest/src"
429 PROJECTS-$(CONFIG_MSVS) += gtest.vcproj
431 test_libvpx.vcproj: $(LIBVPX_TEST_SRCS)
433 $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
435 --target=$(TOOLCHAIN) \
437 --proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \
438 --ver=$(CONFIG_VS_VERSION) \
439 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
440 --out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \
441 -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
442 -L. -l$(CODEC_LIB) -lwinmm -l$(GTEST_LIB) $^
444 PROJECTS-$(CONFIG_MSVS) += test_libvpx.vcproj
447 @set -e; for t in $(addprefix Win32/Release/,$(notdir $(LIBVPX_TEST_BINS:.cc=.exe))); do $$t; done
451 include $(SRC_PATH_BARE)/third_party/googletest/gtest.mk
452 GTEST_SRCS := $(addprefix third_party/googletest/src/,$(call enabled,GTEST_SRCS))
453 GTEST_OBJS=$(call objs,$(GTEST_SRCS))
454 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
455 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
456 OBJS-$(BUILD_LIBVPX) += $(GTEST_OBJS)
457 LIBS-$(BUILD_LIBVPX) += $(BUILD_PFX)libgtest.a $(BUILD_PFX)libgtest_g.a
458 $(BUILD_PFX)libgtest_g.a: $(GTEST_OBJS)
460 LIBVPX_TEST_OBJS=$(sort $(call objs,$(LIBVPX_TEST_SRCS)))
461 $(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
462 $(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
463 OBJS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_OBJS)
464 BINS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_BINS)
466 # Install test sources only if codec source is included
467 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(patsubst $(SRC_PATH_BARE)/%,%,\
468 $(shell find $(SRC_PATH_BARE)/third_party/googletest -type f))
469 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(LIBVPX_TEST_SRCS)
471 CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx)
472 CODEC_LIB_SUF=$(if $(CONFIG_SHARED),.so,.a)
473 $(foreach bin,$(LIBVPX_TEST_BINS),\
474 $(if $(BUILD_LIBVPX),$(eval $(bin): \
475 lib$(CODEC_LIB)$(CODEC_LIB_SUF) libgtest.a ))\
476 $(if $(BUILD_LIBVPX),$(eval $(call linkerxx_template,$(bin),\
477 $(LIBVPX_TEST_OBJS) \
478 -L. -lvpx -lgtest -lpthread -lm)\
480 $(if $(LIPO_LIBS),$(eval $(call lipo_bin_template,$(bin))))\
482 test:: $(LIBVPX_TEST_BINS) testdata
483 @set -e; for t in $(LIBVPX_TEST_BINS); do $$t; done
489 ## documentation directives
491 CLEAN-OBJS += libs.doxy
492 DOCS-yes += libs.doxy
493 libs.doxy: $(CODEC_DOC_SRCS)
496 @echo "INPUT += $^" >> $@
497 @echo "PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
498 @echo "INCLUDE_PATH += ." >> $@;
499 @echo "ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@
501 ## Generate vpx_rtcd.h for all objects
502 $(OBJS-yes:.o=.d): $(BUILD_PFX)vpx_rtcd.h