2 # Copyright (C) 2013 The Android-x86 Open Source Project
4 # Licensed under the GNU General Public License Version 2 or later.
5 # You may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.gnu.org/licenses/gpl.html
12 FFDROID_DIR := $(call my-dir)
20 FF_VARS := FFLIBS OBJS ARMV5TE-OBJS ARMV6-OBJS VFP-OBJS NEON-OBJS MIPSFPU-OBJS MIPS32R2-OBJS MIPSDSPR1-OBJS MIPSDSPR2-OBJS ALTIVEC-OBJS VIS-OBJS MMX-OBJS YASM-OBJS
22 FFMPEG_ARCH := $(TARGET_ARCH)
24 FFMPEG_2ND_ARCH := false
25 ifneq ($(TARGET_2ND_ARCH_VARIANT),)
26 ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
27 ifeq ($(FFMPEG_MULTILIB),64)
28 FFMPEG_2ND_ARCH := true
31 ifeq ($(FFMPEG_MULTILIB),32)
32 FFMPEG_2ND_ARCH := true
37 ifeq ($(FFMPEG_2ND_ARCH), true)
38 FFMPEG_ARCH := $(TARGET_2ND_ARCH)
41 ifeq ($(FFMPEG_ARCH),arm64)
42 FFMPEG_ARCH := aarch64
45 $(foreach V,$(FF_VARS),$(eval $(call RESET,$(V))))
46 #$(warning INCLUDING $(wildcard $(LOCAL_PATH)/$(FFMPEG_ARCH)/Makefile) for $(FFMPEG_2ND_ARCH) - $(NEON-OBJS) - $(FF_VARS))
49 include $(FFDROID_DIR)/ffmpeg.mk
50 SUBDIR := $(FFDROID_DIR)/include/
51 include $(LOCAL_PATH)/Makefile $(wildcard $(LOCAL_PATH)/$(FFMPEG_ARCH)/Makefile)
52 include $(FFMPEG_DIR)arch.mak
54 # remove duplicate objects
55 OBJS := $(sort $(OBJS) $(OBJS-yes))
57 ASM_SUFFIX := $(if $(filter x86,$(FFMPEG_ARCH)),asm,S)
58 ALL_S_FILES := $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/$(FFMPEG_ARCH)/*.$(ASM_SUFFIX)))
59 ALL_S_FILES := $(if $(filter S,$(ASM_SUFFIX)),$(ALL_S_FILES),$(filter $(patsubst %.o,%.asm,$(YASM-OBJS) $(YASM-OBJS-yes)),$(ALL_S_FILES)))
61 ifneq ($(ALL_S_FILES),)
62 S_OBJS := $(ALL_S_FILES:%.$(ASM_SUFFIX)=%.o)
63 C_OBJS := $(filter-out $(S_OBJS),$(OBJS))
64 S_OBJS := $(filter $(S_OBJS),$(OBJS))
70 C_FILES := $(C_OBJS:%.o=%.c)
71 S_FILES := $(S_OBJS:%.o=%.$(ASM_SUFFIX))
73 LOCAL_MODULE := lib$(NAME)
74 LOCAL_MODULE_TAGS := optional
75 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
78 LOCAL_SRC_FILES := $(C_FILES) $(if $(filter S,$(ASM_SUFFIX)),$(S_FILES))
80 intermediates := $(local-intermediates-dir)
81 ifeq ($(FFMPEG_ARCH),x86)
82 GEN := $(S_OBJS:%=$(intermediates)/%)
83 $(GEN): YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm
84 $(GEN): YASMFLAGS := -felf -DPIC $(LOCAL_C_INCLUDES:%=-I%)
85 $(GEN): PRIVATE_CUSTOM_TOOL = $(YASM) $(YASMFLAGS) -Pconfig.asm -o $@ $<
86 $(GEN): $(intermediates)/%.o: $(LOCAL_PATH)/%.asm $(SUBDIR)config.asm
87 $(transform-generated-source)
88 LOCAL_GENERATED_SOURCES += $(GEN)
92 -O3 -std=c99 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -fomit-frame-pointer \
93 -Wdisabled-optimization -Wpointer-arith \
94 -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes \
95 -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses \
96 -Wno-switch -Wno-format-zero-length -Wno-pointer-sign \
97 -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes \
98 -Werror=return-type -Werror=vla -Wformat -Wno-maybe-uninitialized
100 LOCAL_LDFLAGS := -Wl,--no-fatal-warnings
102 LOCAL_SHARED_LIBRARIES := $(sort $(FFLIBS-yes:%=lib%) $(FFLIBS:%=lib%))