From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 5281F683D for ; Wed, 8 Apr 2015 17:07:54 +0200 (CEST) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 08 Apr 2015 08:07:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,545,1422950400"; d="scan'208";a="692235959" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by fmsmga001.fm.intel.com with ESMTP; 08 Apr 2015 08:07:27 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id t38F7QKg016608 for ; Wed, 8 Apr 2015 16:07:26 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id t38F7QL2005644 for ; Wed, 8 Apr 2015 16:07:26 +0100 Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id t38F7Qcn005640 for dev@dpdk.org; Wed, 8 Apr 2015 16:07:26 +0100 From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Wed, 8 Apr 2015 16:07:24 +0100 Message-Id: <1428505645-5578-5-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 1.8.5.4 In-Reply-To: <1428505645-5578-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1428505645-5578-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH v3 4/5] mk: use LDLIBS when linking shared libraries X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Apr 2015 15:07:55 -0000 This patch mainly makes use of the LDLIBS variable when linking shared libraries, setting proper DT_NEEDED entries. This patch also fixes a few nits like syntax highlighting, the command string (O_TO_S_CMD) used for linking shared libraries and the displayed of dependencies when debugging is enable (D). Signed-off-by: Sergio Gonzalez Monroy --- mk/rte.lib.mk | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk index d96101a..603badf 100644 --- a/mk/rte.lib.mk +++ b/mk/rte.lib.mk @@ -62,16 +62,19 @@ build: _postbuild exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) +_LDLIBS := --as-needed $(LDLIBS) $(EXECENV_LDLIBS) --no-as-needed + ifeq ($(LINK_USING_CC),1) # Override the definition of LD here, since we're linking with CC LD := $(CC) $(CPU_CFLAGS) _CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS)) +_LDLIBS := $(call linkerprefix,$(_LDLIBS)) else _CPU_LDFLAGS := $(CPU_LDFLAGS) endif O_TO_A = $(AR) crus $(LIB) $(OBJS-y) -O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight +O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #')# fix syntax highlight O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)") O_TO_A_CMD = "cmd_$@ = $(O_TO_A_STR)" O_TO_A_DO = @set -e; \ @@ -79,9 +82,11 @@ O_TO_A_DO = @set -e; \ $(O_TO_A) && \ echo $(O_TO_A_CMD) > $(call exe2cmd,$(@)) -O_TO_S = $(LD) $(_CPU_LDFLAGS) -shared $(OBJS-y) -Wl,-soname,$(LIB) -o $(LIB) -O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight +O_TO_S = $(LD) $(_CPU_LDFLAGS) -L $(RTE_OUTPUT)/lib -Wl,-soname,$(LIB) \ + -shared $(OBJS-y) $(_LDLIBS) -o $(LIB) +O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #')# fix syntax highlight O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)") +O_TO_S_CMD = "cmd_$@ = $(O_TO_S_STR)" O_TO_S_DO = @set -e; \ echo $(O_TO_S_DISP); \ $(O_TO_S) && \ @@ -100,7 +105,7 @@ ifeq ($(LIBABIVER),) endif @[ -d $(dir $@) ] || mkdir -p $(dir $@) $(if $(D),\ - @echo -n "$< -> $@ " ; \ + @echo -n "$? -> $@ " ; \ echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_S_STR))) " ; \ echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ @@ -115,7 +120,7 @@ else $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE @[ -d $(dir $@) ] || mkdir -p $(dir $@) $(if $(D),\ - @echo -n "$< -> $@ " ; \ + @echo -n "$? -> $@ " ; \ echo -n "file_missing=$(call boolean,$(file_missing)) " ; \ echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_A_STR))) " ; \ echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \ -- 1.9.3