Decoder loops refactoring
[aom.git] / libs.mk
blobda92001a70d98008ee672601f5c025a96545d6bb
1 ##
2 ## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 ##
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.
9 ##
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)
16 else
17 ASM:=.asm
18 endif
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)
33 VP8_PREFIX=vp8/
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
43 endif
45 ifeq ($(CONFIG_VP8_DECODER),yes)
46 VP8_PREFIX=vp8/
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 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
52 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
53 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h
54 CODEC_DOC_SECTIONS += vp8 vp8_decoder
55 endif
58 ifeq ($(CONFIG_ENCODERS),yes)
59 CODEC_DOC_SECTIONS += encoder
60 endif
61 ifeq ($(CONFIG_DECODERS),yes)
62 CODEC_DOC_SECTIONS += decoder
63 endif
66 ifeq ($(CONFIG_MSVS),yes)
67 CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd)
68 # This variable uses deferred expansion intentionally, since the results of
69 # $(wildcard) may change during the course of the Make.
70 VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
71 endif
73 # The following pairs define a mapping of locations in the distribution
74 # tree to locations in the source/build trees.
75 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/%
76 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/%
77 INSTALL_MAPS += $(LIBSUBDIR)/% %
78 INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
79 ifeq ($(CONFIG_MSVS),yes)
80 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%)
81 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%)
82 endif
84 # If this is a universal (fat) binary, then all the subarchitectures have
85 # already been built and our job is to stitch them together. The
86 # BUILD_LIBVPX variable indicates whether we should be building
87 # (compiling, linking) the library. The LIPO_LIBVPX variable indicates
88 # that we're stitching.
89 $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_LIBVPX,BUILD_LIBVPX):=yes)
91 CODEC_SRCS-$(BUILD_LIBVPX) += build/make/version.sh
92 CODEC_SRCS-$(BUILD_LIBVPX) += build/make/rtcd.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
104 endif
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)
125 endif
126 else
127 INSTALL-LIBS-$(CONFIG_STATIC) += $(LIBSUBDIR)/libvpx.a
128 INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
129 endif
131 CODEC_SRCS=$(filter-out %_test.cc,$(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.
138 libvpx_srcs.txt:
139 @echo " [CREATE] $@"
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 .
148 @echo " [CREATE] $@"
149 $(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
150 --exe \
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) \
156 --out=$@ $^ \
157 -I. \
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)
164 @echo " [CREATE] $@"
165 $(SRC_PATH_BARE)/build/make/gen_msvs_def.sh\
166 --name=vpx\
167 --out=$@ $^
168 CLEAN-OBJS += vpx.def
170 vpx.vcproj: $(CODEC_SRCS) vpx.def
171 @echo " [CREATE] $@"
172 $(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
173 --lib \
174 --target=$(TOOLCHAIN) \
175 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
176 --name=vpx \
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
186 vpx.vcproj: vpx_rtcd.h
188 endif
189 else
190 LIBVPX_OBJS=$(call objs,$(CODEC_SRCS))
191 OBJS-$(BUILD_LIBVPX) += $(LIBVPX_OBJS)
192 LIBS-$(if $(BUILD_LIBVPX),$(CONFIG_STATIC)) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a
193 $(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS)
195 BUILD_LIBVPX_SO := $(if $(BUILD_LIBVPX),$(CONFIG_SHARED))
196 LIBVPX_SO := libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
197 LIBS-$(BUILD_LIBVPX_SO) += $(BUILD_PFX)$(LIBVPX_SO)\
198 $(notdir $(LIBVPX_SO_SYMLINKS))
199 $(BUILD_PFX)$(LIBVPX_SO): $(LIBVPX_OBJS) libvpx.ver
200 $(BUILD_PFX)$(LIBVPX_SO): extralibs += -lm
201 $(BUILD_PFX)$(LIBVPX_SO): SONAME = libvpx.so.$(VERSION_MAJOR)
202 $(BUILD_PFX)$(LIBVPX_SO): SO_VERSION_SCRIPT = libvpx.ver
203 LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
204 libvpx.so libvpx.so.$(VERSION_MAJOR) \
205 libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR))
207 libvpx.ver: $(call enabled,CODEC_EXPORTS)
208 @echo " [CREATE] $@"
209 $(qexec)echo "{ global:" > $@
210 $(qexec)for f in $?; do awk '{print $$2";"}' < $$f >>$@; done
211 $(qexec)echo "local: *; };" >> $@
212 CLEAN-OBJS += libvpx.ver
214 define libvpx_symlink_template
215 $(1): $(2)
216 @echo " [LN] $$@"
217 $(qexec)ln -sf $(LIBVPX_SO) $$@
218 endef
220 $(eval $(call libvpx_symlink_template,\
221 $(addprefix $(BUILD_PFX),$(notdir $(LIBVPX_SO_SYMLINKS))),\
222 $(BUILD_PFX)$(LIBVPX_SO)))
223 $(eval $(call libvpx_symlink_template,\
224 $(addprefix $(DIST_DIR)/,$(LIBVPX_SO_SYMLINKS)),\
225 $(DIST_DIR)/$(LIBSUBDIR)/$(LIBVPX_SO)))
227 INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBVPX_SO_SYMLINKS)
228 INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBSUBDIR)/$(LIBVPX_SO)
230 LIBS-$(BUILD_LIBVPX) += vpx.pc
231 vpx.pc: config.mk libs.mk
232 @echo " [CREATE] $@"
233 $(qexec)echo '# pkg-config file from libvpx $(VERSION_STRING)' > $@
234 $(qexec)echo 'prefix=$(PREFIX)' >> $@
235 $(qexec)echo 'exec_prefix=$${prefix}' >> $@
236 $(qexec)echo 'libdir=$${prefix}/lib' >> $@
237 $(qexec)echo 'includedir=$${prefix}/include' >> $@
238 $(qexec)echo '' >> $@
239 $(qexec)echo 'Name: vpx' >> $@
240 $(qexec)echo 'Description: WebM Project VPx codec implementation' >> $@
241 $(qexec)echo 'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
242 $(qexec)echo 'Requires:' >> $@
243 $(qexec)echo 'Conflicts:' >> $@
244 $(qexec)echo 'Libs: -L$${libdir} -lvpx' >> $@
245 $(qexec)echo 'Cflags: -I$${includedir}' >> $@
246 INSTALL-LIBS-yes += $(LIBSUBDIR)/pkgconfig/vpx.pc
247 INSTALL_MAPS += $(LIBSUBDIR)/pkgconfig/%.pc %.pc
248 CLEAN-OBJS += vpx.pc
249 endif
251 LIBS-$(LIPO_LIBVPX) += libvpx.a
252 $(eval $(if $(LIPO_LIBVPX),$(call lipo_lib_template,libvpx.a)))
255 # Rule to make assembler configuration file from C configuration file
257 ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
258 # YASM
259 $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
260 @echo " [CREATE] $@"
261 @egrep "#define [A-Z0-9_]+ [01]" $< \
262 | awk '{print $$2 " equ " $$3}' > $@
263 else
264 ADS2GAS=$(if $(filter yes,$(CONFIG_GCC)),| $(ASM_CONVERSION))
265 $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
266 @echo " [CREATE] $@"
267 @egrep "#define [A-Z0-9_]+ [01]" $< \
268 | awk '{print $$2 " EQU " $$3}' $(ADS2GAS) > $@
269 @echo " END" $(ADS2GAS) >> $@
270 CLEAN-OBJS += $(BUILD_PFX)vpx_config.asm
271 endif
274 # Add assembler dependencies for configuration and offsets
276 $(filter %.s.o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
277 $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
280 # Calculate platform- and compiler-specific offsets for hand coded assembly
283 OFFSET_PATTERN:='^[a-zA-Z0-9_]* EQU'
285 ifeq ($(filter icc gcc,$(TGT_CC)), $(TGT_CC))
286 $(BUILD_PFX)asm_com_offsets.asm: $(BUILD_PFX)$(VP8_PREFIX)common/asm_com_offsets.c.S
287 grep $(OFFSET_PATTERN) $< | tr -d '$$\#' $(ADS2GAS) > $@
288 $(BUILD_PFX)$(VP8_PREFIX)common/asm_com_offsets.c.S: $(VP8_PREFIX)common/asm_com_offsets.c
289 CLEAN-OBJS += $(BUILD_PFX)asm_com_offsets.asm $(BUILD_PFX)$(VP8_PREFIX)common/asm_com_offsets.c.S
291 $(BUILD_PFX)asm_enc_offsets.asm: $(BUILD_PFX)$(VP8_PREFIX)encoder/asm_enc_offsets.c.S
292 grep $(OFFSET_PATTERN) $< | tr -d '$$\#' $(ADS2GAS) > $@
293 $(BUILD_PFX)$(VP8_PREFIX)encoder/asm_enc_offsets.c.S: $(VP8_PREFIX)encoder/asm_enc_offsets.c
294 CLEAN-OBJS += $(BUILD_PFX)asm_enc_offsets.asm $(BUILD_PFX)$(VP8_PREFIX)encoder/asm_enc_offsets.c.S
296 $(BUILD_PFX)asm_dec_offsets.asm: $(BUILD_PFX)$(VP8_PREFIX)decoder/asm_dec_offsets.c.S
297 grep $(OFFSET_PATTERN) $< | tr -d '$$\#' $(ADS2GAS) > $@
298 $(BUILD_PFX)$(VP8_PREFIX)decoder/asm_dec_offsets.c.S: $(VP8_PREFIX)decoder/asm_dec_offsets.c
299 CLEAN-OBJS += $(BUILD_PFX)asm_dec_offsets.asm $(BUILD_PFX)$(VP8_PREFIX)decoder/asm_dec_offsets.c.S
300 else
301 ifeq ($(filter rvct,$(TGT_CC)), $(TGT_CC))
302 asm_com_offsets.asm: obj_int_extract
303 asm_com_offsets.asm: $(VP8_PREFIX)common/asm_com_offsets.c.o
304 ./obj_int_extract rvds $< $(ADS2GAS) > $@
305 OBJS-yes += $(VP8_PREFIX)common/asm_com_offsets.c.o
306 CLEAN-OBJS += asm_com_offsets.asm
307 $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_com_offsets.asm
309 asm_enc_offsets.asm: obj_int_extract
310 asm_enc_offsets.asm: $(VP8_PREFIX)encoder/asm_enc_offsets.c.o
311 ./obj_int_extract rvds $< $(ADS2GAS) > $@
312 OBJS-yes += $(VP8_PREFIX)encoder/asm_enc_offsets.c.o
313 CLEAN-OBJS += asm_enc_offsets.asm
314 $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_enc_offsets.asm
316 asm_dec_offsets.asm: obj_int_extract
317 asm_dec_offsets.asm: $(VP8_PREFIX)decoder/asm_dec_offsets.c.o
318 ./obj_int_extract rvds $< $(ADS2GAS) > $@
319 OBJS-yes += $(VP8_PREFIX)decoder/asm_dec_offsets.c.o
320 CLEAN-OBJS += asm_dec_offsets.asm
321 $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_dec_offsets.asm
322 endif
323 endif
325 $(shell $(SRC_PATH_BARE)/build/make/version.sh "$(SRC_PATH_BARE)" $(BUILD_PFX)vpx_version.h)
326 CLEAN-OBJS += $(BUILD_PFX)vpx_version.h
329 # Rule to generate runtime cpu detection files
331 $(OBJS-yes:.o=.d): vpx_rtcd.h
332 vpx_rtcd.h: $(SRC_PATH_BARE)/$(sort $(filter %rtcd_defs.sh,$(CODEC_SRCS)))
333 @echo " [CREATE] $@"
334 $(qexec)$(SRC_PATH_BARE)/build/make/rtcd.sh --arch=$(TGT_ISA) \
335 --sym=vpx_rtcd \
336 --config=$(target)$(if $(FAT_ARCHS),,-$(TOOLCHAIN)).mk \
337 $(RTCD_OPTIONS) $^ > $@
338 CLEAN-OBJS += $(BUILD_PFX)vpx_rtcd.h
340 CODEC_DOC_SRCS += vpx/vpx_codec.h \
341 vpx/vpx_decoder.h \
342 vpx/vpx_encoder.h \
343 vpx/vpx_image.h
346 ## libvpx test directives
349 ifeq ($(CONFIG_UNIT_TESTS),yes)
350 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
351 ifeq ($(CONFIG_MSVS),yes)
353 LIBVPX_TEST_SRCS=$(filter %_test.cc,$(call enabled,CODEC_SRCS))
354 LIBVPX_TEST_BINS=$(sort $(LIBVPX_TEST_SRCS:.cc.o=))
356 gtest.vcproj: $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc
357 @echo " [CREATE] $@"
358 $(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh \
359 --lib \
360 --target=$(TOOLCHAIN) \
361 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
362 --name=gtest \
363 --proj-guid=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \
364 --ver=$(CONFIG_VS_VERSION) \
365 --src-path-bare="$(SRC_PATH_BARE)" \
366 --out=gtest.vcproj $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \
367 -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I"$(SRC_PATH_BARE)/third_party/googletest/src"
369 PROJECTS-$(CONFIG_MSVS) += gtest.vcproj
371 define unit_test_vcproj_template
372 $(notdir $(1:.cc=.vcproj)): $(SRC_PATH_BARE)/$(1)
373 @echo " [vcproj] $$@"
374 $$(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh\
375 --exe\
376 --target=$$(TOOLCHAIN)\
377 --name=$(notdir $(1:.cc=))\
378 --ver=$$(CONFIG_VS_VERSION)\
379 $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
380 --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
381 -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
382 -L. -lvpxmt -lwinmm -lgtestmt $$^
383 endef
385 $(foreach proj,$(LIBVPX_TEST_BINS),\
386 $(eval $(call unit_test_vcproj_template,$(proj))))
388 PROJECTS-$(CONFIG_MSVS) += $(foreach proj,$(LIBVPX_TEST_BINS),\
389 $(notdir $(proj:.cc=.vcproj)))
391 test::
392 @set -e; for t in $(addprefix Win32/Release/,$(notdir $(LIBVPX_TEST_BINS:.cc=.exe))); do $$t; done
393 endif
394 else
396 include $(SRC_PATH_BARE)/third_party/googletest/gtest.mk
397 GTEST_SRCS := $(addprefix third_party/googletest/src/,$(call enabled,GTEST_SRCS))
398 GTEST_OBJS=$(call objs,$(GTEST_SRCS))
399 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
400 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
401 OBJS-$(BUILD_LIBVPX) += $(GTEST_OBJS)
402 LIBS-$(BUILD_LIBVPX) += $(BUILD_PFX)libgtest.a $(BUILD_PFX)libgtest_g.a
403 $(BUILD_PFX)libgtest_g.a: $(GTEST_OBJS)
405 LIBVPX_TEST_SRCS=$(filter %_test.cc,$(call enabled,CODEC_SRCS))
406 LIBVPX_TEST_OBJS=$(call objs,$(LIBVPX_TEST_SRCS))
407 $(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src
408 $(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CFLAGS += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
409 LIBVPX_TEST_BINS=$(sort $(LIBVPX_TEST_OBJS:.cc.o=))
410 OBJS-$(BUILD_LIBVPX) += $(LIBVPX_TEST_OBJS)
412 $(foreach bin,$(LIBVPX_TEST_BINS),\
413 $(if $(BUILD_LIBVPX),$(eval $(bin): libvpx.a libgtest.a ))\
414 $(if $(BUILD_LIBVPX),$(eval $(call linkerxx_template,$(bin),\
415 $(bin).cc.o \
416 -L. -lvpx -lgtest -lpthread -lm)\
417 )))\
418 $(if $(LIPO_LIBS),$(eval $(call lipo_bin_template,$(bin))))\
420 test:: $(LIBVPX_TEST_BINS)
421 @set -e; for t in $(LIBVPX_TEST_BINS); do $$t; done
423 endif
424 endif
427 ## documentation directives
429 CLEAN-OBJS += libs.doxy
430 DOCS-yes += libs.doxy
431 libs.doxy: $(CODEC_DOC_SRCS)
432 @echo " [CREATE] $@"
433 @rm -f $@
434 @echo "INPUT += $^" >> $@
435 @echo "PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
436 @echo "INCLUDE_PATH += ." >> $@;
437 @echo "ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@