John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 1 | ## |
John Koleszar | c2140b8 | 2010-09-09 08:16:39 -0400 | [diff] [blame] | 2 | ## Copyright (c) 2010 The WebM project authors. All Rights Reserved. |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 3 | ## |
John Koleszar | 94c52e4 | 2010-06-18 12:39:21 -0400 | [diff] [blame] | 4 | ## Use of this source code is governed by a BSD-style license |
John Koleszar | 09202d8 | 2010-06-04 16:19:40 -0400 | [diff] [blame] | 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 |
John Koleszar | 94c52e4 | 2010-06-18 12:39:21 -0400 | [diff] [blame] | 7 | ## in the file PATENTS. All contributing project authors may |
John Koleszar | 09202d8 | 2010-06-04 16:19:40 -0400 | [diff] [blame] | 8 | ## be found in the AUTHORS file in the root of the source tree. |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 9 | ## |
| 10 | |
| 11 | |
Johann | 128d2c2 | 2011-03-02 09:44:39 -0500 | [diff] [blame] | 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) |
Martin Storsjo | ad484fc | 2013-05-18 23:32:49 +0300 | [diff] [blame] | 15 | ASM:=$(if $(filter yes,$(CONFIG_GCC)$(CONFIG_MSVS)),.asm.s,.asm) |
Johann | 128d2c2 | 2011-03-02 09:44:39 -0500 | [diff] [blame] | 16 | else |
| 17 | ASM:=.asm |
| 18 | endif |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 19 | |
John Koleszar | 7b8dfcb | 2012-11-06 16:59:01 -0800 | [diff] [blame] | 20 | # |
John Koleszar | a9c7597 | 2012-11-08 17:09:30 -0800 | [diff] [blame] | 21 | # Rule to generate runtime cpu detection files |
| 22 | # |
| 23 | define rtcd_h_template |
| 24 | $$(BUILD_PFX)$(1).h: $$(SRC_PATH_BARE)/$(2) |
| 25 | @echo " [CREATE] $$@" |
James Zern | 805078a | 2014-02-23 16:33:14 -0800 | [diff] [blame] | 26 | $$(qexec)$$(SRC_PATH_BARE)/build/make/rtcd.pl --arch=$$(TGT_ISA) \ |
John Koleszar | a9c7597 | 2012-11-08 17:09:30 -0800 | [diff] [blame] | 27 | --sym=$(1) \ |
Tom Finegan | 3d7063d | 2015-05-12 15:33:40 -0700 | [diff] [blame] | 28 | --config=$$(CONFIG_DIR)$$(target)-$$(TOOLCHAIN).mk \ |
John Koleszar | a9c7597 | 2012-11-08 17:09:30 -0800 | [diff] [blame] | 29 | $$(RTCD_OPTIONS) $$^ > $$@ |
| 30 | CLEAN-OBJS += $$(BUILD_PFX)$(1).h |
| 31 | RTCD += $$(BUILD_PFX)$(1).h |
| 32 | endef |
John Koleszar | 7b8dfcb | 2012-11-06 16:59:01 -0800 | [diff] [blame] | 33 | |
Johann | 5d88a82 | 2012-03-05 16:36:23 -0800 | [diff] [blame] | 34 | CODEC_SRCS-yes += CHANGELOG |
John Koleszar | 4d86ef3 | 2010-06-22 08:44:48 -0400 | [diff] [blame] | 35 | CODEC_SRCS-yes += libs.mk |
| 36 | |
John Koleszar | b749234 | 2010-05-24 11:39:59 -0400 | [diff] [blame] | 37 | include $(SRC_PATH_BARE)/vpx/vpx_codec.mk |
| 38 | CODEC_SRCS-yes += $(addprefix vpx/,$(call enabled,API_SRCS)) |
Johann | 999f31f | 2012-11-15 17:19:44 -0800 | [diff] [blame] | 39 | CODEC_DOC_SRCS += $(addprefix vpx/,$(call enabled,API_DOC_SRCS)) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 40 | |
| 41 | include $(SRC_PATH_BARE)/vpx_mem/vpx_mem.mk |
| 42 | CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS)) |
| 43 | |
| 44 | include $(SRC_PATH_BARE)/vpx_scale/vpx_scale.mk |
| 45 | CODEC_SRCS-yes += $(addprefix vpx_scale/,$(call enabled,SCALE_SRCS)) |
| 46 | |
Johann | a5ffcdd | 2012-11-15 16:28:20 -0800 | [diff] [blame] | 47 | include $(SRC_PATH_BARE)/vpx_ports/vpx_ports.mk |
| 48 | CODEC_SRCS-yes += $(addprefix vpx_ports/,$(call enabled,PORTS_SRCS)) |
| 49 | |
Johann | d5d9289 | 2015-04-17 16:11:38 -0400 | [diff] [blame] | 50 | include $(SRC_PATH_BARE)/vpx_dsp/vpx_dsp.mk |
| 51 | CODEC_SRCS-yes += $(addprefix vpx_dsp/,$(call enabled,DSP_SRCS)) |
| 52 | |
Jingning Han | d1b30ce | 2015-07-02 10:01:09 -0700 | [diff] [blame] | 53 | include $(SRC_PATH_BARE)/vpx_util/vpx_util.mk |
| 54 | CODEC_SRCS-yes += $(addprefix vpx_util/,$(call enabled,UTIL_SRCS)) |
Jingning Han | 3a3b0be | 2015-07-01 14:58:13 -0700 | [diff] [blame] | 55 | |
Johann | 9a5e0d4 | 2015-09-01 12:28:21 -0700 | [diff] [blame] | 56 | ifeq ($(CONFIG_VP8),yes) |
John Koleszar | 7b8dfcb | 2012-11-06 16:59:01 -0800 | [diff] [blame] | 57 | VP8_PREFIX=vp8/ |
| 58 | include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8_common.mk |
| 59 | endif |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 60 | |
| 61 | ifeq ($(CONFIG_VP8_ENCODER),yes) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 62 | include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk |
| 63 | CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS)) |
| 64 | CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS)) |
John Koleszar | 2bf8fb5 | 2012-05-02 16:37:37 -0700 | [diff] [blame] | 65 | INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h |
John Koleszar | b749234 | 2010-05-24 11:39:59 -0400 | [diff] [blame] | 66 | INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/% |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 67 | CODEC_DOC_SECTIONS += vp8 vp8_encoder |
| 68 | endif |
| 69 | |
| 70 | ifeq ($(CONFIG_VP8_DECODER),yes) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 71 | include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8dx.mk |
| 72 | CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_DX_SRCS)) |
| 73 | CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_DX_EXPORTS)) |
John Koleszar | b749234 | 2010-05-24 11:39:59 -0400 | [diff] [blame] | 74 | INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h |
| 75 | INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/% |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 76 | CODEC_DOC_SECTIONS += vp8 vp8_decoder |
| 77 | endif |
| 78 | |
Johann Koenig | 0231e27 | 2015-08-28 16:18:18 -0700 | [diff] [blame] | 79 | ifeq ($(CONFIG_VP9),yes) |
John Koleszar | 7b8dfcb | 2012-11-06 16:59:01 -0800 | [diff] [blame] | 80 | VP9_PREFIX=vp9/ |
| 81 | include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9_common.mk |
| 82 | endif |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 83 | |
Ronald S. Bultje | 4b2c2b9 | 2012-11-01 11:09:58 -0700 | [diff] [blame] | 84 | ifeq ($(CONFIG_VP9_ENCODER),yes) |
| 85 | VP9_PREFIX=vp9/ |
| 86 | include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9cx.mk |
| 87 | CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_CX_SRCS)) |
| 88 | CODEC_EXPORTS-yes += $(addprefix $(VP9_PREFIX),$(VP9_CX_EXPORTS)) |
John Koleszar | 7b8dfcb | 2012-11-06 16:59:01 -0800 | [diff] [blame] | 89 | CODEC_SRCS-yes += $(VP9_PREFIX)vp9cx.mk vpx/vp8.h vpx/vp8cx.h |
John Koleszar | 7b8dfcb | 2012-11-06 16:59:01 -0800 | [diff] [blame] | 90 | INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h |
James Zern | f12ebfc | 2014-05-14 19:45:20 -0700 | [diff] [blame] | 91 | INSTALL-LIBS-$(CONFIG_SPATIAL_SVC) += include/vpx/svc_context.h |
Ronald S. Bultje | 4b2c2b9 | 2012-11-01 11:09:58 -0700 | [diff] [blame] | 92 | INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP9_PREFIX)/% |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 93 | CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h |
Ronald S. Bultje | 4b2c2b9 | 2012-11-01 11:09:58 -0700 | [diff] [blame] | 94 | CODEC_DOC_SECTIONS += vp9 vp9_encoder |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 95 | endif |
| 96 | |
Ronald S. Bultje | 4b2c2b9 | 2012-11-01 11:09:58 -0700 | [diff] [blame] | 97 | ifeq ($(CONFIG_VP9_DECODER),yes) |
| 98 | VP9_PREFIX=vp9/ |
| 99 | include $(SRC_PATH_BARE)/$(VP9_PREFIX)vp9dx.mk |
| 100 | CODEC_SRCS-yes += $(addprefix $(VP9_PREFIX),$(call enabled,VP9_DX_SRCS)) |
| 101 | CODEC_EXPORTS-yes += $(addprefix $(VP9_PREFIX),$(VP9_DX_EXPORTS)) |
| 102 | CODEC_SRCS-yes += $(VP9_PREFIX)vp9dx.mk vpx/vp8.h vpx/vp8dx.h |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 103 | INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h |
Ronald S. Bultje | 4b2c2b9 | 2012-11-01 11:09:58 -0700 | [diff] [blame] | 104 | INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP9_PREFIX)/% |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 105 | CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h |
Ronald S. Bultje | 4b2c2b9 | 2012-11-01 11:09:58 -0700 | [diff] [blame] | 106 | CODEC_DOC_SECTIONS += vp9 vp9_decoder |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 107 | endif |
| 108 | |
Jim Bankoski | 1ae7f25 | 2014-08-22 13:32:14 -0700 | [diff] [blame] | 109 | VP9_PREFIX=vp9/ |
| 110 | $(BUILD_PFX)$(VP9_PREFIX)%.c.o: CFLAGS += -Wextra |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 111 | |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 112 | # VP10 make file |
Johann Koenig | 0231e27 | 2015-08-28 16:18:18 -0700 | [diff] [blame] | 113 | ifeq ($(CONFIG_VP10),yes) |
Jingning Han | 3ee6db6 | 2015-08-05 19:00:31 -0700 | [diff] [blame] | 114 | VP10_PREFIX=vp10/ |
| 115 | include $(SRC_PATH_BARE)/$(VP10_PREFIX)vp10_common.mk |
| 116 | endif |
| 117 | |
| 118 | ifeq ($(CONFIG_VP10_ENCODER),yes) |
| 119 | VP10_PREFIX=vp10/ |
| 120 | include $(SRC_PATH_BARE)/$(VP10_PREFIX)vp10cx.mk |
| 121 | CODEC_SRCS-yes += $(addprefix $(VP10_PREFIX),$(call enabled,VP10_CX_SRCS)) |
| 122 | CODEC_EXPORTS-yes += $(addprefix $(VP10_PREFIX),$(VP10_CX_EXPORTS)) |
| 123 | CODEC_SRCS-yes += $(VP10_PREFIX)vp10cx.mk vpx/vp8.h vpx/vp8cx.h |
| 124 | INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8cx.h |
| 125 | INSTALL-LIBS-$(CONFIG_SPATIAL_SVC) += include/vpx/svc_context.h |
| 126 | INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP10_PREFIX)/% |
| 127 | CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h |
| 128 | CODEC_DOC_SECTIONS += vp9 vp9_encoder |
| 129 | endif |
| 130 | |
| 131 | ifeq ($(CONFIG_VP10_DECODER),yes) |
| 132 | VP10_PREFIX=vp10/ |
| 133 | include $(SRC_PATH_BARE)/$(VP10_PREFIX)vp10dx.mk |
| 134 | CODEC_SRCS-yes += $(addprefix $(VP10_PREFIX),$(call enabled,VP10_DX_SRCS)) |
| 135 | CODEC_EXPORTS-yes += $(addprefix $(VP10_PREFIX),$(VP10_DX_EXPORTS)) |
| 136 | CODEC_SRCS-yes += $(VP10_PREFIX)vp10dx.mk vpx/vp8.h vpx/vp8dx.h |
| 137 | INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h |
| 138 | INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP10_PREFIX)/% |
| 139 | CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h |
| 140 | CODEC_DOC_SECTIONS += vp9 vp9_decoder |
| 141 | endif |
| 142 | |
| 143 | VP10_PREFIX=vp10/ |
| 144 | $(BUILD_PFX)$(VP10_PREFIX)%.c.o: CFLAGS += -Wextra |
| 145 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 146 | ifeq ($(CONFIG_ENCODERS),yes) |
| 147 | CODEC_DOC_SECTIONS += encoder |
| 148 | endif |
| 149 | ifeq ($(CONFIG_DECODERS),yes) |
| 150 | CODEC_DOC_SECTIONS += decoder |
| 151 | endif |
| 152 | |
| 153 | |
| 154 | ifeq ($(CONFIG_MSVS),yes) |
| 155 | CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd) |
James Berry | 0cc044f | 2012-05-02 18:09:54 -0400 | [diff] [blame] | 156 | GTEST_LIB=$(if $(CONFIG_STATIC_MSVCRT),gtestmt,gtestmd) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 157 | # This variable uses deferred expansion intentionally, since the results of |
| 158 | # $(wildcard) may change during the course of the Make. |
| 159 | VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d)))) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 160 | endif |
| 161 | |
| 162 | # The following pairs define a mapping of locations in the distribution |
| 163 | # tree to locations in the source/build trees. |
John Koleszar | b749234 | 2010-05-24 11:39:59 -0400 | [diff] [blame] | 164 | INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/% |
| 165 | INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/% |
John Koleszar | 670af3a | 2010-05-26 15:57:42 -0400 | [diff] [blame] | 166 | INSTALL_MAPS += $(LIBSUBDIR)/% % |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 167 | INSTALL_MAPS += src/% $(SRC_PATH_BARE)/% |
| 168 | ifeq ($(CONFIG_MSVS),yes) |
John Koleszar | 670af3a | 2010-05-26 15:57:42 -0400 | [diff] [blame] | 169 | INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%) |
| 170 | INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 171 | endif |
| 172 | |
Tom Finegan | d104b16 | 2015-05-14 10:46:44 -0700 | [diff] [blame] | 173 | CODEC_SRCS-yes += build/make/version.sh |
| 174 | CODEC_SRCS-yes += build/make/rtcd.pl |
| 175 | CODEC_SRCS-yes += vpx_ports/emmintrin_compat.h |
| 176 | CODEC_SRCS-yes += vpx_ports/mem_ops.h |
| 177 | CODEC_SRCS-yes += vpx_ports/mem_ops_aligned.h |
| 178 | CODEC_SRCS-yes += vpx_ports/vpx_once.h |
| 179 | CODEC_SRCS-yes += $(BUILD_PFX)vpx_config.c |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 180 | INSTALL-SRCS-no += $(BUILD_PFX)vpx_config.c |
John Koleszar | 2396302 | 2013-01-16 16:44:33 -0800 | [diff] [blame] | 181 | ifeq ($(ARCH_X86)$(ARCH_X86_64),yes) |
James Zern | e707e95 | 2014-06-27 16:40:39 -0700 | [diff] [blame] | 182 | INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += third_party/x86inc/x86inc.asm |
John Koleszar | 2396302 | 2013-01-16 16:44:33 -0800 | [diff] [blame] | 183 | endif |
Tom Finegan | d104b16 | 2015-05-14 10:46:44 -0700 | [diff] [blame] | 184 | CODEC_EXPORTS-yes += vpx/exports_com |
John Koleszar | 7aa97a3 | 2010-06-03 10:29:04 -0400 | [diff] [blame] | 185 | CODEC_EXPORTS-$(CONFIG_ENCODERS) += vpx/exports_enc |
| 186 | CODEC_EXPORTS-$(CONFIG_DECODERS) += vpx/exports_dec |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 187 | |
John Koleszar | b749234 | 2010-05-24 11:39:59 -0400 | [diff] [blame] | 188 | INSTALL-LIBS-yes += include/vpx/vpx_codec.h |
Frank Galligan | e8e1527 | 2014-02-05 17:44:42 -0800 | [diff] [blame] | 189 | INSTALL-LIBS-yes += include/vpx/vpx_frame_buffer.h |
John Koleszar | b749234 | 2010-05-24 11:39:59 -0400 | [diff] [blame] | 190 | INSTALL-LIBS-yes += include/vpx/vpx_image.h |
| 191 | INSTALL-LIBS-yes += include/vpx/vpx_integer.h |
John Koleszar | b749234 | 2010-05-24 11:39:59 -0400 | [diff] [blame] | 192 | INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h |
John Koleszar | b749234 | 2010-05-24 11:39:59 -0400 | [diff] [blame] | 193 | INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 194 | ifeq ($(CONFIG_EXTERNAL_BUILD),yes) |
| 195 | ifeq ($(CONFIG_MSVS),yes) |
John Koleszar | 670af3a | 2010-05-26 15:57:42 -0400 | [diff] [blame] | 196 | INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib) |
| 197 | INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB)d.lib) |
| 198 | INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.dll) |
| 199 | INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.exp) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 200 | endif |
| 201 | else |
James Zern | 495b241 | 2011-07-25 15:40:36 -0700 | [diff] [blame] | 202 | INSTALL-LIBS-$(CONFIG_STATIC) += $(LIBSUBDIR)/libvpx.a |
John Koleszar | 670af3a | 2010-05-26 15:57:42 -0400 | [diff] [blame] | 203 | INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 204 | endif |
| 205 | |
John Koleszar | 5ebe94f | 2012-12-23 07:20:10 -0800 | [diff] [blame] | 206 | CODEC_SRCS=$(call enabled,CODEC_SRCS) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 207 | INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(CODEC_SRCS) |
| 208 | INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(call enabled,CODEC_EXPORTS) |
| 209 | |
John Koleszar | 5e562c7 | 2011-08-12 14:59:10 -0400 | [diff] [blame] | 210 | |
| 211 | # Generate a list of all enabled sources, in particular for exporting to gyp |
| 212 | # based build systems. |
| 213 | libvpx_srcs.txt: |
| 214 | @echo " [CREATE] $@" |
James Zern | 0f96f02 | 2015-02-26 20:48:40 -0800 | [diff] [blame] | 215 | @echo $(CODEC_SRCS) | xargs -n1 echo | LC_ALL=C sort -u > $@ |
Jim Bankoski | 975df8c | 2013-06-20 15:05:42 -0700 | [diff] [blame] | 216 | CLEAN-OBJS += libvpx_srcs.txt |
John Koleszar | 5e562c7 | 2011-08-12 14:59:10 -0400 | [diff] [blame] | 217 | |
| 218 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 219 | ifeq ($(CONFIG_EXTERNAL_BUILD),yes) |
| 220 | ifeq ($(CONFIG_MSVS),yes) |
| 221 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 222 | vpx.def: $(call enabled,CODEC_EXPORTS) |
| 223 | @echo " [CREATE] $@" |
James Zern | e8d58d3 | 2012-08-15 11:47:13 -0700 | [diff] [blame] | 224 | $(qexec)$(SRC_PATH_BARE)/build/make/gen_msvs_def.sh\ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 225 | --name=vpx\ |
| 226 | --out=$@ $^ |
| 227 | CLEAN-OBJS += vpx.def |
| 228 | |
James Zern | b92f7bc | 2014-03-04 19:46:29 -0800 | [diff] [blame] | 229 | # Assembly files that are included, but don't define symbols themselves. |
| 230 | # Filtered out to avoid Visual Studio build warnings. |
| 231 | ASM_INCLUDES := \ |
| 232 | third_party/x86inc/x86inc.asm \ |
| 233 | vpx_config.asm \ |
| 234 | vpx_ports/x86_abi_support.asm \ |
| 235 | |
Johann | 6eec73a | 2014-07-31 14:19:31 -0700 | [diff] [blame] | 236 | vpx.$(VCPROJ_SFX): $(CODEC_SRCS) vpx.def |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 237 | @echo " [CREATE] $@" |
Martin Storsjo | 0b4637e | 2013-05-17 00:56:46 +0300 | [diff] [blame] | 238 | $(qexec)$(GEN_VCPROJ) \ |
Jim Bankoski | 1b16e74 | 2012-07-23 12:32:59 -0700 | [diff] [blame] | 239 | $(if $(CONFIG_SHARED),--dll,--lib) \ |
| 240 | --target=$(TOOLCHAIN) \ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 241 | $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \ |
Johann | 128d2c2 | 2011-03-02 09:44:39 -0500 | [diff] [blame] | 242 | --name=vpx \ |
| 243 | --proj-guid=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74 \ |
| 244 | --module-def=vpx.def \ |
| 245 | --ver=$(CONFIG_VS_VERSION) \ |
James Zern | f66590c | 2014-06-02 16:42:14 -0700 | [diff] [blame] | 246 | --src-path-bare="$(SRC_PATH_BARE)" \ |
James Zern | b92f7bc | 2014-03-04 19:46:29 -0800 | [diff] [blame] | 247 | --out=$@ $(CFLAGS) \ |
| 248 | $(filter-out $(addprefix %, $(ASM_INCLUDES)), $^) \ |
Johann | 128d2c2 | 2011-03-02 09:44:39 -0500 | [diff] [blame] | 249 | --src-path-bare="$(SRC_PATH_BARE)" \ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 250 | |
Tom Finegan | d104b16 | 2015-05-14 10:46:44 -0700 | [diff] [blame] | 251 | PROJECTS-yes += vpx.$(VCPROJ_SFX) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 252 | |
Martin Storsjo | 0b4637e | 2013-05-17 00:56:46 +0300 | [diff] [blame] | 253 | vpx.$(VCPROJ_SFX): vpx_config.asm |
| 254 | vpx.$(VCPROJ_SFX): $(RTCD) |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 255 | |
| 256 | endif |
| 257 | else |
| 258 | LIBVPX_OBJS=$(call objs,$(CODEC_SRCS)) |
Tom Finegan | d104b16 | 2015-05-14 10:46:44 -0700 | [diff] [blame] | 259 | OBJS-yes += $(LIBVPX_OBJS) |
| 260 | LIBS-$(if yes,$(CONFIG_STATIC)) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 261 | $(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS) |
John Koleszar | 7aa97a3 | 2010-06-03 10:29:04 -0400 | [diff] [blame] | 262 | |
Johann | bb5a39c | 2015-03-23 15:33:17 -0700 | [diff] [blame] | 263 | SO_VERSION_MAJOR := 2 |
| 264 | SO_VERSION_MINOR := 0 |
| 265 | SO_VERSION_PATCH := 0 |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 266 | ifeq ($(filter darwin%,$(TGT_OS)),$(TGT_OS)) |
Johann | bb5a39c | 2015-03-23 15:33:17 -0700 | [diff] [blame] | 267 | LIBVPX_SO := libvpx.$(SO_VERSION_MAJOR).dylib |
KO Myung-Hun | 6d52fe2 | 2014-08-08 13:13:02 +0900 | [diff] [blame] | 268 | SHARED_LIB_SUF := .dylib |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 269 | EXPORT_FILE := libvpx.syms |
| 270 | LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \ |
| 271 | libvpx.dylib ) |
| 272 | else |
KO Myung-Hun | 6d52fe2 | 2014-08-08 13:13:02 +0900 | [diff] [blame] | 273 | ifeq ($(filter os2%,$(TGT_OS)),$(TGT_OS)) |
| 274 | LIBVPX_SO := libvpx$(SO_VERSION_MAJOR).dll |
| 275 | SHARED_LIB_SUF := _dll.a |
| 276 | EXPORT_FILE := libvpx.def |
| 277 | LIBVPX_SO_SYMLINKS := |
| 278 | LIBVPX_SO_IMPLIB := libvpx_dll.a |
| 279 | else |
Johann | bb5a39c | 2015-03-23 15:33:17 -0700 | [diff] [blame] | 280 | LIBVPX_SO := libvpx.so.$(SO_VERSION_MAJOR).$(SO_VERSION_MINOR).$(SO_VERSION_PATCH) |
KO Myung-Hun | 6d52fe2 | 2014-08-08 13:13:02 +0900 | [diff] [blame] | 281 | SHARED_LIB_SUF := .so |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 282 | EXPORT_FILE := libvpx.ver |
John Koleszar | 7aa97a3 | 2010-06-03 10:29:04 -0400 | [diff] [blame] | 283 | LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \ |
Johann | bb5a39c | 2015-03-23 15:33:17 -0700 | [diff] [blame] | 284 | libvpx.so libvpx.so.$(SO_VERSION_MAJOR) \ |
| 285 | libvpx.so.$(SO_VERSION_MAJOR).$(SO_VERSION_MINOR)) |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 286 | endif |
KO Myung-Hun | 6d52fe2 | 2014-08-08 13:13:02 +0900 | [diff] [blame] | 287 | endif |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 288 | |
Tom Finegan | 556ff27 | 2015-05-14 11:20:34 -0700 | [diff] [blame] | 289 | LIBS-$(CONFIG_SHARED) += $(BUILD_PFX)$(LIBVPX_SO)\ |
KO Myung-Hun | 6d52fe2 | 2014-08-08 13:13:02 +0900 | [diff] [blame] | 290 | $(notdir $(LIBVPX_SO_SYMLINKS)) \ |
| 291 | $(if $(LIBVPX_SO_IMPLIB), $(BUILD_PFX)$(LIBVPX_SO_IMPLIB)) |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 292 | $(BUILD_PFX)$(LIBVPX_SO): $(LIBVPX_OBJS) $(EXPORT_FILE) |
| 293 | $(BUILD_PFX)$(LIBVPX_SO): extralibs += -lm |
Johann | bb5a39c | 2015-03-23 15:33:17 -0700 | [diff] [blame] | 294 | $(BUILD_PFX)$(LIBVPX_SO): SONAME = libvpx.so.$(SO_VERSION_MAJOR) |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 295 | $(BUILD_PFX)$(LIBVPX_SO): EXPORTS_FILE = $(EXPORT_FILE) |
John Koleszar | 7aa97a3 | 2010-06-03 10:29:04 -0400 | [diff] [blame] | 296 | |
| 297 | libvpx.ver: $(call enabled,CODEC_EXPORTS) |
| 298 | @echo " [CREATE] $@" |
| 299 | $(qexec)echo "{ global:" > $@ |
| 300 | $(qexec)for f in $?; do awk '{print $$2";"}' < $$f >>$@; done |
| 301 | $(qexec)echo "local: *; };" >> $@ |
| 302 | CLEAN-OBJS += libvpx.ver |
| 303 | |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 304 | libvpx.syms: $(call enabled,CODEC_EXPORTS) |
| 305 | @echo " [CREATE] $@" |
| 306 | $(qexec)awk '{print "_"$$2}' $^ >$@ |
| 307 | CLEAN-OBJS += libvpx.syms |
| 308 | |
KO Myung-Hun | 6d52fe2 | 2014-08-08 13:13:02 +0900 | [diff] [blame] | 309 | libvpx.def: $(call enabled,CODEC_EXPORTS) |
| 310 | @echo " [CREATE] $@" |
| 311 | $(qexec)echo LIBRARY $(LIBVPX_SO:.dll=) INITINSTANCE TERMINSTANCE > $@ |
| 312 | $(qexec)echo "DATA MULTIPLE NONSHARED" >> $@ |
| 313 | $(qexec)echo "EXPORTS" >> $@ |
| 314 | $(qexec)awk '!/vpx_svc_*/ {print "_"$$2}' $^ >>$@ |
| 315 | CLEAN-OBJS += libvpx.def |
| 316 | |
| 317 | libvpx_dll.a: $(LIBVPX_SO) |
| 318 | @echo " [IMPLIB] $@" |
| 319 | $(qexec)emximp -o $@ $< |
| 320 | CLEAN-OBJS += libvpx_dll.a |
| 321 | |
James Zern | 495b241 | 2011-07-25 15:40:36 -0700 | [diff] [blame] | 322 | define libvpx_symlink_template |
| 323 | $(1): $(2) |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 324 | @echo " [LN] $(2) $$@" |
John Koleszar | 5ebe94f | 2012-12-23 07:20:10 -0800 | [diff] [blame] | 325 | $(qexec)mkdir -p $$(dir $$@) |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 326 | $(qexec)ln -sf $(2) $$@ |
James Zern | 495b241 | 2011-07-25 15:40:36 -0700 | [diff] [blame] | 327 | endef |
| 328 | |
| 329 | $(eval $(call libvpx_symlink_template,\ |
| 330 | $(addprefix $(BUILD_PFX),$(notdir $(LIBVPX_SO_SYMLINKS))),\ |
| 331 | $(BUILD_PFX)$(LIBVPX_SO))) |
| 332 | $(eval $(call libvpx_symlink_template,\ |
| 333 | $(addprefix $(DIST_DIR)/,$(LIBVPX_SO_SYMLINKS)),\ |
John Koleszar | 5ebe94f | 2012-12-23 07:20:10 -0800 | [diff] [blame] | 334 | $(LIBVPX_SO))) |
John Koleszar | 7aa97a3 | 2010-06-03 10:29:04 -0400 | [diff] [blame] | 335 | |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 336 | |
Tom Finegan | 556ff27 | 2015-05-14 11:20:34 -0700 | [diff] [blame] | 337 | INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBVPX_SO_SYMLINKS) |
| 338 | INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBSUBDIR)/$(LIBVPX_SO) |
KO Myung-Hun | 6d52fe2 | 2014-08-08 13:13:02 +0900 | [diff] [blame] | 339 | INSTALL-LIBS-$(CONFIG_SHARED) += $(if $(LIBVPX_SO_IMPLIB),$(LIBSUBDIR)/$(LIBVPX_SO_IMPLIB)) |
jimbankoski | 45e551b | 2012-07-25 19:39:33 -0700 | [diff] [blame] | 340 | |
Ralph Giles | 607f842 | 2011-03-28 12:04:51 -0700 | [diff] [blame] | 341 | |
Tom Finegan | d104b16 | 2015-05-14 10:46:44 -0700 | [diff] [blame] | 342 | LIBS-yes += vpx.pc |
Ralph Giles | 607f842 | 2011-03-28 12:04:51 -0700 | [diff] [blame] | 343 | vpx.pc: config.mk libs.mk |
| 344 | @echo " [CREATE] $@" |
| 345 | $(qexec)echo '# pkg-config file from libvpx $(VERSION_STRING)' > $@ |
| 346 | $(qexec)echo 'prefix=$(PREFIX)' >> $@ |
| 347 | $(qexec)echo 'exec_prefix=$${prefix}' >> $@ |
Takanori MATSUURA | a7eea3e | 2012-04-20 15:11:46 -0700 | [diff] [blame] | 348 | $(qexec)echo 'libdir=$${prefix}/$(LIBSUBDIR)' >> $@ |
Ralph Giles | 607f842 | 2011-03-28 12:04:51 -0700 | [diff] [blame] | 349 | $(qexec)echo 'includedir=$${prefix}/include' >> $@ |
| 350 | $(qexec)echo '' >> $@ |
| 351 | $(qexec)echo 'Name: vpx' >> $@ |
| 352 | $(qexec)echo 'Description: WebM Project VPx codec implementation' >> $@ |
| 353 | $(qexec)echo 'Version: $(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)' >> $@ |
| 354 | $(qexec)echo 'Requires:' >> $@ |
| 355 | $(qexec)echo 'Conflicts:' >> $@ |
Ronald S. Bultje | a742a73 | 2012-06-25 09:58:09 -0700 | [diff] [blame] | 356 | $(qexec)echo 'Libs: -L$${libdir} -lvpx -lm' >> $@ |
Johann | b46d58a | 2013-01-18 11:31:22 -0800 | [diff] [blame] | 357 | ifeq ($(HAVE_PTHREAD_H),yes) |
John Koleszar | bd6ffaa | 2012-08-21 10:54:30 -0700 | [diff] [blame] | 358 | $(qexec)echo 'Libs.private: -lm -lpthread' >> $@ |
Johann | b46d58a | 2013-01-18 11:31:22 -0800 | [diff] [blame] | 359 | else |
| 360 | $(qexec)echo 'Libs.private: -lm' >> $@ |
| 361 | endif |
Ralph Giles | 607f842 | 2011-03-28 12:04:51 -0700 | [diff] [blame] | 362 | $(qexec)echo 'Cflags: -I$${includedir}' >> $@ |
| 363 | INSTALL-LIBS-yes += $(LIBSUBDIR)/pkgconfig/vpx.pc |
| 364 | INSTALL_MAPS += $(LIBSUBDIR)/pkgconfig/%.pc %.pc |
| 365 | CLEAN-OBJS += vpx.pc |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 366 | endif |
| 367 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 368 | # |
| 369 | # Rule to make assembler configuration file from C configuration file |
| 370 | # |
| 371 | ifeq ($(ARCH_X86)$(ARCH_X86_64),yes) |
| 372 | # YASM |
| 373 | $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h |
| 374 | @echo " [CREATE] $@" |
| 375 | @egrep "#define [A-Z0-9_]+ [01]" $< \ |
| 376 | | awk '{print $$2 " equ " $$3}' > $@ |
| 377 | else |
| 378 | ADS2GAS=$(if $(filter yes,$(CONFIG_GCC)),| $(ASM_CONVERSION)) |
| 379 | $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h |
| 380 | @echo " [CREATE] $@" |
| 381 | @egrep "#define [A-Z0-9_]+ [01]" $< \ |
| 382 | | awk '{print $$2 " EQU " $$3}' $(ADS2GAS) > $@ |
| 383 | @echo " END" $(ADS2GAS) >> $@ |
| 384 | CLEAN-OBJS += $(BUILD_PFX)vpx_config.asm |
| 385 | endif |
| 386 | |
| 387 | # |
Johann | 6eec73a | 2014-07-31 14:19:31 -0700 | [diff] [blame] | 388 | # Add assembler dependencies for configuration. |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 389 | # |
Johann | 128d2c2 | 2011-03-02 09:44:39 -0500 | [diff] [blame] | 390 | $(filter %.s.o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm |
| 391 | $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 392 | |
Johann | 40dcae9 | 2011-02-04 17:44:31 -0500 | [diff] [blame] | 393 | |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 394 | $(shell $(SRC_PATH_BARE)/build/make/version.sh "$(SRC_PATH_BARE)" $(BUILD_PFX)vpx_version.h) |
| 395 | CLEAN-OBJS += $(BUILD_PFX)vpx_version.h |
| 396 | |
John Koleszar | a910049 | 2011-08-19 14:06:00 -0400 | [diff] [blame] | 397 | |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 398 | ## |
| 399 | ## libvpx test directives |
| 400 | ## |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 401 | ifeq ($(CONFIG_UNIT_TESTS),yes) |
John Koleszar | 0074863 | 2012-06-20 14:45:22 -0700 | [diff] [blame] | 402 | LIBVPX_TEST_DATA_PATH ?= . |
John Koleszar | e82d261 | 2012-05-16 16:25:51 -0700 | [diff] [blame] | 403 | |
| 404 | include $(SRC_PATH_BARE)/test/test.mk |
| 405 | LIBVPX_TEST_SRCS=$(addprefix test/,$(call enabled,LIBVPX_TEST_SRCS)) |
James Zern | b0789cd | 2015-05-11 19:04:48 -0700 | [diff] [blame] | 406 | LIBVPX_TEST_BIN=./test_libvpx$(EXE_SFX) |
John Koleszar | 0074863 | 2012-06-20 14:45:22 -0700 | [diff] [blame] | 407 | LIBVPX_TEST_DATA=$(addprefix $(LIBVPX_TEST_DATA_PATH)/,\ |
| 408 | $(call enabled,LIBVPX_TEST_DATA)) |
| 409 | libvpx_test_data_url=http://downloads.webmproject.org/test_data/libvpx/$(1) |
| 410 | |
James Zern | 0d2f348 | 2015-05-11 19:36:59 -0700 | [diff] [blame] | 411 | TEST_INTRA_PRED_SPEED_BIN=./test_intra_pred_speed$(EXE_SFX) |
| 412 | TEST_INTRA_PRED_SPEED_SRCS=$(addprefix test/,$(call enabled,TEST_INTRA_PRED_SPEED_SRCS)) |
James Zern | 39d93f3 | 2015-06-09 19:30:46 -0700 | [diff] [blame] | 413 | TEST_INTRA_PRED_SPEED_OBJS := $(sort $(call objs,$(TEST_INTRA_PRED_SPEED_SRCS))) |
James Zern | 0d2f348 | 2015-05-11 19:36:59 -0700 | [diff] [blame] | 414 | |
James Zern | 4a7cebe | 2013-06-25 13:50:30 -0700 | [diff] [blame] | 415 | libvpx_test_srcs.txt: |
| 416 | @echo " [CREATE] $@" |
James Zern | 0f96f02 | 2015-02-26 20:48:40 -0800 | [diff] [blame] | 417 | @echo $(LIBVPX_TEST_SRCS) | xargs -n1 echo | LC_ALL=C sort -u > $@ |
James Zern | 4a7cebe | 2013-06-25 13:50:30 -0700 | [diff] [blame] | 418 | CLEAN-OBJS += libvpx_test_srcs.txt |
| 419 | |
Adrian Grange | 5b23666 | 2013-09-16 11:46:00 -0700 | [diff] [blame] | 420 | $(LIBVPX_TEST_DATA): $(SRC_PATH_BARE)/test/test-data.sha1 |
John Koleszar | 0074863 | 2012-06-20 14:45:22 -0700 | [diff] [blame] | 421 | @echo " [DOWNLOAD] $@" |
| 422 | $(qexec)trap 'rm -f $@' INT TERM &&\ |
| 423 | curl -L -o $@ $(call libvpx_test_data_url,$(@F)) |
| 424 | |
| 425 | testdata:: $(LIBVPX_TEST_DATA) |
James Zern | d6fd229 | 2014-07-29 20:43:56 -0700 | [diff] [blame] | 426 | $(qexec)[ -x "$$(which sha1sum)" ] && sha1sum=sha1sum;\ |
| 427 | [ -x "$$(which shasum)" ] && sha1sum=shasum;\ |
| 428 | [ -x "$$(which sha1)" ] && sha1sum=sha1;\ |
| 429 | if [ -n "$${sha1sum}" ]; then\ |
James Zern | 23fbef2 | 2014-07-29 20:31:23 -0700 | [diff] [blame] | 430 | set -e;\ |
John Koleszar | 0074863 | 2012-06-20 14:45:22 -0700 | [diff] [blame] | 431 | echo "Checking test data:";\ |
John Koleszar | acd147c | 2012-06-29 12:15:00 -0700 | [diff] [blame] | 432 | if [ -n "$(LIBVPX_TEST_DATA)" ]; then\ |
| 433 | for f in $(call enabled,LIBVPX_TEST_DATA); do\ |
| 434 | grep $$f $(SRC_PATH_BARE)/test/test-data.sha1 |\ |
James Zern | d6fd229 | 2014-07-29 20:43:56 -0700 | [diff] [blame] | 435 | (cd $(LIBVPX_TEST_DATA_PATH); $${sha1sum} -c);\ |
John Koleszar | acd147c | 2012-06-29 12:15:00 -0700 | [diff] [blame] | 436 | done; \ |
| 437 | fi; \ |
John Koleszar | 0074863 | 2012-06-20 14:45:22 -0700 | [diff] [blame] | 438 | else\ |
| 439 | echo "Skipping test data integrity check, sha1sum not found.";\ |
| 440 | fi |
John Koleszar | e82d261 | 2012-05-16 16:25:51 -0700 | [diff] [blame] | 441 | |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 442 | ifeq ($(CONFIG_EXTERNAL_BUILD),yes) |
| 443 | ifeq ($(CONFIG_MSVS),yes) |
| 444 | |
Martin Storsjo | 0b4637e | 2013-05-17 00:56:46 +0300 | [diff] [blame] | 445 | gtest.$(VCPROJ_SFX): $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 446 | @echo " [CREATE] $@" |
Martin Storsjo | 0b4637e | 2013-05-17 00:56:46 +0300 | [diff] [blame] | 447 | $(qexec)$(GEN_VCPROJ) \ |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 448 | --lib \ |
| 449 | --target=$(TOOLCHAIN) \ |
| 450 | $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \ |
| 451 | --name=gtest \ |
| 452 | --proj-guid=EC00E1EC-AF68-4D92-A255-181690D1C9B1 \ |
| 453 | --ver=$(CONFIG_VS_VERSION) \ |
| 454 | --src-path-bare="$(SRC_PATH_BARE)" \ |
Yaowu Xu | c202100 | 2012-12-04 12:28:10 -0800 | [diff] [blame] | 455 | -D_VARIADIC_MAX=10 \ |
Martin Storsjo | 0b4637e | 2013-05-17 00:56:46 +0300 | [diff] [blame] | 456 | --out=gtest.$(VCPROJ_SFX) $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \ |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 457 | -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I"$(SRC_PATH_BARE)/third_party/googletest/src" |
| 458 | |
Martin Storsjo | 0b4637e | 2013-05-17 00:56:46 +0300 | [diff] [blame] | 459 | PROJECTS-$(CONFIG_MSVS) += gtest.$(VCPROJ_SFX) |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 460 | |
Martin Storsjo | 9a5cac0 | 2013-05-18 19:57:19 +0300 | [diff] [blame] | 461 | test_libvpx.$(VCPROJ_SFX): $(LIBVPX_TEST_SRCS) vpx.$(VCPROJ_SFX) gtest.$(VCPROJ_SFX) |
John Koleszar | 7f63bfa | 2012-06-01 10:43:47 -0700 | [diff] [blame] | 462 | @echo " [CREATE] $@" |
Martin Storsjo | 0b4637e | 2013-05-17 00:56:46 +0300 | [diff] [blame] | 463 | $(qexec)$(GEN_VCPROJ) \ |
John Koleszar | 7f63bfa | 2012-06-01 10:43:47 -0700 | [diff] [blame] | 464 | --exe \ |
| 465 | --target=$(TOOLCHAIN) \ |
| 466 | --name=test_libvpx \ |
Yaowu Xu | c202100 | 2012-12-04 12:28:10 -0800 | [diff] [blame] | 467 | -D_VARIADIC_MAX=10 \ |
John Koleszar | 7f63bfa | 2012-06-01 10:43:47 -0700 | [diff] [blame] | 468 | --proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \ |
| 469 | --ver=$(CONFIG_VS_VERSION) \ |
James Zern | f66590c | 2014-06-02 16:42:14 -0700 | [diff] [blame] | 470 | --src-path-bare="$(SRC_PATH_BARE)" \ |
John Koleszar | 7f63bfa | 2012-06-01 10:43:47 -0700 | [diff] [blame] | 471 | $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \ |
| 472 | --out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \ |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 473 | -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \ |
Martin Storsjo | a37e84d | 2013-05-19 12:21:29 +0300 | [diff] [blame] | 474 | -L. -l$(CODEC_LIB) -l$(GTEST_LIB) $^ |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 475 | |
Martin Storsjo | 0b4637e | 2013-05-17 00:56:46 +0300 | [diff] [blame] | 476 | PROJECTS-$(CONFIG_MSVS) += test_libvpx.$(VCPROJ_SFX) |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 477 | |
James Zern | b0789cd | 2015-05-11 19:04:48 -0700 | [diff] [blame] | 478 | LIBVPX_TEST_BIN := $(addprefix $(TGT_OS:win64=x64)/Release/,$(notdir $(LIBVPX_TEST_BIN))) |
James Zern | 0d2f348 | 2015-05-11 19:36:59 -0700 | [diff] [blame] | 479 | |
| 480 | ifneq ($(strip $(TEST_INTRA_PRED_SPEED_OBJS)),) |
| 481 | PROJECTS-$(CONFIG_MSVS) += test_intra_pred_speed.$(VCPROJ_SFX) |
| 482 | test_intra_pred_speed.$(VCPROJ_SFX): $(TEST_INTRA_PRED_SPEED_SRCS) vpx.$(VCPROJ_SFX) gtest.$(VCPROJ_SFX) |
| 483 | @echo " [CREATE] $@" |
| 484 | $(qexec)$(GEN_VCPROJ) \ |
| 485 | --exe \ |
| 486 | --target=$(TOOLCHAIN) \ |
| 487 | --name=test_intra_pred_speed \ |
| 488 | -D_VARIADIC_MAX=10 \ |
| 489 | --proj-guid=CD837F5F-52D8-4314-A370-895D614166A7 \ |
| 490 | --ver=$(CONFIG_VS_VERSION) \ |
| 491 | --src-path-bare="$(SRC_PATH_BARE)" \ |
| 492 | $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \ |
| 493 | --out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \ |
| 494 | -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \ |
| 495 | -L. -l$(CODEC_LIB) -l$(GTEST_LIB) $^ |
| 496 | endif # TEST_INTRA_PRED_SPEED |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 497 | endif |
| 498 | else |
| 499 | |
| 500 | include $(SRC_PATH_BARE)/third_party/googletest/gtest.mk |
| 501 | GTEST_SRCS := $(addprefix third_party/googletest/src/,$(call enabled,GTEST_SRCS)) |
| 502 | GTEST_OBJS=$(call objs,$(GTEST_SRCS)) |
James Zern | e4d2c25 | 2013-06-26 18:35:11 -0700 | [diff] [blame] | 503 | ifeq ($(filter win%,$(TGT_OS)),$(TGT_OS)) |
| 504 | # Disabling pthreads globally will cause issues on darwin and possibly elsewhere |
| 505 | $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -DGTEST_HAS_PTHREAD=0 |
| 506 | endif |
James Zern | 0d2f348 | 2015-05-11 19:36:59 -0700 | [diff] [blame] | 507 | GTEST_INCLUDES := -I$(SRC_PATH_BARE)/third_party/googletest/src |
| 508 | GTEST_INCLUDES += -I$(SRC_PATH_BARE)/third_party/googletest/src/include |
| 509 | $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += $(GTEST_INCLUDES) |
Tom Finegan | d104b16 | 2015-05-14 10:46:44 -0700 | [diff] [blame] | 510 | OBJS-yes += $(GTEST_OBJS) |
| 511 | LIBS-yes += $(BUILD_PFX)libgtest.a $(BUILD_PFX)libgtest_g.a |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 512 | $(BUILD_PFX)libgtest_g.a: $(GTEST_OBJS) |
| 513 | |
John Koleszar | e82d261 | 2012-05-16 16:25:51 -0700 | [diff] [blame] | 514 | LIBVPX_TEST_OBJS=$(sort $(call objs,$(LIBVPX_TEST_SRCS))) |
James Zern | 0d2f348 | 2015-05-11 19:36:59 -0700 | [diff] [blame] | 515 | $(LIBVPX_TEST_OBJS) $(LIBVPX_TEST_OBJS:.o=.d): CXXFLAGS += $(GTEST_INCLUDES) |
Tom Finegan | d104b16 | 2015-05-14 10:46:44 -0700 | [diff] [blame] | 516 | OBJS-yes += $(LIBVPX_TEST_OBJS) |
| 517 | BINS-yes += $(LIBVPX_TEST_BIN) |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 518 | |
John Koleszar | acd147c | 2012-06-29 12:15:00 -0700 | [diff] [blame] | 519 | CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),vpx_g,vpx) |
KO Myung-Hun | 6d52fe2 | 2014-08-08 13:13:02 +0900 | [diff] [blame] | 520 | CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a) |
James Zern | 0d2f348 | 2015-05-11 19:36:59 -0700 | [diff] [blame] | 521 | TEST_LIBS := lib$(CODEC_LIB)$(CODEC_LIB_SUF) libgtest.a |
| 522 | $(LIBVPX_TEST_BIN): $(TEST_LIBS) |
James Zern | b0789cd | 2015-05-11 19:04:48 -0700 | [diff] [blame] | 523 | $(eval $(call linkerxx_template,$(LIBVPX_TEST_BIN), \ |
| 524 | $(LIBVPX_TEST_OBJS) \ |
| 525 | -L. -lvpx -lgtest $(extralibs) -lm)) |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 526 | |
James Zern | 0d2f348 | 2015-05-11 19:36:59 -0700 | [diff] [blame] | 527 | ifneq ($(strip $(TEST_INTRA_PRED_SPEED_OBJS)),) |
| 528 | $(TEST_INTRA_PRED_SPEED_OBJS) $(TEST_INTRA_PRED_SPEED_OBJS:.o=.d): CXXFLAGS += $(GTEST_INCLUDES) |
| 529 | OBJS-yes += $(TEST_INTRA_PRED_SPEED_OBJS) |
| 530 | BINS-yes += $(TEST_INTRA_PRED_SPEED_BIN) |
| 531 | |
| 532 | $(TEST_INTRA_PRED_SPEED_BIN): $(TEST_LIBS) |
| 533 | $(eval $(call linkerxx_template,$(TEST_INTRA_PRED_SPEED_BIN), \ |
| 534 | $(TEST_INTRA_PRED_SPEED_OBJS) \ |
| 535 | -L. -lvpx -lgtest $(extralibs) -lm)) |
| 536 | endif # TEST_INTRA_PRED_SPEED |
| 537 | |
James Zern | b0789cd | 2015-05-11 19:04:48 -0700 | [diff] [blame] | 538 | endif # CONFIG_UNIT_TESTS |
James Zern | 7059c1d | 2013-05-31 16:08:09 -0700 | [diff] [blame] | 539 | |
Johann | 0239f11 | 2014-01-08 15:45:14 -0800 | [diff] [blame] | 540 | # Install test sources only if codec source is included |
| 541 | INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(patsubst $(SRC_PATH_BARE)/%,%,\ |
| 542 | $(shell find $(SRC_PATH_BARE)/third_party/googletest -type f)) |
| 543 | INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(LIBVPX_TEST_SRCS) |
James Zern | 0d2f348 | 2015-05-11 19:36:59 -0700 | [diff] [blame] | 544 | INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(TEST_INTRA_PRED_SPEED_SRCS) |
Johann | 0239f11 | 2014-01-08 15:45:14 -0800 | [diff] [blame] | 545 | |
James Zern | 7059c1d | 2013-05-31 16:08:09 -0700 | [diff] [blame] | 546 | define test_shard_template |
| 547 | test:: test_shard.$(1) |
James Zern | 557ae51 | 2015-06-19 16:02:28 -0700 | [diff] [blame] | 548 | test-no-data-check:: test_shard_ndc.$(1) |
| 549 | test_shard.$(1) test_shard_ndc.$(1): $(LIBVPX_TEST_BIN) |
James Zern | 7059c1d | 2013-05-31 16:08:09 -0700 | [diff] [blame] | 550 | @set -e; \ |
James Zern | b0789cd | 2015-05-11 19:04:48 -0700 | [diff] [blame] | 551 | export GTEST_SHARD_INDEX=$(1); \ |
| 552 | export GTEST_TOTAL_SHARDS=$(2); \ |
| 553 | $(LIBVPX_TEST_BIN) |
James Zern | 557ae51 | 2015-06-19 16:02:28 -0700 | [diff] [blame] | 554 | test_shard.$(1): testdata |
James Zern | 7059c1d | 2013-05-31 16:08:09 -0700 | [diff] [blame] | 555 | .PHONY: test_shard.$(1) |
| 556 | endef |
| 557 | |
| 558 | NUM_SHARDS := 10 |
| 559 | SHARDS := 0 1 2 3 4 5 6 7 8 9 |
| 560 | $(foreach s,$(SHARDS),$(eval $(call test_shard_template,$(s),$(NUM_SHARDS)))) |
| 561 | |
James Berry | 07c71ef | 2011-11-04 11:48:30 -0400 | [diff] [blame] | 562 | endif |
| 563 | |
| 564 | ## |
| 565 | ## documentation directives |
| 566 | ## |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 567 | CLEAN-OBJS += libs.doxy |
| 568 | DOCS-yes += libs.doxy |
| 569 | libs.doxy: $(CODEC_DOC_SRCS) |
| 570 | @echo " [CREATE] $@" |
| 571 | @rm -f $@ |
| 572 | @echo "INPUT += $^" >> $@ |
John Koleszar | 0ea50ce | 2010-05-18 11:58:33 -0400 | [diff] [blame] | 573 | @echo "INCLUDE_PATH += ." >> $@; |
| 574 | @echo "ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@ |
John Koleszar | e82d261 | 2012-05-16 16:25:51 -0700 | [diff] [blame] | 575 | |
John Koleszar | a9c7597 | 2012-11-08 17:09:30 -0800 | [diff] [blame] | 576 | ## Generate rtcd.h for all objects |
James Zern | aaccf65 | 2015-02-05 19:31:38 -0800 | [diff] [blame] | 577 | ifeq ($(CONFIG_DEPENDENCY_TRACKING),yes) |
John Koleszar | a9c7597 | 2012-11-08 17:09:30 -0800 | [diff] [blame] | 578 | $(OBJS-yes:.o=.d): $(RTCD) |
James Zern | aaccf65 | 2015-02-05 19:31:38 -0800 | [diff] [blame] | 579 | else |
| 580 | $(OBJS-yes): $(RTCD) |
| 581 | endif |
John Koleszar | b72373d | 2012-10-31 13:13:19 -0700 | [diff] [blame] | 582 | |
| 583 | ## Update the global src list |
| 584 | SRCS += $(CODEC_SRCS) $(LIBVPX_TEST_SRCS) $(GTEST_SRCS) |
Tom Finegan | 7b7c843 | 2014-04-22 10:38:43 -0700 | [diff] [blame] | 585 | |
| 586 | ## |
| 587 | ## vpxdec/vpxenc tests. |
| 588 | ## |
| 589 | ifeq ($(CONFIG_UNIT_TESTS),yes) |
| 590 | TEST_BIN_PATH = . |
| 591 | ifeq ($(CONFIG_MSVS),yes) |
| 592 | # MSVC will build both Debug and Release configurations of tools in a |
| 593 | # sub directory named for the current target. Assume the user wants to |
| 594 | # run the Release tools, and assign TEST_BIN_PATH accordingly. |
| 595 | # TODO(tomfinegan): Is this adequate for ARM? |
| 596 | # TODO(tomfinegan): Support running the debug versions of tools? |
| 597 | TEST_BIN_PATH := $(addsuffix /$(TGT_OS:win64=x64)/Release, $(TEST_BIN_PATH)) |
| 598 | endif |
James Zern | 557ae51 | 2015-06-19 16:02:28 -0700 | [diff] [blame] | 599 | utiltest utiltest-no-data-check: |
Tom Finegan | 7b7c843 | 2014-04-22 10:38:43 -0700 | [diff] [blame] | 600 | $(qexec)$(SRC_PATH_BARE)/test/vpxdec.sh \ |
| 601 | --test-data-path $(LIBVPX_TEST_DATA_PATH) \ |
| 602 | --bin-path $(TEST_BIN_PATH) |
| 603 | $(qexec)$(SRC_PATH_BARE)/test/vpxenc.sh \ |
| 604 | --test-data-path $(LIBVPX_TEST_DATA_PATH) \ |
| 605 | --bin-path $(TEST_BIN_PATH) |
James Zern | 557ae51 | 2015-06-19 16:02:28 -0700 | [diff] [blame] | 606 | utiltest: testdata |
Tom Finegan | 7b7c843 | 2014-04-22 10:38:43 -0700 | [diff] [blame] | 607 | else |
James Zern | 557ae51 | 2015-06-19 16:02:28 -0700 | [diff] [blame] | 608 | utiltest utiltest-no-data-check: |
Tom Finegan | 7b7c843 | 2014-04-22 10:38:43 -0700 | [diff] [blame] | 609 | @echo Unit tests must be enabled to make the utiltest target. |
| 610 | endif |
Tom Finegan | bc27d7e | 2014-05-15 21:34:42 -0700 | [diff] [blame] | 611 | |
| 612 | ## |
| 613 | ## Example tests. |
| 614 | ## |
| 615 | ifeq ($(CONFIG_UNIT_TESTS),yes) |
| 616 | # All non-MSVC targets output example targets in a sub dir named examples. |
| 617 | EXAMPLES_BIN_PATH = examples |
| 618 | ifeq ($(CONFIG_MSVS),yes) |
| 619 | # MSVC will build both Debug and Release configurations of the examples in a |
| 620 | # sub directory named for the current target. Assume the user wants to |
| 621 | # run the Release tools, and assign EXAMPLES_BIN_PATH accordingly. |
| 622 | # TODO(tomfinegan): Is this adequate for ARM? |
| 623 | # TODO(tomfinegan): Support running the debug versions of tools? |
| 624 | EXAMPLES_BIN_PATH := $(TGT_OS:win64=x64)/Release |
| 625 | endif |
James Zern | 557ae51 | 2015-06-19 16:02:28 -0700 | [diff] [blame] | 626 | exampletest exampletest-no-data-check: examples |
Tom Finegan | bc27d7e | 2014-05-15 21:34:42 -0700 | [diff] [blame] | 627 | $(qexec)$(SRC_PATH_BARE)/test/examples.sh \ |
| 628 | --test-data-path $(LIBVPX_TEST_DATA_PATH) \ |
| 629 | --bin-path $(EXAMPLES_BIN_PATH) |
James Zern | 557ae51 | 2015-06-19 16:02:28 -0700 | [diff] [blame] | 630 | exampletest: testdata |
Tom Finegan | bc27d7e | 2014-05-15 21:34:42 -0700 | [diff] [blame] | 631 | else |
James Zern | 557ae51 | 2015-06-19 16:02:28 -0700 | [diff] [blame] | 632 | exampletest exampletest-no-data-check: |
Tom Finegan | bc27d7e | 2014-05-15 21:34:42 -0700 | [diff] [blame] | 633 | @echo Unit tests must be enabled to make the exampletest target. |
| 634 | endif |