# FAudioGMS Android.mk file
# PS: Expect hell

SAVED_LOCAL_PATH := $(call my-dir)
LOCAL_PATH := $(SAVED_LOCAL_PATH)
SDL_PATH := $(LOCAL_PATH)/../lib/SDL
FAUDIO_PATH := $(LOCAL_PATH)/../lib/FAudio
FAUDIOGMS_PATH := $(LOCAL_PATH)/..

# First we import SDL 2

include $(SDL_PATH)/Android.mk

# Then we compile FAudio as a static library

include $(CLEAR_VARS)

LOCAL_PATH := $(SAVED_LOCAL_PATH)
LOCAL_MODULE := FAudio_static
LOCAL_MODULE_FILENAME := libFAudio

LOCAL_SHARED_LIBRARIES := SDL2

LOCAL_C_INCLUDES := $(SDL_PATH)/include $(FAUDIO_PATH)/include $(FAUDIO_PATH)/src

LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)

LOCAL_LDLIBS :=

LOCAL_EXPORT_LDLIBS := -ldl -llog -landroid

LOCAL_SRC_FILES := \
	$(FAUDIO_PATH)/src/F3DAudio.c \
	$(FAUDIO_PATH)/src/FACT3D.c \
	$(FAUDIO_PATH)/src/FACT.c \
	$(FAUDIO_PATH)/src/FACT_internal.c \
	$(FAUDIO_PATH)/src/FAPOBase.c \
	$(FAUDIO_PATH)/src/FAPOFX.c \
	$(FAUDIO_PATH)/src/FAPOFX_echo.c \
	$(FAUDIO_PATH)/src/FAPOFX_eq.c \
	$(FAUDIO_PATH)/src/FAPOFX_masteringlimiter.c \
	$(FAUDIO_PATH)/src/FAPOFX_reverb.c \
	$(FAUDIO_PATH)/src/FAudio.c \
	$(FAUDIO_PATH)/src/FAudioFX_reverb.c \
	$(FAUDIO_PATH)/src/FAudioFX_volumemeter.c \
	$(FAUDIO_PATH)/src/FAudio_internal.c \
	$(FAUDIO_PATH)/src/FAudio_internal_simd.c \
	$(FAUDIO_PATH)/src/FAudio_operationset.c \
	$(FAUDIO_PATH)/src/FAudio_platform_sdl2.c \
	$(FAUDIO_PATH)/src/FAudio_platform_win32.c \
	$(FAUDIO_PATH)/src/XNA_Song.c \
	$(FAUDIO_PATH)/src/FAudio_gstreamer.c

include $(BUILD_STATIC_LIBRARY)

# And then we do our stuff...

include $(CLEAR_VARS)

LOCAL_PATH := $(SAVED_LOCAL_PATH)

LOCAL_MODULE := FAudioGMS
# Tell ndk-build we rely on these two fellas:
LOCAL_SHARED_LIBRARIES := SDL2 FAudio_static
LOCAL_C_INCLUDES := $(SDL_PATH)/include $(FAUDIO_PATH)/include $(FAUDIOGMS_PATH)/src
LOCAL_SRC_FILES := $(FAUDIOGMS_PATH)/src/FAudioGMS.c $(LOCAL_PATH)/FAudioGMS_JNI.c

include $(BUILD_SHARED_LIBRARY)
