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>
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