use unaligned load
[libvpx.git] / libs.mk
blob9ded3945a71074dab21c1b52cdea9a6ea28b4869
1 ##
2 ## Copyright (c) 2010 The WebM project authors. All Rights Reserved.
3 ##
4 ## Use of this source code is governed by a BSD-style license
5 ## that can be found in the LICENSE file in the root of the source
6 ## tree. An additional intellectual property rights grant can be found
7 ## in the file PATENTS. All contributing project authors may
8 ## be found in the AUTHORS file in the root of the source tree.
9 ##
12 ASM:=$(if $(filter yes,$(CONFIG_GCC)),.asm.s,.asm)
14 CODEC_SRCS-yes += libs.mk
16 include $(SRC_PATH_BARE)/vpx/vpx_codec.mk
17 CODEC_SRCS-yes += $(addprefix vpx/,$(call enabled,API_SRCS))
19 include $(SRC_PATH_BARE)/vpx_mem/vpx_mem.mk
20 CODEC_SRCS-yes += $(addprefix vpx_mem/,$(call enabled,MEM_SRCS))
22 include $(SRC_PATH_BARE)/vpx_scale/vpx_scale.mk
23 CODEC_SRCS-yes += $(addprefix vpx_scale/,$(call enabled,SCALE_SRCS))
26 ifeq ($(CONFIG_VP8_ENCODER),yes)
27 VP8_PREFIX=vp8/
28 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8cx.mk
29 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_CX_SRCS))
30 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_CX_EXPORTS))
31 CODEC_SRCS-yes += $(VP8_PREFIX)vp8cx.mk vpx/vp8.h vpx/vp8cx.h vpx/vp8e.h
32 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8e.h include/vpx/vp8cx.h
33 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
34 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8cx.h
35 CODEC_DOC_SECTIONS += vp8 vp8_encoder
36 endif
38 ifeq ($(CONFIG_VP8_DECODER),yes)
39 VP8_PREFIX=vp8/
40 include $(SRC_PATH_BARE)/$(VP8_PREFIX)vp8dx.mk
41 CODEC_SRCS-yes += $(addprefix $(VP8_PREFIX),$(call enabled,VP8_DX_SRCS))
42 CODEC_EXPORTS-yes += $(addprefix $(VP8_PREFIX),$(VP8_DX_EXPORTS))
43 CODEC_SRCS-yes += $(VP8_PREFIX)vp8dx.mk vpx/vp8.h vpx/vp8dx.h
44 INSTALL-LIBS-yes += include/vpx/vp8.h include/vpx/vp8dx.h
45 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/$(VP8_PREFIX)/%
46 CODEC_DOC_SRCS += vpx/vp8.h vpx/vp8dx.h
47 CODEC_DOC_SECTIONS += vp8 vp8_decoder
48 endif
51 ifeq ($(CONFIG_ENCODERS),yes)
52 CODEC_DOC_SECTIONS += encoder
53 endif
54 ifeq ($(CONFIG_DECODERS),yes)
55 CODEC_DOC_SECTIONS += decoder
56 endif
59 ifeq ($(CONFIG_MSVS),yes)
60 CODEC_LIB=$(if $(CONFIG_STATIC_MSVCRT),vpxmt,vpxmd)
61 # This variable uses deferred expansion intentionally, since the results of
62 # $(wildcard) may change during the course of the Make.
63 VS_PLATFORMS = $(foreach d,$(wildcard */Release/$(CODEC_LIB).lib),$(word 1,$(subst /, ,$(d))))
64 endif
66 # The following pairs define a mapping of locations in the distribution
67 # tree to locations in the source/build trees.
68 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx/%
69 INSTALL_MAPS += include/vpx/% $(SRC_PATH_BARE)/vpx_ports/%
70 INSTALL_MAPS += $(LIBSUBDIR)/% %
71 INSTALL_MAPS += src/% $(SRC_PATH_BARE)/%
72 ifeq ($(CONFIG_MSVS),yes)
73 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Release/%)
74 INSTALL_MAPS += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/% $(p)/Debug/%)
75 endif
77 # If this is a universal (fat) binary, then all the subarchitectures have
78 # already been built and our job is to stitch them together. The
79 # BUILD_LIBVPX variable indicates whether we should be building
80 # (compiling, linking) the library. The LIPO_LIBVPX variable indicates
81 # that we're stitching.
82 $(eval $(if $(filter universal%,$(TOOLCHAIN)),LIPO_LIBVPX,BUILD_LIBVPX):=yes)
84 CODEC_SRCS-$(BUILD_LIBVPX) += build/make/version.sh
85 CODEC_SRCS-$(BUILD_LIBVPX) += vpx/vpx_integer.h
86 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/vpx_timer.h
87 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/mem.h
88 CODEC_SRCS-$(BUILD_LIBVPX) += $(BUILD_PFX)vpx_config.c
89 INSTALL-SRCS-no += $(BUILD_PFX)vpx_config.c
90 ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
91 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/emms.asm
92 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86.h
93 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86_abi_support.asm
94 CODEC_SRCS-$(BUILD_LIBVPX) += vpx_ports/x86_cpuid.c
95 endif
96 CODEC_SRCS-$(ARCH_ARM) += vpx_ports/arm_cpudetect.c
97 CODEC_SRCS-$(ARCH_ARM) += $(BUILD_PFX)vpx_config.asm
98 CODEC_EXPORTS-$(BUILD_LIBVPX) += vpx/exports_com
99 CODEC_EXPORTS-$(CONFIG_ENCODERS) += vpx/exports_enc
100 CODEC_EXPORTS-$(CONFIG_DECODERS) += vpx/exports_dec
102 INSTALL-LIBS-yes += include/vpx/vpx_codec.h
103 INSTALL-LIBS-yes += include/vpx/vpx_image.h
104 INSTALL-LIBS-yes += include/vpx/vpx_integer.h
105 INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_top.h
106 INSTALL-LIBS-yes += include/vpx/vpx_codec_impl_bottom.h
107 INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder.h
108 INSTALL-LIBS-$(CONFIG_DECODERS) += include/vpx/vpx_decoder_compat.h
109 INSTALL-LIBS-$(CONFIG_ENCODERS) += include/vpx/vpx_encoder.h
110 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
111 ifeq ($(CONFIG_MSVS),yes)
112 INSTALL-LIBS-yes += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB).lib)
113 INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/$(CODEC_LIB)d.lib)
114 INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.dll)
115 INSTALL-LIBS-$(CONFIG_SHARED) += $(foreach p,$(VS_PLATFORMS),$(LIBSUBDIR)/$(p)/vpx.exp)
116 endif
117 else
118 INSTALL-LIBS-yes += $(LIBSUBDIR)/libvpx.a
119 INSTALL-LIBS-$(CONFIG_DEBUG_LIBS) += $(LIBSUBDIR)/libvpx_g.a
120 endif
122 CODEC_SRCS=$(call enabled,CODEC_SRCS)
123 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(CODEC_SRCS)
124 INSTALL-SRCS-$(CONFIG_CODEC_SRCS) += $(call enabled,CODEC_EXPORTS)
126 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
127 ifeq ($(CONFIG_MSVS),yes)
129 ifeq ($(ARCH_ARM),yes)
130 ifeq ($(HAVE_ARMV5TE),yes)
131 ARM_ARCH=v5
132 endif
133 ifeq ($(HAVE_ARMV6),yes)
134 ARM_ARCH=v6
135 endif
136 obj_int_extract.vcproj: $(SRC_PATH_BARE)/build/make/obj_int_extract.c
137 @cp $(SRC_PATH_BARE)/build/arm-wince-vs8/obj_int_extract.bat .
138 @echo " [CREATE] $@"
139 $(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh\
140 --exe\
141 --target=$(TOOLCHAIN)\
142 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
143 --name=obj_int_extract\
144 --proj-guid=E1360C65-D375-4335-8057-7ED99CC3F9B2\
145 --out=$@ $^\
146 -I".";"$(SRC_PATH_BARE)"
148 PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.vcproj
149 PROJECTS-$(BUILD_LIBVPX) += obj_int_extract.bat
150 endif
152 vpx.def: $(call enabled,CODEC_EXPORTS)
153 @echo " [CREATE] $@"
154 $(SRC_PATH_BARE)/build/make/gen_msvs_def.sh\
155 --name=vpx\
156 --out=$@ $^
157 CLEAN-OBJS += vpx.def
159 vpx.vcproj: $(CODEC_SRCS) vpx.def
160 @echo " [CREATE] $@"
161 $(SRC_PATH_BARE)/build/make/gen_msvs_proj.sh\
162 --lib\
163 --target=$(TOOLCHAIN)\
164 $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
165 --name=vpx\
166 --proj-guid=DCE19DAF-69AC-46DB-B14A-39F0FAA5DB74\
167 --module-def=vpx.def\
168 --ver=$(CONFIG_VS_VERSION)\
169 --out=$@ $(CFLAGS) $^\
171 PROJECTS-$(BUILD_LIBVPX) += vpx.vcproj
173 vpx.vcproj: vpx_config.asm
175 endif
176 else
177 LIBVPX_OBJS=$(call objs,$(CODEC_SRCS))
178 OBJS-$(BUILD_LIBVPX) += $(LIBVPX_OBJS)
179 LIBS-$(BUILD_LIBVPX) += $(BUILD_PFX)libvpx.a $(BUILD_PFX)libvpx_g.a
180 $(BUILD_PFX)libvpx_g.a: $(LIBVPX_OBJS)
182 BUILD_LIBVPX_SO := $(if $(BUILD_LIBVPX),$(CONFIG_SHARED))
183 LIBVPX_SO := libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)
184 LIBS-$(BUILD_LIBVPX_SO) += $(BUILD_PFX)$(LIBVPX_SO)
185 $(BUILD_PFX)$(LIBVPX_SO): $(LIBVPX_OBJS) libvpx.ver
186 $(BUILD_PFX)$(LIBVPX_SO): extralibs += -lm -pthread
187 $(BUILD_PFX)$(LIBVPX_SO): SONAME = libvpx.so.$(VERSION_MAJOR)
188 $(BUILD_PFX)$(LIBVPX_SO): SO_VERSION_SCRIPT = libvpx.ver
189 LIBVPX_SO_SYMLINKS := $(addprefix $(LIBSUBDIR)/, \
190 libvpx.so libvpx.so.$(VERSION_MAJOR) \
191 libvpx.so.$(VERSION_MAJOR).$(VERSION_MINOR))
193 libvpx.ver: $(call enabled,CODEC_EXPORTS)
194 @echo " [CREATE] $@"
195 $(qexec)echo "{ global:" > $@
196 $(qexec)for f in $?; do awk '{print $$2";"}' < $$f >>$@; done
197 $(qexec)echo "local: *; };" >> $@
198 CLEAN-OBJS += libvpx.ver
200 $(addprefix $(DIST_DIR)/,$(LIBVPX_SO_SYMLINKS)):
201 @echo " [LN] $@"
202 $(qexec)ln -sf $(LIBVPX_SO) $@
204 INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBVPX_SO_SYMLINKS)
205 INSTALL-LIBS-$(CONFIG_SHARED) += $(LIBSUBDIR)/$(LIBVPX_SO)
206 endif
208 LIBS-$(LIPO_LIBVPX) += libvpx.a
209 $(eval $(if $(LIPO_LIBVPX),$(call lipo_lib_template,libvpx.a)))
212 # Rule to make assembler configuration file from C configuration file
214 ifeq ($(ARCH_X86)$(ARCH_X86_64),yes)
215 # YASM
216 $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
217 @echo " [CREATE] $@"
218 @egrep "#define [A-Z0-9_]+ [01]" $< \
219 | awk '{print $$2 " equ " $$3}' > $@
220 else
221 ADS2GAS=$(if $(filter yes,$(CONFIG_GCC)),| $(ASM_CONVERSION))
222 $(BUILD_PFX)vpx_config.asm: $(BUILD_PFX)vpx_config.h
223 @echo " [CREATE] $@"
224 @egrep "#define [A-Z0-9_]+ [01]" $< \
225 | awk '{print $$2 " EQU " $$3}' $(ADS2GAS) > $@
226 @echo " END" $(ADS2GAS) >> $@
227 CLEAN-OBJS += $(BUILD_PFX)vpx_config.asm
228 endif
231 # Add assembler dependencies for configuration and offsets
233 #$(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm $(BUILD_PFX)vpx_asm_offsets.asm
234 $(filter %.s.o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
235 $(filter %.asm.o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
237 $(shell $(SRC_PATH_BARE)/build/make/version.sh "$(SRC_PATH_BARE)" $(BUILD_PFX)vpx_version.h)
238 CLEAN-OBJS += $(BUILD_PFX)vpx_version.h
240 CODEC_DOC_SRCS += vpx/vpx_codec.h \
241 vpx/vpx_decoder.h \
242 vpx/vpx_encoder.h \
243 vpx/vpx_image.h
245 CLEAN-OBJS += libs.doxy
246 DOCS-yes += libs.doxy
247 libs.doxy: $(CODEC_DOC_SRCS)
248 @echo " [CREATE] $@"
249 @rm -f $@
250 @echo "INPUT += $^" >> $@
251 @echo "PREDEFINED = VPX_CODEC_DISABLE_COMPAT" >> $@
252 @echo "INCLUDE_PATH += ." >> $@;
253 @echo "ENABLED_SECTIONS += $(sort $(CODEC_DOC_SECTIONS))" >> $@