OSDN Git Service

android: simplify makefiles
[android-x86/external-ffmpeg.git] / android / build.mk
index 62f1a91..d70b9ea 100644 (file)
@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2013 The Android-x86 Open Source Project
+# Copyright (C) 2013-2017 The Android-x86 Open Source Project
 #
 # Licensed under the GNU General Public License Version 2 or later.
 # You may not use this file except in compliance with the License.
@@ -9,53 +9,30 @@
 #
 
 ifndef FFDROID_DIR
-FFDROID_DIR := $(call my-dir)
+FFDROID_DIR := $(FFMPEG_DIR)android
 endif
 
-define RESET
-$(1) :=
-$(1)-yes :=
-endef
-
-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
-
-FFMPEG_ARCH := $(TARGET_ARCH)
-
-FFMPEG_2ND_ARCH := false
-ifneq ($(TARGET_2ND_ARCH_VARIANT),)
-   ifeq ($(TARGET_PREFER_32_BIT_APPS),true)
-       ifeq ($(FFMPEG_MULTILIB),64)
-          FFMPEG_2ND_ARCH := true
-       endif
-   else
-       ifeq ($(FFMPEG_MULTILIB),32)
-          FFMPEG_2ND_ARCH := true
-       endif
-   endif
-endif
-
-ifeq ($(FFMPEG_2ND_ARCH), true)
-    FFMPEG_ARCH := $(TARGET_2ND_ARCH)
-endif
+include $(CLEAR_VARS)
+include $(FFDROID_DIR)/ffmpeg.mk
 
-ifeq ($(FFMPEG_ARCH),arm64)
-    FFMPEG_ARCH := aarch64
+FFMPEG_ARCH_DIR := $(FFMPEG_ARCH)
+ifeq ($(FFMPEG_ARCH),x86_64)
+    FFMPEG_ARCH_DIR := x86
 endif
 
 $(foreach V,$(FF_VARS),$(eval $(call RESET,$(V))))
 #$(warning INCLUDING $(wildcard $(LOCAL_PATH)/$(FFMPEG_ARCH)/Makefile) for $(FFMPEG_2ND_ARCH) - $(NEON-OBJS) - $(FF_VARS))
 
-include $(CLEAR_VARS)
-include $(FFDROID_DIR)/ffmpeg.mk
 SUBDIR := $(FFDROID_DIR)/include/
-include $(LOCAL_PATH)/Makefile $(wildcard $(LOCAL_PATH)/$(FFMPEG_ARCH)/Makefile)
-include $(FFMPEG_DIR)arch.mak
+include $(FFDROID_DIR)/config.mak
+include $(LOCAL_PATH)/Makefile $(wildcard $(LOCAL_PATH)/$(FFMPEG_ARCH_DIR)/Makefile)
+include $(FFMPEG_DIR)ffbuild/arch.mak
 
 # remove duplicate objects
 OBJS := $(sort $(OBJS) $(OBJS-yes))
 
-ASM_SUFFIX := $(if $(filter x86,$(FFMPEG_ARCH)),asm,S)
-ALL_S_FILES := $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/$(FFMPEG_ARCH)/*.$(ASM_SUFFIX)))
+ASM_SUFFIX := $(if $(filter x86,$(FFMPEG_ARCH_DIR)),asm,S)
+ALL_S_FILES := $(subst $(LOCAL_PATH)/,,$(wildcard $(LOCAL_PATH)/$(FFMPEG_ARCH_DIR)/*.$(ASM_SUFFIX)))
 ALL_S_FILES := $(if $(filter S,$(ASM_SUFFIX)),$(ALL_S_FILES),$(filter $(patsubst %.o,%.asm,$(YASM-OBJS) $(YASM-OBJS-yes)),$(ALL_S_FILES)))
 
 ifneq ($(ALL_S_FILES),)
@@ -74,35 +51,28 @@ LOCAL_MODULE := lib$(NAME)
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
 LOCAL_ARM_MODE := arm
-ifdef TARGET_2ND_ARCH
-LOCAL_MODULE_PATH_32 := $(TARGET_OUT_VENDOR)/lib
-LOCAL_MODULE_PATH_64 := $(TARGET_OUT_VENDOR)/lib64
-else
-LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR_SHARED_LIBRARIES)
-endif
+LOCAL_PROPRIETARY_MODULE := true
 
-LOCAL_SRC_FILES := $(C_FILES) $(if $(filter S,$(ASM_SUFFIX)),$(S_FILES))
-
-intermediates := $(local-intermediates-dir)
-ifeq ($(FFMPEG_ARCH),x86)
-GEN := $(S_OBJS:%=$(intermediates)/%)
-$(GEN): YASM := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/yasm/yasm
-$(GEN): YASMFLAGS := -felf -DPIC $(LOCAL_C_INCLUDES:%=-I%)
-$(GEN): PRIVATE_CUSTOM_TOOL = $(YASM) $(YASMFLAGS) -Pconfig.asm -o $@ $<
-$(GEN): $(intermediates)/%.o: $(LOCAL_PATH)/%.asm $(SUBDIR)config.asm
-       $(transform-generated-source)
-LOCAL_GENERATED_SOURCES += $(GEN)
-endif
+LOCAL_SRC_FILES := $(C_FILES) $(S_FILES)
+
+LOCAL_C_INCLUDES := $(SUBDIR) $(FFMPEG_DIR)
+
+LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_C_INCLUDES)
 
 LOCAL_CFLAGS += \
-       -O3 -std=c99 -fno-math-errno -fno-signed-zeros -fno-tree-vectorize -fomit-frame-pointer \
-       -Wdisabled-optimization -Wpointer-arith \
-       -Wwrite-strings -Wtype-limits -Wundef -Wmissing-prototypes \
+       -O3 -std=c99 -fno-math-errno -fno-signed-zeros -fomit-frame-pointer \
        -Wno-pointer-to-int-cast -Wstrict-prototypes -Wempty-body -Wno-parentheses \
-       -Wno-switch -Wno-format-zero-length -Wno-pointer-sign \
+       -Wno-switch -Wno-format-zero-length -Wno-pointer-sign -Wno-unused-parameter \
+       -Wno-deprecated-declarations -Wno-missing-field-initializers -Wno-sign-compare \
        -Werror=format-security -Werror=implicit-function-declaration -Werror=missing-prototypes \
        -Werror=return-type -Werror=vla -Wformat -Wno-maybe-uninitialized -fPIC
 
+LOCAL_ASFLAGS_x86 := -Pconfig-x86.asm
+LOCAL_ASFLAGS_x86_64 := -Pconfig-x86_64.asm
+
 LOCAL_LDFLAGS := -Wl,--no-fatal-warnings -Wl,-Bsymbolic
 
-LOCAL_SHARED_LIBRARIES := $(sort $(FFLIBS-yes:%=lib%) $(FFLIBS:%=lib%))
+LOCAL_CLANG_CFLAGS += -Wno-unknown-attributes
+LOCAL_CLANG_ASFLAGS += $(if $(filter x86,$(FFMPEG_ARCH_DIR)),,-no-integrated-as)
+
+LOCAL_SHARED_LIBRARIES := $($(NAME)_FFLIBS:%=lib%)