From edf4d331dcdb757da8c50850152be4cf948d2787 Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Mon, 21 Mar 2016 13:33:57 +0200 Subject: [PATCH] mk: eliminate duplicates from libraries list 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 --- mk/rte.app.mk | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mk/rte.app.mk b/mk/rte.app.mk index a1cd9a3c72..b2ed9e2fd0 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -174,6 +174,10 @@ _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.20.1