aboutsummaryrefslogtreecommitdiffstats
path: root/mk/rte.app.mk
diff options
context:
space:
mode:
authorChristian Ehrhardt <christian.ehrhardt@canonical.com>2017-06-08 09:46:51 -0600
committerChristian Ehrhardt <christian.ehrhardt@canonical.com>2017-06-08 09:51:02 -0600
commitaab0c291a90f701b60f8c9a88cbcc265cba0ec8b (patch)
treebfa7bf9663cb9a518d81f18e3a2c792eee8fa1c8 /mk/rte.app.mk
parentce3d555e43e3795b5d9507fcfc76b7a0a92fd0d6 (diff)
Imported Upstream version 16.11.2
Change-Id: I947038e46a2c747296dc7aa7522239733ca2f659 Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Diffstat (limited to 'mk/rte.app.mk')
-rw-r--r--mk/rte.app.mk19
1 files changed, 15 insertions, 4 deletions
diff --git a/mk/rte.app.mk b/mk/rte.app.mk
index f75f0e24..725e01df 100644
--- a/mk/rte.app.mk
+++ b/mk/rte.app.mk
@@ -168,10 +168,21 @@ _LDLIBS-y += $(EXECENV_LDLIBS)
LDLIBS += $(_LDLIBS-y) $(CPU_LDLIBS) $(EXTRA_LDLIBS)
-# Eliminate duplicates without sorting
-LDLIBS := $(shell echo $(LDLIBS) | \
- awk '{for (i = 1; i <= NF; i++) { \
- if ($$i !~ /^-l.*/ || !seen[$$i]++) print $$i }}')
+# all the words except the first one
+allbutfirst = $(wordlist 2,$(words $(1)),$(1))
+
+# Eliminate duplicates without sorting, only keep the last occurrence
+filter-libs = \
+ $(if $(1),$(strip\
+ $(if \
+ $(and \
+ $(filter $(firstword $(1)),$(call allbutfirst,$(1))),\
+ $(filter -l%,$(firstword $(1)))),\
+ ,\
+ $(firstword $(1))) \
+ $(call filter-libs,$(call allbutfirst,$(1)))))
+
+LDLIBS := $(call filter-libs,$(LDLIBS))
ifeq ($(RTE_DEVEL_BUILD)$(CONFIG_RTE_BUILD_SHARED_LIB),yy)
LDFLAGS += -rpath=$(RTE_SDK_BIN)/lib