1include ../flags.mk 2include ../config.mk 3 4OUT_DIR := $(OO)/libteec 5 6.PHONY: all libteec clean 7 8all: libteec 9################################################################################ 10# Teec configuration 11################################################################################ 12MAJOR_VERSION := 1 13MINOR_VERSION := 0 14PATCH_VERSION := 0 15LIB_NAME := libteec.so 16LIB_MAJOR := $(LIB_NAME).$(MAJOR_VERSION) 17LIB_MAJ_MIN := $(LIB_NAME).$(MAJOR_VERSION).$(MINOR_VERSION) 18LIB_MAJ_MIN_P := $(LIB_NAME).$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION) 19 20TEEC_SRCS := tee_client_api.c \ 21 teec_trace.c 22ifeq ($(CFG_TEE_BENCHMARK),y) 23TEEC_SRCS += teec_benchmark.c 24endif 25 26TEEC_SRC_DIR := src 27TEEC_OBJ_DIR := $(OUT_DIR) 28TEEC_OBJS := $(patsubst %.c,$(TEEC_OBJ_DIR)/%.o, $(TEEC_SRCS)) 29TEEC_INCLUDES := \ 30 ${CURDIR}/include \ 31 ${CURDIR}/../public \ 32 33TEEC_CFLAGS := $(addprefix -I, $(TEEC_INCLUDES)) $(CFLAGS) -D_GNU_SOURCE \ 34 -DDEBUGLEVEL_$(CFG_TEE_CLIENT_LOG_LEVEL) \ 35 -DBINARY_PREFIX=\"TEEC\" 36 37ifeq ($(CFG_TEE_BENCHMARK),y) 38TEEC_CFLAGS += -DCFG_TEE_BENCHMARK 39endif 40 41TEEC_LFLAGS := $(LDFLAGS) -lpthread 42TEEC_LIBRARY := $(OUT_DIR)/$(LIB_MAJ_MIN_P) 43 44libteec: $(TEEC_LIBRARY) $(OUT_DIR)/libteec.a 45 $(VPREFIX)ln -sf $(LIB_MAJ_MIN_P) $(OUT_DIR)/$(LIB_MAJOR) 46 $(VPREFIX)ln -sf $(LIB_MAJ_MIN_P) $(OUT_DIR)/$(LIB_MAJ_MIN) 47 $(VPREFIX)ln -sf $(LIB_MAJOR) $(OUT_DIR)/$(LIB_NAME) 48 49$(TEEC_LIBRARY): $(TEEC_OBJS) 50 @echo " LINK $@" 51 $(VPREFIX)$(CC) -shared -Wl,-soname,$(LIB_MAJOR) -o $@ $+ $(TEEC_LFLAGS) 52 @echo "" 53 54$(OUT_DIR)/libteec.a: $(TEEC_OBJS) 55 @echo " AR $@" 56 $(VPREFIX)$(AR) rcs $@ $+ 57 58$(TEEC_OBJ_DIR)/%.o: ${TEEC_SRC_DIR}/%.c 59 $(VPREFIX)mkdir -p $(TEEC_OBJ_DIR) 60 @echo " CC $<" 61 $(VPREFIX)$(CC) $(TEEC_CFLAGS) -c $< -o $@ 62 63################################################################################ 64# Cleaning up configuration 65################################################################################ 66clean: 67 $(RM) $(TEEC_OBJS) $(TEEC_LIBRARY) $(OUT_DIR)/$(LIB_MAJOR) \ 68 $(OUT_DIR)/$(LIB_MAJ_MIN) $(OUT_DIR)/$(LIB_NAME) 69 $(RM) $(OUT_DIR)/libteec.a 70 $(call rmdir,$(OUT_DIR)) 71