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