OSDN Git Service

android: update rules for ffmpeg master branch
[android-x86/external-ffmpeg.git] / android / build.mk
1 #
2 # Copyright (C) 2013 The Android-x86 Open Source Project
3 #
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
7 #
8 #      http://www.gnu.org/licenses/gpl.html
9 #
10
11 ifndef FFDROID_DIR
12 FFDROID_DIR := $(call my-dir)
13 endif
14
15 include $(CLEAR_VARS)
16 include $(FFDROID_DIR)/ffmpeg.mk
17
18 FFMPEG_ARCH_DIR := $(FFMPEG_ARCH)
19 ifeq ($(FFMPEG_ARCH),x86_64)
20     FFMPEG_ARCH_DIR := x86
21 endif
22
23 $(foreach V,$(FF_VARS),$(eval $(call RESET,$(V))))
24 #$(warning INCLUDING $(wildcard $(LOCAL_PATH)/$(FFMPEG_ARCH)/Makefile) for $(FFMPEG_2ND_ARCH) - $(NEON-OBJS) - $(FF_VARS))
25
26 SUBDIR := $(FFDROID_DIR)/include/
27 include $(FFDROID_DIR)/config.mak
28 include $(LOCAL_PATH)/Makefile $(wildcard $(LOCAL_PATH)/$(FFMPEG_ARCH_DIR)/Makefile)
29 include $(FFMPEG_DIR)ffbuild/arch.mak
30
31 # remove duplicate objects
32 OBJS := $(sort $(OBJS) $(OBJS-yes))
33
34 ASM_SUFFIX := $(if $(filter x86,$(FFMPEG_ARCH_DIR)),asm,S)
35 ALL_S_FILES := $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/$(FFMPEG_ARCH_DIR)/*.$(ASM_SUFFIX)))
36 ALL_S_FILES := $(if $(filter S,$(ASM_SUFFIX)),$(ALL_S_FILES),$(filter $(patsubst %.o,%.asm,$(YASM-OBJS) $(YASM-OBJS-yes)),$(ALL_S_FILES)))
37
38 ifneq ($(ALL_S_FILES),)
39 S_OBJS := $(ALL_S_FILES:%.$(ASM_SUFFIX)=%.o)
40 C_OBJS := $(filter-out $(S_OBJS),$(OBJS))
41 S_OBJS := $(filter $(S_OBJS),$(OBJS))
42 else
43 C_OBJS := $(OBJS)
44 S_OBJS :=
45 endif
46
47 C_FILES := $(C_OBJS:%.o=%.c)
48 S_FILES := $(S_OBJS:%.o=%.$(ASM_SUFFIX))
49
50 LOCAL_MODULE := lib$(NAME)
51 LOCAL_MODULE_TAGS := optional
52 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
53 LOCAL_ARM_MODE := arm
54 ifdef TARGET_2ND_ARCH
55 LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
56 LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
57 else
58 LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)
59 endif
60
61 LOCAL_SRC_FILES := $(C_FILES) $(S_FILES)
62
63 LOCAL_CFLAGS += \
64         -O3 -std=c99 -fno-math-errno -fno-signed-zeros -fomit-frame-pointer \
65         -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses \
66         -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -Wno-unused-parameter \
67         -Wno-unknown-attributes -Wno-missing-field-initializers -Wno-sign-compare \
68         -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes \
69         -Werror=return-type -Werror=vla -Wformat -Wno-maybe-uninitialized -fPIC
70
71 LOCAL_ASFLAGS_x86 := -Pconfig-x86.asm
72 LOCAL_ASFLAGS_x86_64 := -Pconfig-x86_64.asm
73
74 LOCAL_LDFLAGS := -Wl,--no-fatal-warnings -Wl,-Bsymbolic
75
76 LOCAL_CLANG_ASFLAGS += $(if $(filter x86,$(FFMPEG_ARCH_DIR)),,-no-integrated-as)
77
78 LOCAL_SHARED_LIBRARIES := $($(NAME)_FFLIBS:%=lib%)