Skip to content

Commit

Permalink
libteec: Makefile: Generate .so files the same way as CMake
Browse files Browse the repository at this point in the history
Update the Makefile so that the generated libteec.so file and the
corresponding symlinks match those generated by the CMake script.

Specifically, before this commit the Makefile generated the following
files:
  symlink: libteec.so -> libteec.so.1
  symlink: libteec.so.1 -> libteec.so.1.0
  file: libteec.so.1.0 (SONAME libteec.so.1.0)

With this commit the generated files are:
  symlink: libteec.so -> libteec.so.1
  symlink: libteec.so.1 -> libteec.so.1.0.0
  symlink: libteec.so.1.0 -> libteec.so.1.0.0
  file: libteec.so.1.0.0 (SONAME libteec.so.1)

The symlink "libteec.so.1.0" is kept for compatibility with existing
installations. Note that "libteec.so.1.0" is not generated by the CMake
script.

Signed-off-by: Fabian Hofmann <fabian.hofmann@fau.de>
Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
  • Loading branch information
hofmannf authored and jforissier committed Nov 21, 2018
1 parent 656e427 commit 28eea17
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions libteec/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ all: libteec
################################################################################
MAJOR_VERSION := 1
MINOR_VERSION := 0
PATCH_VERSION := 0
LIB_NAME := libteec.so
LIB_MAJOR := $(LIB_NAME).$(MAJOR_VERSION)
LIB_MAJ_MIN := $(LIB_NAME).$(MAJOR_VERSION).$(MINOR_VERSION)
LIB_MAJ_MIN_P := $(LIB_NAME).$(MAJOR_VERSION).$(MINOR_VERSION).$(PATCH_VERSION)

TEEC_SRCS := tee_client_api.c \
teec_trace.c
Expand All @@ -37,15 +39,16 @@ TEEC_CFLAGS += -DCFG_TEE_BENCHMARK
endif

TEEC_LFLAGS := $(LDFLAGS) -lpthread
TEEC_LIBRARY := $(OUT_DIR)/$(LIB_MAJ_MIN)
TEEC_LIBRARY := $(OUT_DIR)/$(LIB_MAJ_MIN_P)

libteec: $(TEEC_LIBRARY) $(OUT_DIR)/libteec.a
$(VPREFIX)ln -sf $(LIB_MAJ_MIN) $(OUT_DIR)/$(LIB_MAJOR)
$(VPREFIX)ln -sf $(LIB_MAJ_MIN_P) $(OUT_DIR)/$(LIB_MAJOR)
$(VPREFIX)ln -sf $(LIB_MAJ_MIN_P) $(OUT_DIR)/$(LIB_MAJ_MIN)
$(VPREFIX)ln -sf $(LIB_MAJOR) $(OUT_DIR)/$(LIB_NAME)

$(TEEC_LIBRARY): $(TEEC_OBJS)
@echo " LINK $@"
$(VPREFIX)$(CC) -shared -Wl,-soname,$(LIB_MAJ_MIN) $(TEEC_LFLAGS) -o $@ $+
$(VPREFIX)$(CC) -shared -Wl,-soname,$(LIB_MAJOR) $(TEEC_LFLAGS) -o $@ $+
@echo ""

$(OUT_DIR)/libteec.a: $(TEEC_OBJS)
Expand All @@ -61,6 +64,7 @@ $(TEEC_OBJ_DIR)/%.o: ${TEEC_SRC_DIR}/%.c
# Cleaning up configuration
################################################################################
clean:
$(RM) $(TEEC_OBJS) $(TEEC_LIBRARY) $(OUT_DIR)/$(LIB_MAJOR) $(OUT_DIR)/$(LIB_NAME)
$(RM) $(TEEC_OBJS) $(TEEC_LIBRARY) $(OUT_DIR)/$(LIB_MAJOR) \
$(OUT_DIR)/$(LIB_MAJ_MIN) $(OUT_DIR)/$(LIB_NAME)
$(RM) $(OUT_DIR)/libteec.a
$(call rmdir,$(OUT_DIR))

0 comments on commit 28eea17

Please sign in to comment.