1################################################################################
2# Build tee supplicant                                                         #
3################################################################################
4LOCAL_PATH := $(call my-dir)
5
6include $(CLEAR_VARS)
7LOCAL_CFLAGS += $(optee_CFLAGS)
8
9LOCAL_CFLAGS += -DDEBUGLEVEL_$(CFG_TEE_SUPP_LOG_LEVEL) \
10		-DBINARY_PREFIX=\"TEES\" \
11		-DTEE_FS_PARENT_PATH=\"$(CFG_TEE_FS_PARENT_PATH)\" \
12		-DTEEC_LOAD_PATH=\"$(CFG_TEE_CLIENT_LOAD_PATH)\"
13
14ifneq ($(TEEC_TEST_LOAD_PATH),)
15LOCAL_CFLAGS += -DTEEC_TEST_LOAD_PATH=\"$(TEEC_TEST_LOAD_PATH)\"
16endif
17
18ifeq ($(CFG_TA_TEST_PATH),y)
19LOCAL_CFLAGS += -DCFG_TA_TEST_PATH=1
20endif
21
22LOCAL_SRC_FILES += src/tee_supplicant.c \
23		   src/teec_ta_load.c \
24		   src/tee_supp_fs.c \
25		   src/rpmb.c \
26		   src/handle.c
27
28ifeq ($(CFG_GP_SOCKETS),y)
29LOCAL_SRC_FILES += src/tee_socket.c
30LOCAL_CFLAGS += -DCFG_GP_SOCKETS=1
31endif
32
33RPMB_EMU ?= 1
34ifeq ($(RPMB_EMU),1)
35LOCAL_SRC_FILES += src/sha2.c src/hmac_sha2.c
36LOCAL_CFLAGS += -DRPMB_EMU=1
37endif
38
39ifneq (,$(filter y,$(CFG_TA_GPROF_SUPPORT) $(CFG_FTRACE_SUPPORT)))
40LOCAL_SRC_FILES += src/prof.c
41endif
42
43ifeq ($(CFG_TA_GPROF_SUPPORT),y)
44LOCAL_CFLAGS += -DCFG_TA_GPROF_SUPPORT
45endif
46
47ifeq ($(CFG_TEE_SUPP_PLUGINS),y)
48LOCAL_SRC_FILES += src/plugin.c
49
50LOCAL_CFLAGS += -DTEE_SUPP_PLUGINS \
51		-DTEE_PLUGIN_LOAD_PATH=\"$(CFG_TEE_PLUGIN_LOAD_PATH)\"
52
53# Needed to dynamically load user plugins
54LOCAL_LDFLAGS += -ldl
55# Needed for dlopen()
56LOCAL_LDFLAGS += -Wl,-rpath=$(CFG_TEE_PLUGIN_LOAD_PATH)
57endif
58
59LOCAL_CFLAGS += -pthread
60
61ifeq ($(CFG_FTRACE_SUPPORT),y)
62LOCAL_CFLAGS += -DCFG_FTRACE_SUPPORT
63endif
64
65LOCAL_C_INCLUDES := $(LOCAL_PATH)/../public \
66                    $(LOCAL_PATH)/../libteec/include \
67                    $(LOCAL_PATH)/src
68
69LOCAL_SHARED_LIBRARIES := libteec
70
71LOCAL_MODULE := tee-supplicant
72LOCAL_MODULE_TAGS := optional
73LOCAL_VENDOR_MODULE := true
74include $(BUILD_EXECUTABLE)
75