From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pmatilai@redhat.com>
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28])
 by dpdk.org (Postfix) with ESMTP id 928772BCD
 for <dev@dpdk.org>; Mon, 21 Mar 2016 12:34:30 +0100 (CET)
Received: from int-mx11.intmail.prod.int.phx2.redhat.com
 (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24])
 by mx1.redhat.com (Postfix) with ESMTPS id E026FC049E1E;
 Mon, 21 Mar 2016 11:34:29 +0000 (UTC)
Received: from sopuli.koti.laiskiainen.org.com (vpn1-7-131.ams2.redhat.com
 [10.36.7.131])
 by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 u2LBYS6C031466; Mon, 21 Mar 2016 07:34:28 -0400
From: Panu Matilainen <pmatilai@redhat.com>
To: dev@dpdk.org
Cc: ferruh.yigit@intel.com, thomas.monjalon@6wind.com
Date: Mon, 21 Mar 2016 13:33:57 +0200
Message-Id: <233492f10ac71dd9f6902eaa4bca425febc5d2c0.1458560038.git.pmatilai@redhat.com>
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24
Subject: [dpdk-dev] [PATCH 1/2] mk: Eliminate possible duplicates from LDLIBS
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: patches and discussions about DPDK <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 21 Mar 2016 11:34:31 -0000

Duplicates in LDLIBS can cause link failures from multiply defined
symbols, ensure all libraries are only mentioned once. Can't use
sorting for duplicate elimination as order is critical so awk one-liner
is used.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
---
 mk/rte.app.mk | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index a1cd9a3..f4eb5e8 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -174,6 +174,9 @@ _LDLIBS-y += --no-whole-archive
 
 LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
 
+# Eliminate duplicates without sorting
+LDLIBS := $(shell echo $(LDLIBS) | awk '{for (i = 1; i <= NF; i++) { if (!seen[$$i]++) print $$i }}')
+
 .PHONY: all
 all: install
 
-- 
2.5.0