Add av1_convolve_ x,y _sse2()
[aom.git] / tools.mk
blob26c20d433a8fd2c98744bd5df5d58302d67a6670
1 ##
2 ## Copyright (c) 2017, Alliance for Open Media. All rights reserved
3 ##
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.
12 # List of tools to build.
13 ifeq ($(CONFIG_ENTROPY_STATS), yes)
14 TOOLS-$(CONFIG_AV1_ENCODER) += aom_entropy_optimizer.c
15 aom_entropy_optimizer.GUID = 3afa9b05-940b-4d68-b5aa-55157d8ed7b4
16 aom_entropy_optimizer.DESCRIPTION = Offline default probability optimizer
17 endif
20 # End of specified files. The rest of the build rules should happen
21 # automagically from here.
24 # Tools need different flags based on whether we're building
25 # from an installed tree or a version controlled tree. Determine
26 # the proper paths.
27 ifeq ($(HAVE_ALT_TREE_LAYOUT),yes)
28 LIB_PATH-yes := $(SRC_PATH_BARE)/../lib
29 INC_PATH-yes := $(SRC_PATH_BARE)/../include
30 else
31 LIB_PATH-yes += $(if $(BUILD_PFX),$(BUILD_PFX),.)
32 INC_PATH-$(CONFIG_AV1_DECODER) += $(SRC_PATH_BARE)/av1
33 INC_PATH-$(CONFIG_AV1_ENCODER) += $(SRC_PATH_BARE)/av1
34 endif
35 INC_PATH-$(CONFIG_LIBYUV) += $(SRC_PATH_BARE)/third_party/libyuv/include
36 LIB_PATH := $(call enabled,LIB_PATH)
37 INC_PATH := $(call enabled,INC_PATH)
38 INTERNAL_CFLAGS = $(addprefix -I,$(INC_PATH))
39 INTERNAL_LDFLAGS += $(addprefix -L,$(LIB_PATH))
41 # Expand list of selected tools to build (as specified above)
42 TOOLS = $(addprefix tools/,$(call enabled,TOOLS))
43 ALL_SRCS = $(foreach ex,$(TOOLS),$($(notdir $(ex:.c=)).SRCS))
44 CFLAGS += -I../include
45 CODEC_EXTRA_LIBS=$(sort $(call enabled,CODEC_EXTRA_LIBS))
47 ifneq ($(CONFIG_CODEC_SRCS), yes)
48 CFLAGS += -I../include/vpx
49 endif
51 # Expand all tools sources into a variable containing all sources
52 # for that tools (not just them main one specified in TOOLS)
53 # and add this file to the list (for MSVS workspace generation)
54 $(foreach ex,$(TOOLS),$(eval $(notdir $(ex:.c=)).SRCS += $(ex) tools.mk))
57 # Create build/install dependencies for all tools. The common case
58 # is handled here. The MSVS case is handled below.
59 NOT_MSVS = $(if $(CONFIG_MSVS),,yes)
60 DIST-BINS-$(NOT_MSVS) += $(addprefix bin/,$(TOOLS:.c=$(EXE_SFX)))
61 DIST-SRCS-yes += $(ALL_SRCS)
62 OBJS-$(NOT_MSVS) += $(call objs,$(ALL_SRCS))
63 BINS-$(NOT_MSVS) += $(addprefix $(BUILD_PFX),$(TOOLS:.c=$(EXE_SFX)))
65 # Instantiate linker template for all tools.
66 ifeq ($(CONFIG_OS_SUPPORT), yes)
67 CODEC_EXTRA_LIBS-$(CONFIG_AV1) += m
68 else
69 ifeq ($(CONFIG_GCC), yes)
70 CODEC_EXTRA_LIBS-$(CONFIG_AV1) += m
71 endif
72 endif
74 CODEC_LIB=$(if $(CONFIG_DEBUG_LIBS),aom_g,aom)
75 ifneq ($(filter darwin%,$(TGT_OS)),)
76 SHARED_LIB_SUF=.dylib
77 else
78 ifneq ($(filter os2%,$(TGT_OS)),)
79 SHARED_LIB_SUF=_dll.a
80 else
81 SHARED_LIB_SUF=.so
82 endif
83 endif
84 CODEC_LIB_SUF=$(if $(CONFIG_SHARED),$(SHARED_LIB_SUF),.a)
85 $(foreach bin,$(BINS-yes),\
86 $(eval $(bin):$(LIB_PATH)/lib$(CODEC_LIB)$(CODEC_LIB_SUF))\
87 $(eval $(call linker_template,$(bin),\
88 $(call objs,$($(notdir $(bin:$(EXE_SFX)=)).SRCS)) \
89 -l$(CODEC_LIB) $(addprefix -l,$(CODEC_EXTRA_LIBS))\
90 )))
92 # The following pairs define a mapping of locations in the distribution
93 # tree to locations in the source/build trees.
94 INSTALL_MAPS += src/%.c %.c
95 INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
96 INSTALL_MAPS += bin/% %
97 INSTALL_MAPS += % %
100 # Build Visual Studio Projects. We use a template here to instantiate
101 # explicit rules rather than using an implicit rule because we want to
102 # leverage make's VPATH searching rather than specifying the paths on
103 # each file in TOOLS. This has the unfortunate side effect that
104 # touching the source files trigger a rebuild of the project files
105 # even though there is no real dependency there (the dependency is on
106 # the makefiles). We may want to revisit this.
107 define vcproj_template
108 $(1): $($(1:.$(VCPROJ_SFX)=).SRCS) vpx.$(VCPROJ_SFX)
109 $(if $(quiet),@echo " [vcproj] $$@")
110 $(qexec)$$(GEN_VCPROJ)\
111 --exe\
112 --target=$$(TOOLCHAIN)\
113 --name=$$(@:.$(VCPROJ_SFX)=)\
114 --ver=$$(CONFIG_VS_VERSION)\
115 --proj-guid=$$($$(@:.$(VCPROJ_SFX)=).GUID)\
116 --src-path-bare="$(SRC_PATH_BARE)" \
117 $$(if $$(CONFIG_STATIC_MSVCRT),--static-crt) \
118 --out=$$@ $$(INTERNAL_CFLAGS) $$(CFLAGS) \
119 $$(INTERNAL_LDFLAGS) $$(LDFLAGS) $$^
120 endef
121 TOOLS_BASENAME := $(notdir $(TOOLS))
122 PROJECTS-$(CONFIG_MSVS) += $(TOOLS_BASENAME:.c=.$(VCPROJ_SFX))
123 INSTALL-BINS-$(CONFIG_MSVS) += $(foreach p,$(VS_PLATFORMS),\
124 $(addprefix bin/$(p)/,$(TOOLS_BASENAME:.c=.exe)))
125 $(foreach proj,$(call enabled,PROJECTS),\
126 $(eval $(call vcproj_template,$(proj))))