1include ../flags.mk 2include ../config.mk 3 4OUT_DIR := $(OO)/tee-supplicant 5 6# Emulate RPMB ioctl's by default 7RPMB_EMU ?= 1 8 9.PHONY: all tee-supplicant clean 10 11all: tee-supplicant 12################################################################################ 13# Teec configuration 14################################################################################ 15PACKAGE_NAME := tee-supplicant 16 17TEES_SRCS := tee_supplicant.c \ 18 teec_ta_load.c \ 19 tee_supp_fs.c \ 20 rpmb.c \ 21 handle.c 22 23ifeq ($(CFG_GP_SOCKETS),y) 24TEES_SRCS += tee_socket.c 25endif 26 27ifeq ($(RPMB_EMU),1) 28TEES_SRCS += sha2.c hmac_sha2.c 29endif 30ifneq (,$(filter y,$(CFG_TA_GPROF_SUPPORT) $(CFG_FTRACE_SUPPORT))) 31TEES_SRCS += prof.c 32endif 33 34ifeq ($(CFG_TEE_SUPP_PLUGINS),y) 35TEES_SRCS += plugin.c 36endif 37 38TEES_SRC_DIR := src 39TEES_OBJ_DIR := $(OUT_DIR) 40TEES_OBJS := $(patsubst %.c,$(TEES_OBJ_DIR)/%.o, $(TEES_SRCS)) 41TEES_INCLUDES := ${CURDIR}/../libteec/include \ 42 ${CURDIR}/src \ 43 ${CURDIR}/../public \ 44 45TEES_CFLAGS := $(addprefix -I, $(TEES_INCLUDES)) $(CFLAGS) \ 46 -DDEBUGLEVEL_$(CFG_TEE_SUPP_LOG_LEVEL) \ 47 -DBINARY_PREFIX=\"TEES\" \ 48 -DTEE_FS_PARENT_PATH=\"$(CFG_TEE_FS_PARENT_PATH)\" \ 49 -DTEEC_LOAD_PATH=\"$(CFG_TEE_CLIENT_LOAD_PATH)\" \ 50 51ifeq ($(CFG_GP_SOCKETS),y) 52TEES_CFLAGS += -DCFG_GP_SOCKETS=1 53endif 54ifeq ($(RPMB_EMU),1) 55TEES_CFLAGS += -DRPMB_EMU=1 56endif 57ifeq ($(CFG_TA_TEST_PATH),y) 58TEES_CFLAGS += -DCFG_TA_TEST_PATH=1 59endif 60TEES_FILE := $(OUT_DIR)/$(PACKAGE_NAME) 61TEES_LFLAGS := $(LDFLAGS) -L$(OUT_DIR)/../libteec -lteec 62 63ifeq ($(CFG_TA_GPROF_SUPPORT),y) 64TEES_CFLAGS += -DCFG_TA_GPROF_SUPPORT 65endif 66 67ifeq ($(CFG_FTRACE_SUPPORT),y) 68TEES_CFLAGS += -DCFG_FTRACE_SUPPORT 69endif 70 71ifeq ($(CFG_TEE_SUPP_PLUGINS),y) 72TEES_CFLAGS += -DTEE_SUPP_PLUGINS \ 73 -DTEE_PLUGIN_LOAD_PATH=\"$(CFG_TEE_PLUGIN_LOAD_PATH)\" 74endif 75 76TEES_LFLAGS += -lpthread 77# Needed to get clock_gettime() for for glibc versions before 2.17 78TEES_LFLAGS += -lrt 79 80ifeq ($(CFG_TEE_SUPP_PLUGINS),y) 81# Needed to dynamically load user plugins 82TEES_LFLAGS += -ldl 83# Needed for dlopen() 84TEES_LFLAGS += -Wl,-rpath=$(CFG_TEE_PLUGIN_LOAD_PATH) 85endif 86 87tee-supplicant: $(TEES_FILE) 88 89$(TEES_FILE): $(TEES_OBJS) 90 @echo " LINK $@" 91 $(VPREFIX)$(CC) -o $@ $+ $(TEES_LFLAGS) 92 @echo "" 93 94$(TEES_OBJ_DIR)/%.o: $(TEES_SRC_DIR)/%.c 95 $(VPREFIX)mkdir -p $(dir $@) 96 @echo " CC $<" 97 $(VPREFIX)$(CC) $(TEES_CFLAGS) $(TEES_CFLAGS_$(notdir $<)) -c $< -o $@ 98 99################################################################################ 100# Cleaning up configuration 101################################################################################ 102clean: 103 $(RM) $(TEES_OBJS) $(TEES_FILE) 104 $(call rmdir,$(OUT_DIR)) 105