# =============================================================================
#
# Makefile responsible for:
# - building the Java JNI wrapper - TlcPinpad.so
# - building a test binary - pinpadTest
# - building the TLC library - libtlcPinpad.a (used by test binary + Java lib)
#
# =============================================================================

# Do not remove this - Android build needs the definition
LOCAL_PATH	:= $(call my-dir)

$(info LOCAL_PATH=$(LOCAL_PATH))


# This section is simply to make sure tui_comm.cpp can build without libcutils.so
include $(CLEAR_VARS)

LOCAL_MODULE := libcutils   # this is the fake libcutils
LOCAL_SRC_FILES := cutils.cpp

include $(BUILD_SHARED_LIBRARY)


# =============================================================================
# TLC Pinpad library - libtlcPinpad.a
include $(CLEAR_VARS)
# Module name (sets name of output binary / library)

LOCAL_MODULE	:= tlcPinpad

# Add your folders with header files here
LOCAL_C_INCLUDES += \
	$(COMP_PATH_TL_TIMA_TUI)/public \
	$(COMP_PATH_TL_TIMA_TUI)/../tz_common/public \
	$(COMP_PATH_TL_TIMA_TUI)/../tlc_comm/public \
	$(COMP_PATH_TL_TIMA_TUI)/../tz_platform/public/tlc \
	$(COMP_PATH_TL_TIMA_TUI)/../t-base-dev-kit/t-sdk_64/TlcSdk/Public \
	$(COMP_PATH_TL_TIMA_TUI)/../t-base-dev-kit/t-sdk_64/TlSdk/Public/MobiCore/inc \
	$(COMP_PATH_TL_TIMA_TUI)/../spay/public	\
	$(COMP_PATH_TL_TIMA_TUI)../tz_spay_common/public

	

# Add your source files here (relative paths)
LOCAL_SRC_FILES	+= \
	src/tlc_spay_tui.cpp \
	../../../../tz_platform/vendor/TBASE/tlc/mc_tlc_communication.cpp
#	src/tui_comm.cpp \

# Need the MobiCore client library
#LOCAL_SHARED_LIBRARIES := MobiCoreDriver


LOCAL_SHARED_LIBRARIES := MobiCoreDriver libcutils

#MY_PATH := $(LOCAL_PATH)/pai
#LOCAL_LDLIBS := -L $(LOCAL_PATH) -l tlc_proxy_tui 
#LD_LIBRARY_PATH += $(LOCAL_PATH)
#LOCAL_LDLIBS := -L$(LOCAL_PATH)/tlc_proxy_tui

LOCAL_CFLAGS += -DUSE_MOBICORE -DTUI_SUPPORTED -DUSE_SPAY_MSG

include $(COMP_PATH_Logwrapper)/Android.mk

#include $(BUILD_STATIC_LIBRARY)
include $(BUILD_SHARED_LIBRARY)


# =============================================================================
# Test program

include $(CLEAR_VARS)
LOCAL_MODULE	:= test

LOCAL_SRC_FILES	+= test/test.cpp

LOCAL_C_INCLUDES += \
	$(COMP_PATH_TL_TIMA_TUI)/public \
	$(COMP_PATH_TL_TIMA_TUI)/../tz_common/public \
	$(COMP_PATH_TL_TIMA_TUI)/../spay/public	\
	$(COMP_PATH_TL_TIMA_TUI)../tz_spay_common/public

#LOCAL_SHARED_LIBRARIES := MobiCoreDriver tlcPinpad
#LOCAL_STATIC_LIBRARIES := tlcPinpad
LOCAL_SHARED_LIBRARIES := tlcPinpad

LOCAL_CFLAGS += -DUSE_MOBICORE -DTUI_SUPPORTED -DUSE_SPAY_MSG

include $(COMP_PATH_Logwrapper)/Android.mk

include $(BUILD_EXECUTABLE)


# =============================================================================

# adding the root folder to the search path appears to make absolute paths
# work for import-module - lets see how long this works and what surprises
# future developers get from this.
$(call import-add-path,/)
$(call import-module,$(COMP_PATH_MobiCoreDriverLib))
