2 ## Copyright (c) 2016, Alliance for Open Media. All rights reserved
4 ## This source code is subject to the terms of the BSD 2 Clause License and
5 ## the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
6 ## was not distributed with this source code in the LICENSE file, you can
7 ## obtain it at www.aomedia.org/license/software. If the Alliance for Open
8 ## Media Patent License 1.0 was not distributed with this source code in the
9 ## PATENTS file, you can obtain it at www.aomedia.org/license/patent.
13 # ARM assembly files are written in RVCT-style. We use some make magic to
14 # filter those files to allow GCC compilation
15 ifeq ($(ARCH_ARM
),yes
)
16 ASM
:=$(if
$(filter yes
,$(CONFIG_GCC
)$(CONFIG_MSVS
)),.asm.s
,.asm
)
22 # Rule to generate runtime cpu detection files
24 define rtcd_h_template
25 $$(BUILD_PFX
)$(1).h
: $$(SRC_PATH_BARE
)/$(2)
27 $$(qexec
)$$(SRC_PATH_BARE
)/build
/make
/rtcd.pl
--arch
=$$(TGT_ISA
) \
29 --config
=$$(CONFIG_DIR
)$$(target
)-$$(TOOLCHAIN
).mk \
30 $$(RTCD_OPTIONS
) $$^
> $$@
31 CLEAN-OBJS
+= $$(BUILD_PFX
)$(1).h
32 RTCD
+= $$(BUILD_PFX
)$(1).h
35 CODEC_SRCS-yes
+= CHANGELOG
36 CODEC_SRCS-yes
+= libs.mk
38 include $(SRC_PATH_BARE
)/aom
/aom_codec.mk
39 CODEC_SRCS-yes
+= $(addprefix aom
/,$(call enabled
,API_SRCS
))
40 CODEC_DOC_SRCS
+= $(addprefix aom
/,$(call enabled
,API_DOC_SRCS
))
42 include $(SRC_PATH_BARE
)/aom_mem
/aom_mem.mk
43 CODEC_SRCS-yes
+= $(addprefix aom_mem
/,$(call enabled
,MEM_SRCS
))
45 include $(SRC_PATH_BARE
)/aom_scale
/aom_scale.mk
46 CODEC_SRCS-yes
+= $(addprefix aom_scale
/,$(call enabled
,SCALE_SRCS
))
48 include $(SRC_PATH_BARE
)/aom_ports
/aom_ports.mk
49 CODEC_SRCS-yes
+= $(addprefix aom_ports
/,$(call enabled
,PORTS_SRCS
))
51 include $(SRC_PATH_BARE
)/aom_dsp
/aom_dsp.mk
52 CODEC_SRCS-yes
+= $(addprefix aom_dsp
/,$(call enabled
,DSP_SRCS
))
54 include $(SRC_PATH_BARE
)/aom_util
/aom_util.mk
55 CODEC_SRCS-yes
+= $(addprefix aom_util
/,$(call enabled
,UTIL_SRCS
))
58 ifeq ($(CONFIG_AV1
),yes
)
60 include $(SRC_PATH_BARE
)/$(AV1_PREFIX
)av1_common.mk
63 ifeq ($(CONFIG_AV1_ENCODER
),yes
)
65 include $(SRC_PATH_BARE
)/$(AV1_PREFIX
)av1_cx.mk
66 CODEC_SRCS-yes
+= $(addprefix $(AV1_PREFIX
),$(call enabled
,AV1_CX_SRCS
))
67 CODEC_EXPORTS-yes
+= $(addprefix $(AV1_PREFIX
),$(AV1_CX_EXPORTS
))
68 CODEC_SRCS-yes
+= $(AV1_PREFIX
)av1_cx.mk aom
/aom.h aom
/aomcx.h
69 INSTALL-LIBS-yes
+= include/aom
/aom.h
include/aom
/aomcx.h
70 INSTALL_MAPS
+= include/aom
/% $(SRC_PATH_BARE
)/$(AV1_PREFIX
)/%
71 CODEC_DOC_SRCS
+= aom
/aom.h aom
/aomcx.h
72 CODEC_DOC_SECTIONS
+= av1 av1_encoder encoder
75 ifeq ($(CONFIG_AV1_DECODER
),yes
)
77 include $(SRC_PATH_BARE
)/$(AV1_PREFIX
)av1_dx.mk
78 CODEC_SRCS-yes
+= $(addprefix $(AV1_PREFIX
),$(call enabled
,AV1_DX_SRCS
))
79 CODEC_EXPORTS-yes
+= $(addprefix $(AV1_PREFIX
),$(AV1_DX_EXPORTS
))
80 CODEC_SRCS-yes
+= $(AV1_PREFIX
)av1_dx.mk aom
/aom.h aom
/aomdx.h
81 INSTALL-LIBS-yes
+= include/aom
/aom.h
include/aom
/aomdx.h
82 INSTALL_MAPS
+= include/aom
/% $(SRC_PATH_BARE
)/$(AV1_PREFIX
)/%
83 CODEC_DOC_SRCS
+= aom
/aom.h aom
/aomdx.h
84 CODEC_DOC_SECTIONS
+= av1 av1_decoder decoder
88 $(BUILD_PFX
)$(AV1_PREFIX
)%.c.o
: CFLAGS
+= -Wextra
90 ifeq ($(CONFIG_MSVS
),yes
)
91 CODEC_LIB
=$(if
$(CONFIG_STATIC_MSVCRT
),aommt
,aommd
)
92 GTEST_LIB
=$(if
$(CONFIG_STATIC_MSVCRT
),gtestmt
,gtestmd
)
93 # This variable uses deferred expansion intentionally, since the results of
94 # $(wildcard) may change during the course of the Make.
95 VS_PLATFORMS
= $(foreach d
,$(wildcard */Release
/$(CODEC_LIB
).lib
),$(word 1,$(subst /, ,$(d
))))
98 # The following pairs define a mapping of locations in the distribution
99 # tree to locations in the source/build trees.
100 INSTALL_MAPS
+= include/aom
/% $(SRC_PATH_BARE
)/aom
/%
101 INSTALL_MAPS
+= include/aom
/% $(SRC_PATH_BARE
)/aom_ports
/%
102 INSTALL_MAPS
+= $(LIBSUBDIR
)/% %
103 INSTALL_MAPS
+= src
/% $(SRC_PATH_BARE
)/%
104 ifeq ($(CONFIG_MSVS
),yes
)
105 INSTALL_MAPS
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/% $(p
)/Release
/%)
106 INSTALL_MAPS
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/% $(p
)/Debug
/%)
109 CODEC_SRCS-yes
+= build
/make
/version.sh
110 CODEC_SRCS-yes
+= build
/make
/rtcd.pl
111 CODEC_SRCS-yes
+= aom_ports
/emmintrin_compat.h
112 CODEC_SRCS-yes
+= aom_ports
/mem_ops.h
113 CODEC_SRCS-yes
+= aom_ports
/mem_ops_aligned.h
114 CODEC_SRCS-yes
+= aom_ports
/aom_once.h
115 CODEC_SRCS-yes
+= $(BUILD_PFX
)aom_config.c
116 INSTALL-SRCS-no
+= $(BUILD_PFX
)aom_config.c
117 ifeq ($(ARCH_X86
)$(ARCH_X86_64
),yes
)
118 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += third_party
/x86inc
/x86inc.asm
120 CODEC_EXPORTS-yes
+= aom
/exports_com
121 CODEC_EXPORTS-
$(CONFIG_AV1_ENCODER
) += aom
/exports_enc
122 CODEC_EXPORTS-
$(CONFIG_AV1_DECODER
) += aom
/exports_dec
124 INSTALL-LIBS-yes
+= include/aom
/aom_codec.h
125 INSTALL-LIBS-yes
+= include/aom
/aom_frame_buffer.h
126 INSTALL-LIBS-yes
+= include/aom
/aom_image.h
127 INSTALL-LIBS-yes
+= include/aom
/aom_integer.h
128 INSTALL-LIBS-
$(CONFIG_AV1_DECODER
) += include/aom
/aom_decoder.h
129 INSTALL-LIBS-
$(CONFIG_AV1_ENCODER
) += include/aom
/aom_encoder.h
130 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
131 ifeq ($(CONFIG_MSVS
),yes
)
132 INSTALL-LIBS-yes
+= $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/$(CODEC_LIB
).lib
)
133 INSTALL-LIBS-
$(CONFIG_DEBUG_LIBS
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/$(CODEC_LIB
)d.lib
)
134 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/aom.dll
)
135 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(foreach p
,$(VS_PLATFORMS
),$(LIBSUBDIR
)/$(p
)/aom.exp
)
138 INSTALL-LIBS-
$(CONFIG_STATIC
) += $(LIBSUBDIR
)/libaom.a
139 INSTALL-LIBS-
$(CONFIG_DEBUG_LIBS
) += $(LIBSUBDIR
)/libaom_g.a
142 CODEC_SRCS
=$(call enabled
,CODEC_SRCS
)
143 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(CODEC_SRCS
)
144 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(call enabled
,CODEC_EXPORTS
)
147 # Generate a list of all enabled sources, in particular for exporting to gyp
148 # based build systems.
151 @echo
$(CODEC_SRCS
) | xargs
-n1 echo | LC_ALL
=C
sort -u
> $@
152 CLEAN-OBJS
+= libaom_srcs.txt
154 # Assembly files that are included, but don't define symbols themselves.
155 # Filtered out to avoid Visual Studio build warnings.
157 third_party
/x86inc
/x86inc.asm \
159 aom_ports
/x86_abi_support.asm \
161 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
162 ifeq ($(CONFIG_MSVS
),yes
)
164 aom.def
: $(call enabled
,CODEC_EXPORTS
)
166 $(qexec
)$(SRC_PATH_BARE
)/build
/make
/gen_msvs_def.sh\
169 CLEAN-OBJS
+= aom.def
171 aom.
$(VCPROJ_SFX
): $(CODEC_SRCS
) aom.def
173 $(qexec
)$(GEN_VCPROJ
) \
174 $(if
$(CONFIG_SHARED
),--dll
,--lib
) \
175 --target
=$(TOOLCHAIN
) \
176 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
178 --proj-guid
=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74 \
179 --module-def
=aom.def \
180 --ver
=$(CONFIG_VS_VERSION
) \
181 --src-path-bare
="$(SRC_PATH_BARE)" \
183 $(filter-out $(addprefix %, $(ASM_INCLUDES
)), $^
) \
184 --src-path-bare
="$(SRC_PATH_BARE)" \
186 PROJECTS-yes
+= aom.
$(VCPROJ_SFX
)
188 aom.
$(VCPROJ_SFX
): aom_config.asm
189 aom.
$(VCPROJ_SFX
): $(RTCD
)
193 LIBAOM_OBJS
=$(call objs
, $(filter-out $(ASM_INCLUDES
), $(CODEC_SRCS
)))
194 OBJS-yes
+= $(LIBAOM_OBJS
)
195 LIBS-
$(if yes
,$(CONFIG_STATIC
)) += $(BUILD_PFX
)libaom.a
$(BUILD_PFX
)libaom_g.a
196 $(BUILD_PFX
)libaom_g.a
: $(LIBAOM_OBJS
)
198 SO_VERSION_MAJOR
:= 0
199 SO_VERSION_MINOR
:= 0
200 SO_VERSION_PATCH
:= 0
201 ifeq ($(filter darwin
%,$(TGT_OS
)),$(TGT_OS
))
202 LIBAOM_SO
:= libaom.
$(SO_VERSION_MAJOR
).dylib
203 SHARED_LIB_SUF
:= .dylib
204 EXPORT_FILE
:= libaom.syms
205 LIBAOM_SO_SYMLINKS
:= $(addprefix $(LIBSUBDIR
)/, \
208 ifeq ($(filter iphonesimulator
%,$(TGT_OS
)),$(TGT_OS
))
209 LIBAOM_SO
:= libaom.
$(SO_VERSION_MAJOR
).dylib
210 SHARED_LIB_SUF
:= .dylib
211 EXPORT_FILE
:= libaom.syms
212 LIBAOM_SO_SYMLINKS
:= $(addprefix $(LIBSUBDIR
)/, libaom.dylib
)
214 ifeq ($(filter os2
%,$(TGT_OS
)),$(TGT_OS
))
215 LIBAOM_SO
:= libaom
$(SO_VERSION_MAJOR
).dll
216 SHARED_LIB_SUF
:= _dll.a
217 EXPORT_FILE
:= libaom.def
218 LIBAOM_SO_SYMLINKS
:=
219 LIBAOM_SO_IMPLIB
:= libaom_dll.a
221 LIBAOM_SO
:= libaom.so.
$(SO_VERSION_MAJOR
).
$(SO_VERSION_MINOR
).
$(SO_VERSION_PATCH
)
222 SHARED_LIB_SUF
:= .so
223 EXPORT_FILE
:= libaom.ver
224 LIBAOM_SO_SYMLINKS
:= $(addprefix $(LIBSUBDIR
)/, \
225 libaom.so libaom.so.
$(SO_VERSION_MAJOR
) \
226 libaom.so.
$(SO_VERSION_MAJOR
).
$(SO_VERSION_MINOR
))
231 LIBS-
$(CONFIG_SHARED
) += $(BUILD_PFX
)$(LIBAOM_SO
)\
232 $(notdir $(LIBAOM_SO_SYMLINKS
)) \
233 $(if
$(LIBAOM_SO_IMPLIB
), $(BUILD_PFX
)$(LIBAOM_SO_IMPLIB
))
234 $(BUILD_PFX
)$(LIBAOM_SO
): $(LIBAOM_OBJS
) $(EXPORT_FILE
)
235 $(BUILD_PFX
)$(LIBAOM_SO
): extralibs
+= -lm
236 $(BUILD_PFX
)$(LIBAOM_SO
): SONAME
= libaom.so.
$(SO_VERSION_MAJOR
)
237 $(BUILD_PFX
)$(LIBAOM_SO
): EXPORTS_FILE
= $(EXPORT_FILE
)
239 libaom.ver
: $(call enabled
,CODEC_EXPORTS
)
241 $(qexec
)echo
"{ global:" > $@
242 $(qexec
)for f in
$?
; do awk
'{print $$2";"}' < $$f >>$@
; done
243 $(qexec
)echo
"local: *; };" >> $@
244 CLEAN-OBJS
+= libaom.ver
246 libaom.syms
: $(call enabled
,CODEC_EXPORTS
)
248 $(qexec
)awk
'{print "_"$$2}' $^
>$@
249 CLEAN-OBJS
+= libaom.syms
251 libaom.def
: $(call enabled
,CODEC_EXPORTS
)
253 $(qexec
)echo LIBRARY
$(LIBAOM_SO
:.dll
=) INITINSTANCE TERMINSTANCE
> $@
254 $(qexec
)echo
"DATA MULTIPLE NONSHARED" >> $@
255 $(qexec
)echo
"EXPORTS" >> $@
256 $(qexec
)awk
'{print "_"$$2}' $^
>>$@
257 CLEAN-OBJS
+= libaom.def
259 libaom_dll.a
: $(LIBAOM_SO
)
261 $(qexec
)emximp
-o
$@
$<
262 CLEAN-OBJS
+= libaom_dll.a
264 define libaom_symlink_template
266 @echo
" [LN] $(2) $$@"
267 $(qexec
)mkdir
-p
$$(dir $$@
)
268 $(qexec
)ln
-sf
$(2) $$@
271 $(eval
$(call libaom_symlink_template
,\
272 $(addprefix $(BUILD_PFX
),$(notdir $(LIBAOM_SO_SYMLINKS
))),\
273 $(BUILD_PFX
)$(LIBAOM_SO
)))
274 $(eval
$(call libaom_symlink_template
,\
275 $(addprefix $(DIST_DIR
)/,$(LIBAOM_SO_SYMLINKS
)),\
279 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(LIBAOM_SO_SYMLINKS
)
280 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(LIBSUBDIR
)/$(LIBAOM_SO
)
281 INSTALL-LIBS-
$(CONFIG_SHARED
) += $(if
$(LIBAOM_SO_IMPLIB
),$(LIBSUBDIR
)/$(LIBAOM_SO_IMPLIB
))
285 aom.
pc: config.mk libs.mk
287 $(qexec
)echo
'# pkg-config file from libaom $(VERSION_STRING)' > $@
288 $(qexec
)echo
'prefix=$(PREFIX)' >> $@
289 $(qexec
)echo
'exec_prefix=$${prefix}' >> $@
290 $(qexec
)echo
'libdir=$${prefix}/$(LIBSUBDIR)' >> $@
291 $(qexec
)echo
'includedir=$${prefix}/include' >> $@
292 $(qexec
)echo
'' >> $@
293 $(qexec
)echo
'Name: aom' >> $@
294 $(qexec
)echo
'Description: WebM Project AVx codec implementation' >> $@
295 $(qexec
)echo
'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@
296 $(qexec
)echo
'Requires:' >> $@
297 $(qexec
)echo
'Conflicts:' >> $@
298 $(qexec
)echo
'Libs: -L$${libdir} -laom -lm' >> $@
299 ifeq ($(HAVE_PTHREAD_H
),yes
)
300 $(qexec
)echo
'Libs.private: -lm -lpthread' >> $@
302 $(qexec
)echo
'Libs.private: -lm' >> $@
304 $(qexec
)echo
'Cflags: -I$${includedir}' >> $@
305 INSTALL-LIBS-yes
+= $(LIBSUBDIR
)/pkgconfig
/aom.
pc
306 INSTALL_MAPS
+= $(LIBSUBDIR
)/pkgconfig
/%.
pc %.
pc
311 # Rule to make assembler configuration file from C configuration file
313 ifeq ($(ARCH_X86
)$(ARCH_X86_64
),yes
)
315 $(BUILD_PFX
)aom_config.asm
: $(BUILD_PFX
)aom_config.h
317 @egrep
"#define [A-Z0-9_]+ [01]" $< \
318 | awk
'{print $$2 " equ " $$3}' > $@
320 ADS2GAS
=$(if
$(filter yes
,$(CONFIG_GCC
)),|
$(ASM_CONVERSION
))
321 $(BUILD_PFX
)aom_config.asm
: $(BUILD_PFX
)aom_config.h
323 @egrep
"#define [A-Z0-9_]+ [01]" $< \
324 | awk
'{print $$2 " EQU " $$3}' $(ADS2GAS
) > $@
325 @echo
" END" $(ADS2GAS
) >> $@
326 CLEAN-OBJS
+= $(BUILD_PFX
)aom_config.asm
330 # Add assembler dependencies for configuration.
332 $(filter %.s.o
,$(OBJS-yes
)): $(BUILD_PFX
)aom_config.asm
333 $(filter %$(ASM
).o
,$(OBJS-yes
)): $(BUILD_PFX
)aom_config.asm
336 $(shell $(SRC_PATH_BARE
)/build
/make
/version.sh
"$(SRC_PATH_BARE)" $(BUILD_PFX
)aom_version.h
)
337 CLEAN-OBJS
+= $(BUILD_PFX
)aom_version.h
340 # Add include path for libwebm sources.
342 ifeq ($(CONFIG_WEBM_IO
),yes
)
343 CXXFLAGS
+= -I
$(SRC_PATH_BARE
)/third_party
/libwebm
347 ## libaom test directives
349 ifeq ($(CONFIG_UNIT_TESTS
),yes
)
350 LIBAOM_TEST_DATA_PATH ?
= .
352 include $(SRC_PATH_BARE
)/test/test.mk
353 LIBAOM_TEST_SRCS
=$(addprefix test/,$(call enabled
,LIBAOM_TEST_SRCS
))
354 LIBAOM_TEST_BIN
=.
/test_libaom
$(EXE_SFX
)
355 LIBAOM_TEST_DATA
=$(addprefix $(LIBAOM_TEST_DATA_PATH
)/,\
356 $(call enabled
,LIBAOM_TEST_DATA
))
357 libaom_test_data_url
=https
://storage.googleapis.com
/downloads.webmproject.org
/test_data
/libvpx
/$(1)
359 TEST_INTRA_PRED_SPEED_BIN
=.
/test_intra_pred_speed
$(EXE_SFX
)
360 TEST_INTRA_PRED_SPEED_SRCS
=$(addprefix test/,$(call enabled
,TEST_INTRA_PRED_SPEED_SRCS
))
361 TEST_INTRA_PRED_SPEED_OBJS
:= $(sort $(call objs
,$(TEST_INTRA_PRED_SPEED_SRCS
)))
363 libaom_test_srcs.txt
:
365 @echo
$(LIBAOM_TEST_SRCS
) | xargs
-n1 echo | LC_ALL
=C
sort -u
> $@
366 CLEAN-OBJS
+= libaom_test_srcs.txt
368 $(LIBAOM_TEST_DATA
): $(SRC_PATH_BARE
)/test/test-data.sha1
369 @echo
" [DOWNLOAD] $@"
370 $(qexec
)trap
'rm -f $@' INT TERM
&&\
371 curl
-L
-o
$@
$(call libaom_test_data_url
,$(@F
))
373 testdata
:: $(LIBAOM_TEST_DATA
)
374 $(qexec
)[ -x
"$$(which sha1sum)" ] && sha1sum
=sha1sum
;\
375 [ -x
"$$(which shasum)" ] && sha1sum
=shasum
;\
376 [ -x
"$$(which sha1)" ] && sha1sum
=sha1
;\
377 if
[ -n
"$${sha1sum}" ]; then\
379 echo
"Checking test data:";\
380 for f in
$(call enabled
,LIBAOM_TEST_DATA
); do\
381 grep
$$f $(SRC_PATH_BARE
)/test/test-data.sha1 |\
382 (cd
$(LIBAOM_TEST_DATA_PATH
); $${sha1sum} -c
);\
385 echo
"Skipping test data integrity check, sha1sum not found.";\
388 ifeq ($(CONFIG_EXTERNAL_BUILD
),yes
)
389 ifeq ($(CONFIG_MSVS
),yes
)
390 gtest.
$(VCPROJ_SFX
): $(SRC_PATH_BARE
)/third_party
/googletest
/src
/googletest
/src
/gtest-all.
cc
392 $(qexec
)$(GEN_VCPROJ
) \
394 --target
=$(TOOLCHAIN
) \
395 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
397 --proj-guid
=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \
398 --ver
=$(CONFIG_VS_VERSION
) \
399 --src-path-bare
="$(SRC_PATH_BARE)" \
401 --out
=gtest.
$(VCPROJ_SFX
) \
402 $(SRC_PATH_BARE
)/third_party
/googletest
/src
/googletest
/src
/gtest-all.
cc \
403 -I.
-I
"$(SRC_PATH_BARE)/third_party/googletest/src/googletest/include" \
404 -I
"$(SRC_PATH_BARE)/third_party/googletest/src/googletest"
406 PROJECTS-
$(CONFIG_MSVS
) += gtest.
$(VCPROJ_SFX
)
408 test_libaom.
$(VCPROJ_SFX
): $(LIBAOM_TEST_SRCS
) aom.
$(VCPROJ_SFX
) gtest.
$(VCPROJ_SFX
)
410 $(qexec
)$(GEN_VCPROJ
) \
412 --target
=$(TOOLCHAIN
) \
415 --proj-guid
=CD837F5F-52D8-4314-A370-895D614166A7 \
416 --ver
=$(CONFIG_VS_VERSION
) \
417 --src-path-bare
="$(SRC_PATH_BARE)" \
418 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
419 --out
=$@
$(INTERNAL_CFLAGS
) $(CFLAGS
) \
420 -I.
-I
"$(SRC_PATH_BARE)/third_party/googletest/src/googletest/include" \
421 $(if
$(CONFIG_WEBM_IO
),-I
"$(SRC_PATH_BARE)/third_party/libwebm") \
422 -L.
-l
$(CODEC_LIB
) -l
$(GTEST_LIB
) $^
424 PROJECTS-
$(CONFIG_MSVS
) += test_libaom.
$(VCPROJ_SFX
)
426 LIBAOM_TEST_BIN
:= $(addprefix $(TGT_OS
:win64
=x64
)/Release
/,$(notdir $(LIBAOM_TEST_BIN
)))
428 ifneq ($(strip $(TEST_INTRA_PRED_SPEED_OBJS
)),)
429 PROJECTS-
$(CONFIG_MSVS
) += test_intra_pred_speed.
$(VCPROJ_SFX
)
430 test_intra_pred_speed.
$(VCPROJ_SFX
): $(TEST_INTRA_PRED_SPEED_SRCS
) aom.
$(VCPROJ_SFX
) gtest.
$(VCPROJ_SFX
)
432 $(qexec
)$(GEN_VCPROJ
) \
434 --target
=$(TOOLCHAIN
) \
435 --name
=test_intra_pred_speed \
437 --proj-guid
=CD837F5F-52D8-4314-A370-895D614166A7 \
438 --ver
=$(CONFIG_VS_VERSION
) \
439 --src-path-bare
="$(SRC_PATH_BARE)" \
440 $(if
$(CONFIG_STATIC_MSVCRT
),--static-crt
) \
441 --out
=$@
$(INTERNAL_CFLAGS
) $(CFLAGS
) \
442 -I.
-I
"$(SRC_PATH_BARE)/third_party/googletest/src/googletest/include" \
443 -L.
-l
$(CODEC_LIB
) -l
$(GTEST_LIB
) $^
444 endif # TEST_INTRA_PRED_SPEED
448 include $(SRC_PATH_BARE
)/third_party
/googletest
/gtest.mk
449 GTEST_SRCS
:= $(addprefix third_party
/,$(call enabled
,GTEST_SRCS
))
450 GTEST_OBJS
=$(call objs
,$(GTEST_SRCS
))
451 ifeq ($(filter win
%,$(TGT_OS
)),$(TGT_OS
))
452 # Disabling pthreads globally will cause issues on darwin and possibly elsewhere
453 $(GTEST_OBJS
) $(GTEST_OBJS
:.o
=.d
): CXXFLAGS
+= -DGTEST_HAS_PTHREAD
=0
455 GTEST_INCLUDES
:= -I
$(SRC_PATH_BARE
)/third_party
/googletest
/src
/googletest
456 GTEST_INCLUDES
+= -I
$(SRC_PATH_BARE
)/third_party
/googletest
/src
/googletest
/include
457 $(GTEST_OBJS
) $(GTEST_OBJS
:.o
=.d
): CXXFLAGS
+= $(GTEST_INCLUDES
)
458 OBJS-yes
+= $(GTEST_OBJS
)
459 LIBS-yes
+= $(BUILD_PFX
)libgtest.a
$(BUILD_PFX
)libgtest_g.a
460 $(BUILD_PFX
)libgtest_g.a
: $(GTEST_OBJS
)
462 LIBAOM_TEST_OBJS
=$(sort $(call objs
,$(LIBAOM_TEST_SRCS
)))
463 $(LIBAOM_TEST_OBJS
) $(LIBAOM_TEST_OBJS
:.o
=.d
): CXXFLAGS
+= $(GTEST_INCLUDES
)
464 OBJS-yes
+= $(LIBAOM_TEST_OBJS
)
465 BINS-yes
+= $(LIBAOM_TEST_BIN
)
467 CODEC_LIB
=$(if
$(CONFIG_DEBUG_LIBS
),aom_g
,aom
)
468 CODEC_LIB_SUF
=$(if
$(CONFIG_SHARED
),$(SHARED_LIB_SUF
),.a
)
469 TEST_LIBS
:= lib
$(CODEC_LIB
)$(CODEC_LIB_SUF
) libgtest.a
470 $(LIBAOM_TEST_BIN
): $(TEST_LIBS
)
471 $(eval
$(call linkerxx_template
,$(LIBAOM_TEST_BIN
), \
472 $(LIBAOM_TEST_OBJS
) \
473 -L.
-laom
-lgtest
$(extralibs
) -lm
))
475 ifneq ($(strip $(TEST_INTRA_PRED_SPEED_OBJS
)),)
476 $(TEST_INTRA_PRED_SPEED_OBJS
) $(TEST_INTRA_PRED_SPEED_OBJS
:.o
=.d
): CXXFLAGS
+= $(GTEST_INCLUDES
)
477 OBJS-yes
+= $(TEST_INTRA_PRED_SPEED_OBJS
)
478 BINS-yes
+= $(TEST_INTRA_PRED_SPEED_BIN
)
480 $(TEST_INTRA_PRED_SPEED_BIN
): $(TEST_LIBS
)
481 $(eval
$(call linkerxx_template
,$(TEST_INTRA_PRED_SPEED_BIN
), \
482 $(TEST_INTRA_PRED_SPEED_OBJS
) \
483 -L.
-laom
-lgtest
$(extralibs
) -lm
))
484 endif # TEST_INTRA_PRED_SPEED
486 endif # CONFIG_UNIT_TESTS
488 # Install test sources only if codec source is included
489 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(patsubst $(SRC_PATH_BARE
)/%,%,\
490 $(shell find
$(SRC_PATH_BARE
)/third_party
/googletest
-type f
))
491 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(LIBAOM_TEST_SRCS
)
492 INSTALL-SRCS-
$(CONFIG_CODEC_SRCS
) += $(TEST_INTRA_PRED_SPEED_SRCS
)
494 define test_shard_template
495 test:: test_shard.
$(1)
496 test-no-data-check
:: test_shard_ndc.
$(1)
497 test_shard.
$(1) test_shard_ndc.
$(1): $(LIBAOM_TEST_BIN
)
499 export GTEST_SHARD_INDEX
=$(1); \
500 export GTEST_TOTAL_SHARDS
=$(2); \
502 test_shard.
$(1): testdata
503 .PHONY
: test_shard.
$(1)
507 SHARDS
:= 0 1 2 3 4 5 6 7 8 9
508 $(foreach s
,$(SHARDS
),$(eval
$(call test_shard_template
,$(s
),$(NUM_SHARDS
))))
513 ## documentation directives
515 CLEAN-OBJS
+= libs.doxy
516 DOCS-yes
+= libs.doxy
517 libs.doxy
: $(CODEC_DOC_SRCS
)
520 @echo
"INPUT += $^" >> $@
521 @echo
"INCLUDE_PATH += ." >> $@
;
522 @echo
"ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@
524 ## Generate rtcd.h for all objects
525 ifeq ($(CONFIG_DEPENDENCY_TRACKING
),yes
)
526 $(OBJS-yes
:.o
=.d
): $(RTCD
)
531 ## Update the global src list
532 SRCS
+= $(CODEC_SRCS
) $(LIBAOM_TEST_SRCS
) $(GTEST_SRCS
)
535 ## aomdec/aomenc tests.
537 ifeq ($(CONFIG_UNIT_TESTS
),yes
)
539 ifeq ($(CONFIG_MSVS
),yes
)
540 # MSVC will build both Debug and Release configurations of tools in a
541 # sub directory named for the current target. Assume the user wants to
542 # run the Release tools, and assign TEST_BIN_PATH accordingly.
543 # TODO(tomfinegan): Is this adequate for ARM?
544 # TODO(tomfinegan): Support running the debug versions of tools?
545 TEST_BIN_PATH
:= $(addsuffix /$(TGT_OS
:win64
=x64
)/Release
, $(TEST_BIN_PATH
))
547 utiltest utiltest-no-data-check
:
548 $(qexec
)$(SRC_PATH_BARE
)/test/aomdec.sh \
549 --test-data-path
$(LIBAOM_TEST_DATA_PATH
) \
550 --bin-path
$(TEST_BIN_PATH
)
551 $(qexec
)$(SRC_PATH_BARE
)/test/aomenc.sh \
552 --test-data-path
$(LIBAOM_TEST_DATA_PATH
) \
553 --bin-path
$(TEST_BIN_PATH
)
556 utiltest utiltest-no-data-check
:
557 @echo Unit tests must be enabled to make the utiltest target.
563 ifeq ($(CONFIG_UNIT_TESTS
),yes
)
564 # All non-MSVC targets output example targets in a sub dir named examples.
565 EXAMPLES_BIN_PATH
= examples
566 ifeq ($(CONFIG_MSVS
),yes
)
567 # MSVC will build both Debug and Release configurations of the examples in a
568 # sub directory named for the current target. Assume the user wants to
569 # run the Release tools, and assign EXAMPLES_BIN_PATH accordingly.
570 # TODO(tomfinegan): Is this adequate for ARM?
571 # TODO(tomfinegan): Support running the debug versions of tools?
572 EXAMPLES_BIN_PATH
:= $(TGT_OS
:win64
=x64
)/Release
574 exampletest exampletest-no-data-check
: examples
575 $(qexec
)$(SRC_PATH_BARE
)/test/examples.sh \
576 --test-data-path
$(LIBAOM_TEST_DATA_PATH
) \
577 --bin-path
$(EXAMPLES_BIN_PATH
)
578 exampletest
: testdata
580 exampletest exampletest-no-data-check
:
581 @echo Unit tests must be enabled to make the exampletest target.