LOCAL_PATH := $(call my-dir)
MAIN_LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)

ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
LOCAL_MODULE := sandbox_64
LOCAL_CFLAGS := -DCORE_SO_NAME=\"libsandbox_64.so\"
else
LOCAL_MODULE := sandbox
LOCAL_CFLAGS := -DCORE_SO_NAME=\"libsandbox.so\"
endif

LOCAL_CFLAGS += -Wno-error=format-security -fpermissive -DLOG_TAG=\"SECSANDBOX\"
LOCAL_CFLAGS += -fno-rtti -fno-exceptions

LOCAL_C_INCLUDES += $(MAIN_LOCAL_PATH)
LOCAL_C_INCLUDES += $(MAIN_LOCAL_PATH)/Foundation
LOCAL_C_INCLUDES += $(MAIN_LOCAL_PATH)/Jni

LOCAL_SRC_FILES := Jni/VAJni.cpp \
				   Foundation/IOUniformer.cpp \
				   Foundation/syscall/BinarySyscallFinder.cpp \
				   Foundation/VMPatch.cpp \
				   Foundation/SymbolFinder.cpp \
				   Foundation/Symbol.cpp \
				   Foundation/Path.cpp \
				   Foundation/SandboxFs.cpp \
				   Foundation/fake_dlfcn.cpp \
				   Substrate/hde64.c \
                   Substrate/SubstrateDebug.cpp \
                   Substrate/SubstrateHook.cpp \
                   Substrate/SubstratePosixMemory.cpp \
                   A64Inlinehook/And64InlineHook.cpp

LOCAL_LDLIBS := -llog -latomic
LOCAL_STATIC_LIBRARIES := fb

include $(BUILD_SHARED_LIBRARY)
include $(MAIN_LOCAL_PATH)/fb/Android.mk