From patchwork Wed Apr 8 15:07:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Gonzalez Monroy X-Patchwork-Id: 4262 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 7A50A5A9F; Wed, 8 Apr 2015 17:07:52 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 86FC5377A for ; Wed, 8 Apr 2015 17:07:50 +0200 (CEST) Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga103.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="478376137" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by FMSMGA003.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 t38F7QUt016606 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 t38F7Q9S005630 for ; Wed, 8 Apr 2015 16:07:26 +0100 Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id t38F7QD7005626 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:22 +0100 Message-Id: <1428505645-5578-3-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 2/5] mk: always generate combined lib linker script 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" After the patch, building DPDK will always generate a linker script (name use is based on CONFIG_RTE_LIBNAME config option) that behaves as a combined library when linking against it. Signed-off-by: Sergio Gonzalez Monroy --- mk/rte.combinedlib.mk | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ mk/rte.sdkbuild.mk | 3 ++ 2 files changed, 92 insertions(+) create mode 100644 mk/rte.combinedlib.mk diff --git a/mk/rte.combinedlib.mk b/mk/rte.combinedlib.mk new file mode 100644 index 0000000..46d6ee9 --- /dev/null +++ b/mk/rte.combinedlib.mk @@ -0,0 +1,89 @@ +# BSD LICENSE +# +# Copyright(c) 2010-2015 Intel Corporation. All rights reserved. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in +# the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Intel Corporation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +include $(RTE_SDK)/mk/rte.vars.mk + +default: all + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +EXT:=.so +else +EXT:=.a +endif + +COMBINEDLIB := lib$(RTE_LIBNAME).so + +CORE_LIBS := librte_eal librte_mempool librte_malloc librte_ring +CORE_LIBS := $(addsuffix $(EXT),$(CORE_LIBS)) + +ALL_LIBS := $(wildcard $(RTE_OUTPUT)/lib/*$(EXT)) +ALL_LIBS := $(filter-out $(CORE_LIBS),$(notdir $(ALL_LIBS))) + +# If we change the combined lib name and we build dpdk without doing +# 'make uninstall', the previous linker script would be present in the dir. +filter_type = $(if $(shell file $(lib) | grep "ASCII text"),,$(lib)) +LIBS := $(foreach lib,$(ALL_LIBS),$(filter_type)) + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +LDSCRIPT = INPUT ( +else +LDSCRIPT = GROUP ( +endif + +LDSCRIPT += $(CORE_LIBS) + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +LDSCRIPT += AS_NEEDED ( +endif + +# For shared libs we do not care if we link against PMDs here, +# they will be ignored (ie. after AS_NEEDED) as there are no direct +# references to them +LDSCRIPT += $(LIBS) + +ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),y) +LDSCRIPT += ) +endif + +LDSCRIPT += ) + +all: FORCE + $(Q)echo "$(LDSCRIPT)" > $(RTE_OUTPUT)/lib/$(COMBINEDLIB) + +# +# Clean all generated files +# +.PHONY: clean +clean: + $(Q)rm -f $(RTE_OUTPUT)/lib/$(COMBINEDLIB) + +.PHONY: FORCE +FORCE: diff --git a/mk/rte.sdkbuild.mk b/mk/rte.sdkbuild.mk index 2b24e74..625e0c4 100644 --- a/mk/rte.sdkbuild.mk +++ b/mk/rte.sdkbuild.mk @@ -93,6 +93,9 @@ $(ROOTDIRS-y): @[ -d $(BUILDDIR)/$@ ] || mkdir -p $(BUILDDIR)/$@ @echo "== Build $@" $(Q)$(MAKE) S=$@ -f $(RTE_SRCDIR)/$@/Makefile -C $(BUILDDIR)/$@ all + @if [ $@ = lib ]; then \ + $(MAKE) -f $(RTE_SDK)/mk/rte.combinedlib.mk; \ + fi %_clean: @echo "== Clean $*"