[dpdk-dev] [PATCH v3 3/4] Add library version extenstion

Thomas Monjalon thomas.monjalon at 6wind.com
Wed Jan 14 16:48:16 CET 2015


2014-12-23 10:51, Neil Horman:
> To differentiate libraries that break ABI, we add a library version number
> suffix to the library, which must be incremented when a given libraries ABI is
> broken.  This patch enforces that addition, sets the initial abi soname
> extension to 1 for each library and creates a symlink to the base SONAME so that
> the test applications will link properly.

[...]

> --- a/mk/rte.lib.mk
> +++ b/mk/rte.lib.mk
> @@ -37,10 +37,9 @@ include $(RTE_SDK)/mk/internal/rte.depdirs-pre.mk
>  
>  # VPATH contains at least SRCDIR
>  VPATH += $(SRCDIR)
> -
>  ifeq ($(RTE_BUILD_SHARED_LIB),y)
> -LIB := $(patsubst %.a,%.so,$(LIB))
>  
> +LIB := $(patsubst %.a,%.so.$(LIBABIVER),$(LIB))
>  CPU_LDFLAGS += --version-script=$(SRCDIR)/$(EXPORT_MAP)
>  
>  endif
> @@ -63,6 +62,7 @@ build: _postbuild
>  
>  exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
>  
> +

Newline changes seem weird.

>  ifeq ($(LINK_USING_CC),1)
>  # Override the definition of LD here, since we're linking with CC
>  LD := $(CC) $(CPU_CFLAGS)
> @@ -113,6 +113,10 @@ lib_dir = [ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib;
>  #
>  ifeq ($(RTE_BUILD_SHARED_LIB),y)
>  $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
> +ifeq ($(LIBABIVER),)
> +	@echo "Must Specify a $(LIB) ABI version"
> +	@exit 1

I think (not sure) that @false is better handled than @exit in case of parallel processing.

> +endif
>  	@[ -d $(dir $@) ] || mkdir -p $(dir $@)
>  	$(if $(D),\
>  		@echo -n "$< -> $@ " ; \
> @@ -126,6 +130,7 @@ $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
>  		$(depfile_missing),\
>  		$(depfile_newer)),\
>  		$(O_TO_S_DO))
> +
>  ifeq ($(RTE_BUILD_COMBINE_LIBS),y)
>  	$(if $(or \
>          $(file_missing),\
> @@ -163,9 +168,13 @@ endif
>  # install lib in $(RTE_OUTPUT)/lib
>  #
>  $(RTE_OUTPUT)/lib/$(LIB): $(LIB)
> +	$(eval LIBSONAME := $(basename $(LIB)))
>  	@echo "  INSTALL-LIB $(LIB)"
>  	@[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib
>  	$(Q)cp -f $(LIB) $(RTE_OUTPUT)/lib
> +ifeq ($(RTE_BUILD_SHARED_LIB),y)
> +	$(Q)ln -s -f ./$(LIB) $(RTE_OUTPUT)/lib/$(LIBSONAME)
> +endif

Why using ./ ?
Why using the eval trick for $(LIBSONAME) instead of $(basename $(LIB)) ?
Even better, you could use $< instead of $(LIB), matter of taste.

-- 
Thomas


More information about the dev mailing list