Skip to contentSkip to conversation

Simplify the ifdefs in rte.app.mk.

PATCH Superseded Keith Wiles 3 participants 10 messages Apr 29, 2015 7 messages not in the archive

v2 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 Simplify the ifdefs in rte.app.mk.

Trying to simplify the ifdefs in rte.app.mk to make the code more readable and maintainable by moving LDLIBS variable to use the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps instead of using LDLIBS directly.

---
 examples/dpdk_qat/Makefile         |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk                      | 254 ++++++++++---------------------------
 mk/rte.hostapp.mk                  |   4 +-
 mk/rte.shared.mk                   |  12 +-
 5 files changed, 77 insertions(+), 199 deletions(-)
examples/dpdk_qat/Makefile +2 -2
index f1e06a1..90ca1d3 100644
@@ -77,8 +77,8 @@ else
 ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
 endif
 
-LDLIBS += -L$(ICP_ROOT)/build
-LDLIBS += $(ICP_LIBRARY_PATH) \
+EXTRA_LDLIBS += -L$(ICP_ROOT)/build
+EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
                 -lz \
                 -losal \
                 -ladf_proxy \
examples/vm_power_manager/Makefile +1 -1
index 113dbc4..8fb78d4 100644
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
 CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
 CFLAGS += $(WERROR_FLAGS)
 
-LDLIBS += -lvirt
+EXTRA_LDLIBS += -lvirt
 
 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
mk/rte.app.mk +66 -188

317 lines not on this page · raw message

mk/rte.hostapp.mk +2 -2
index c44d0f8..51e8c1d 100644
@@ -58,7 +58,7 @@ build: _postbuild
 exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
 
 O_TO_EXE = $(HOSTCC) $(HOST_LDFLAGS) $(LDFLAGS_$(@)) \
-	$(EXTRA_HOST_LDFLAGS) -o $@ $(OBJS-y) $(LDLIBS)
+	$(EXTRA_HOST_LDFLAGS) -o $@ $(OBJS-y) $(LDLIBS-y)
 O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight
 O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)","  HOSTLD $(@)")
 O_TO_EXE_CMD = "cmd_$@ = $(O_TO_EXE_STR)"
@@ -72,7 +72,7 @@ O_TO_EXE_DO = @set -e; \
 # list of .a files that are linked to this application
 LDLIBS_FILES := $(wildcard \
 	$(addprefix $(RTE_OUTPUT)/lib/, \
-	$(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))))
+	$(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS-y)))))
 
 #
 # Compile executable file if needed
mk/rte.shared.mk +6 -6
index fc6b0b4..56f20bb 100644
@@ -60,10 +60,10 @@ exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
 ifeq ($(LINK_USING_CC),1)
 override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS))
 O_TO_SO = $(CC) $(call linkerprefix,$(LDFLAGS)) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
-	-shared -o $@ $(OBJS-y) $(call linkerprefix,$(LDLIBS))
+	-shared -o $@ $(OBJS-y) $(call linkerprefix,$(LDLIBS-y))
 else
 O_TO_SO = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
-	-shared -o $@ $(OBJS-y) $(LDLIBS)
+	-shared -o $@ $(OBJS-y) $(LDLIBS-y)
 endif
 
 O_TO_SO_STR = $(subst ','\'',$(O_TO_SO)) #'# fix syntax highlight
@@ -77,12 +77,12 @@ O_TO_SO_DO = @set -e; \
 -include .$(SHARED).cmd
 
 # path where libraries are retrieved
-LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter -Wl$(comma)-L%,$(LDLIBS)))
-LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS)))
+LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter -Wl$(comma)-L%,$(LDLIBS-y)))
+LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS-y)))
 
 # list of .a files that are linked to this application
-LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))
-LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter -Wl$(comma)-l%,$(LDLIBS)))
+LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS-y)))
+LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter -Wl$(comma)-l%,$(LDLIBS-y)))
 
 # list of found libraries files (useful for deps). If not found, the
 # library is silently ignored and dep won't be checked
Signature · 1 line
2.3.0
#2 lore raw

PATCH v2 2/2 Update Docs for new EXTRA_LDLIBS variable

In reply to a message not in the archive
---
 doc/build-sdk-quick.txt                          | 1 +
 doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
 doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
 3 files changed, 4 insertions(+), 1 deletion(-)
doc/build-sdk-quick.txt +1 -0
index 041a40e..26d5442 100644
@@ -13,6 +13,7 @@ Build variables
 	EXTRA_CPPFLAGS   preprocessor options
 	EXTRA_CFLAGS     compiler options
 	EXTRA_LDFLAGS    linker options
+	EXTRA_LDLIBS     linker libary options
 	RTE_KERNELDIR    linux headers path
 	CROSS     toolchain prefix
 	V         verbose
doc/guides/prog_guide/dev_kit_build_system.rst +2 -0
index cf5c96f..b8ef167 100644
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a Makefile or Command Line
 
 *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when linking.
 
+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when linking.
+
 *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when assembling.
 
 *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS when using a C preprocessor on assembly files.
doc/guides/prog_guide/dev_kit_root_make_help.rst +1 -1
index 4f30192..fdc5fea 100644
@@ -205,7 +205,7 @@ The following variables can be specified on the command line:
 
     Enable dependency debugging. This provides some useful information about why a target is built or not.
 
-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
 
     Append specific compilation, link or asm flags.
 
Signature · 1 line
2.3.0
#4 lore raw

Re: [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

In reply to a message not in the archive
Quoted 37 lines · Keith Wiles
---
  doc/build-sdk-quick.txt                          | 1 +
  doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
  doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
  3 files changed, 4 insertions(+), 1 deletion(-)
doc/build-sdk-quick.txt +1 -0
index 041a40e..26d5442 100644
@@ -13,6 +13,7 @@ Build variables
  	EXTRA_CPPFLAGS   preprocessor options
  	EXTRA_CFLAGS     compiler options
  	EXTRA_LDFLAGS    linker options
+	EXTRA_LDLIBS     linker libary options
  	RTE_KERNELDIR    linux headers path
  	CROSS     toolchain prefix
  	V         verbose
doc/guides/prog_guide/dev_kit_build_system.rst +2 -0
index cf5c96f..b8ef167 100644
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in a Makefile or Command Line
 
  *   EXTRA_LDFLAGS: The content of this variable is appended after LDFLAGS when linking.
 
+*   EXTRA_LDLIBS: The content of this variable is appended after LDLIBS when linking.
+
  *   EXTRA_ASFLAGS: The content of this variable is appended after ASFLAGS when assembling.
 
  *   EXTRA_CPPFLAGS: The content of this variable is appended after CPPFLAGS when using a C preprocessor on assembly files.
doc/guides/prog_guide/dev_kit_root_make_help.rst +0 -0
index 4f30192..fdc5fea 100644

doc/guides/prog_guide/dev_kit_root_make_help.rst The following variables can be specified on the command line: · line 211

Quoted 8 lines
doc/guides/prog_guide/dev_kit_root_make_help.rst +1 -1
@@ -205,7 +205,7 @@ The following variables can be specified on the command line:
 
      Enable dependency debugging. This provides some useful information about why a target is built or not.
 
-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
 
      Append specific compilation, link or asm flags.
 

Do we need to remove LDLIBS from section 28.3.4?

With the current patch the value of LDLIBS in the app makefile is lost.

Sergio

#6 lore raw

Re: [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

In reply to a message not in the archive
Quoted 50 lines · Sergio
Quoted 49 lines · Keith Wiles
---
  doc/build-sdk-quick.txt                          | 1 +
  doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
  doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
  3 files changed, 4 insertions(+), 1 deletion(-)
doc/build-sdk-quick.txt +1 -0
index 041a40e..26d5442 100644
@@ -13,6 +13,7 @@ Build variables
  	EXTRA_CPPFLAGS   preprocessor options
  	EXTRA_CFLAGS     compiler options
  	EXTRA_LDFLAGS    linker options
+	EXTRA_LDLIBS     linker libary options
  	RTE_KERNELDIR    linux headers path
  	CROSS     toolchain prefix
  	V         verbose
doc/guides/prog_guide/dev_kit_build_system.rst +0 -0
index cf5c96f..b8ef167 100644
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in

a Makefile or Command Line

* EXTRA_LDFLAGS: The content of this variable is appended after
LDFLAGS when linking.

+* EXTRA_LDLIBS: The content of this variable is appended after
LDLIBS when linking.
+
* EXTRA_ASFLAGS: The content of this variable is appended after
ASFLAGS when assembling.

* EXTRA_CPPFLAGS: The content of this variable is appended after
CPPFLAGS when using a C preprocessor on assembly files.

doc/guides/prog_guide/dev_kit_root_make_help.rst +0 -0
index 4f30192..fdc5fea 100644
@@ -205,7 +205,7 @@ The following variables can be specified on the

command line:

Enable dependency debugging. This provides some useful
information about why a target is built or not.

Quoted 7 lines
Quoted 6 lines
doc/guides/prog_guide/dev_kit_root_make_help.rst +1 -1
-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=,

EXTRA_CPPFLAGS=

Append specific compilation, link or asm flags.

Do we need to remove LDLIBS from section 28.3.4?

Missed it, but it should be LDLIBS-y now

Quoted 4 lines

With the current patch the value of LDLIBS in the app makefile is lost.

Sergio

#8 lore raw

Re: [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

In reply to a message not in the archive
Quoted 54 lines · Keith
Quoted 50 lines · Sergio
Quoted 49 lines · Keith Wiles
---
   doc/build-sdk-quick.txt                          | 1 +
   doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
   doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
   3 files changed, 4 insertions(+), 1 deletion(-)
doc/build-sdk-quick.txt +1 -0
index 041a40e..26d5442 100644
@@ -13,6 +13,7 @@ Build variables
   	EXTRA_CPPFLAGS   preprocessor options
   	EXTRA_CFLAGS     compiler options
   	EXTRA_LDFLAGS    linker options
+	EXTRA_LDLIBS     linker libary options
   	RTE_KERNELDIR    linux headers path
   	CROSS     toolchain prefix
   	V         verbose
doc/guides/prog_guide/dev_kit_build_system.rst +0 -0
index cf5c96f..b8ef167 100644
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User in

a Makefile or Command Line

* EXTRA_LDFLAGS: The content of this variable is appended after
LDFLAGS when linking.

+* EXTRA_LDLIBS: The content of this variable is appended after
LDLIBS when linking.
+
* EXTRA_ASFLAGS: The content of this variable is appended after
ASFLAGS when assembling.

* EXTRA_CPPFLAGS: The content of this variable is appended after
CPPFLAGS when using a C preprocessor on assembly files.

doc/guides/prog_guide/dev_kit_root_make_help.rst +0 -0
index 4f30192..fdc5fea 100644
@@ -205,7 +205,7 @@ The following variables can be specified on the

command line:

Enable dependency debugging. This provides some useful
information about why a target is built or not.

Quoted 8 lines
Quoted 7 lines
Quoted 6 lines
doc/guides/prog_guide/dev_kit_root_make_help.rst +1 -1
-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=,

EXTRA_CPPFLAGS=

Append specific compilation, link or asm flags.

Do we need to remove LDLIBS from section 28.3.4?

Missed it, but it should be LDLIBS-y now

It would still be lost cause you are resetting LDLIBS-y value at the start of rte.app.mk, right? The only way to add to LDLIBS-y would be using EXTRA_LDLIBS.

Sergio

Quoted 3 lines
Quoted 3 lines

With the current patch the value of LDLIBS in the app makefile is lost.

Sergio

#15 lore raw
In reply to a message not in the archive
Quoted 8 lines · Keith Wiles

Trying to simplify the ifdefs in rte.app.mk to make the code more readable and maintainable by moving LDLIBS variable to use the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps instead of using LDLIBS directly.

Since EXTRA_* flags are designed that they can be overridden on the makefile, what happens if someone does a compile via: "EXTRA_LDLIBS=X make"? Does the compile/link still work?

/Bruce

Quoted 421 lines
---
 examples/dpdk_qat/Makefile         |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk                      | 254 ++++++++++---------------------------
 mk/rte.hostapp.mk                  |   4 +-
 mk/rte.shared.mk                   |  12 +-
 5 files changed, 77 insertions(+), 199 deletions(-)
examples/dpdk_qat/Makefile +2 -2
index f1e06a1..90ca1d3 100644
@@ -77,8 +77,8 @@ else
 ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
 endif
 
-LDLIBS += -L$(ICP_ROOT)/build
-LDLIBS += $(ICP_LIBRARY_PATH) \
+EXTRA_LDLIBS += -L$(ICP_ROOT)/build
+EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
                 -lz \
                 -losal \
                 -ladf_proxy \
examples/vm_power_manager/Makefile +1 -1
index 113dbc4..8fb78d4 100644
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
 CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
 CFLAGS += $(WERROR_FLAGS)
 
-LDLIBS += -lvirt
+EXTRA_LDLIBS += -lvirt
 
 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
mk/rte.app.mk +66 -188
index 62a76ae..ed471ad 100644
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif
 
 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y = -L$(RTE_SDK_BIN)/lib
 
 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)
 
-LDLIBS += --whole-archive
+LDLIBS-y += --whole-archive
 
-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS)     += -l$(RTE_LIBNAME)
 
 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
 
-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)     += -lrte_distributor
+LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)         += -lrte_reorder
 
-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)             += -lrte_kni
+LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM)         += -lrte_ivshmem
 endif
 
-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)        += -lrte_pipeline
+LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)           += -lrte_table
+LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)            += -lrte_port
+LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)           += -lrte_timer
+LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)            += -lrte_hash
+LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)        += -lrte_jobstats
+LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)             += -lrte_lpm
+LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)           += -lrte_power
+LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)             += -lrte_acl
+LDLIBS-$(CONFIG_RTE_LIBRTE_METER)           += -lrte_meter
 
-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)           += -lrte_sched
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)           += -lm
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)           += -lrt
 
-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)           += -lrte_vhost
 
 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS
 
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lpcap
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)        += -lpcap
 
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST)$(CONFIG_RTE_LIBRTE_VHOST_USER),yn)
-LDLIBS += -lfuse
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)           += -lfuse
 endif
 
-ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y)
-LDLIBS += -libverbs
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)        += -libverbs
 
-LDLIBS += --start-group
+LDLIBS-y += --start-group
 
 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
 
-ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
-LDLIBS += -lrte_kvargs
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MBUF),y)
-LDLIBS += -lrte_mbuf
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y)
-LDLIBS += -lrte_ip_frag
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
-LDLIBS += -lethdev
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
-LDLIBS += -lrte_malloc
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y)
-LDLIBS += -lrte_mempool
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_RING),y)
-LDLIBS += -lrte_ring
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
-LDLIBS += -lrte_eal
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
-LDLIBS += -lrte_cmdline
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_CFGFILE),y)
-LDLIBS += -lrte_cfgfile
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
-LDLIBS += -lrte_pmd_bond
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y)
-LDLIBS += -lrte_pmd_xenvirt
-LDLIBS += -lxenstore
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS)          += -lrte_kvargs
+LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF)            += -lrte_mbuf
+LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG)         += -lrte_ip_frag
+LDLIBS-$(CONFIG_RTE_LIBRTE_ETHER)           += -lethdev
+LDLIBS-$(CONFIG_RTE_LIBRTE_MALLOC)          += -lrte_malloc
+LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL)         += -lrte_mempool
+LDLIBS-$(CONFIG_RTE_LIBRTE_RING)            += -lrte_ring
+LDLIBS-$(CONFIG_RTE_LIBRTE_EAL)             += -lrte_eal
+LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE)         += -lrte_cmdline
+LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE)         += -lrte_cfgfile
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND)        += -lrte_pmd_bond
+
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT)     += -lrte_pmd_xenvirt
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT)     += -lxenstore
 
 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
 # plugins (link only if static libraries)
 
-ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y)
-LDLIBS += -lrte_pmd_vmxnet3_uio
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VIRTIO_PMD),y)
-LDLIBS += -lrte_pmd_virtio
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ENIC_PMD),y)
-LDLIBS += -lrte_pmd_enic
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)
-LDLIBS += -lrte_pmd_i40e
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_FM10K_PMD),y)
-LDLIBS += -lrte_pmd_fm10k
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
-LDLIBS += -lrte_pmd_ixgbe
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_E1000_PMD),y)
-LDLIBS += -lrte_pmd_e1000
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y)
-LDLIBS += -lrte_pmd_mlx4
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
-LDLIBS += -lrte_pmd_ring
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lrte_pmd_pcap
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_AF_PACKET),y)
-LDLIBS += -lrte_pmd_af_packet
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_NULL),y)
-LDLIBS += -lrte_pmd_null
-endif
-
-endif # plugins
+LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD)     += -lrte_pmd_vmxnet3_uio
+LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD)      += -lrte_pmd_virtio
+LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD)        += -lrte_pmd_enic
+LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD)        += -lrte_pmd_i40e
+LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD)       += -lrte_pmd_fm10k
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)       += -lrte_pmd_ixgbe
+LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD)       += -lrte_pmd_e1000
+LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)        += -lrte_pmd_mlx4
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING)        += -lrte_pmd_ring
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)        += -lrte_pmd_pcap
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET)   += -lrte_pmd_af_packet
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL)        += -lrte_pmd_null
+
+endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB)
 
 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS
 
-LDLIBS += $(EXECENV_LDLIBS)
-
-LDLIBS += --end-group
-
-LDLIBS += --no-whole-archive
+LDLIBS-y += $(EXECENV_LDLIBS)
+LDLIBS-y += --end-group
+LDLIBS-y += --no-whole-archive
 
 endif # ifeq ($(NO_AUTOLIBS),)
 
-LDLIBS += $(CPU_LDLIBS)
+LDLIBS-y += $(EXTRA_LDLIBS)
 
 .PHONY: all
 all: install
@@ -286,10 +164,10 @@ ifeq ($(LINK_USING_CC),1)
 override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS))
 O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \
 	-Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(call linkerprefix,$(LDFLAGS)) \
-	$(EXTRA_LDFLAGS) $(call linkerprefix,$(LDLIBS))
+	$(EXTRA_LDFLAGS) $(call linkerprefix,$(LDLIBS-y))
 else
 O_TO_EXE = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
-	-Map=$(@).map --cref -o $@ $(OBJS-y) $(LDLIBS)
+	-Map=$(@).map --cref -o $@ $(OBJS-y) $(LDLIBS-y)
 endif
 O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight
 O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)","  LD $(@)")
@@ -302,12 +180,12 @@ O_TO_EXE_DO = @set -e; \
 -include .$(APP).cmd
 
 # path where libraries are retrieved
-LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter -Wl$(comma)-L%,$(LDLIBS)))
-LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS)))
+LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter -Wl$(comma)-L%,$(LDLIBS-y)))
+LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS-y)))
 
 # list of .a files that are linked to this application
-LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))
-LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter -Wl$(comma)-l%,$(LDLIBS)))
+LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS-y)))
+LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter -Wl$(comma)-l%,$(LDLIBS-y)))
 
 # list of found libraries files (useful for deps). If not found, the
 # library is silently ignored and dep won't be checked
mk/rte.hostapp.mk +2 -2
index c44d0f8..51e8c1d 100644
@@ -58,7 +58,7 @@ build: _postbuild
 exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
 
 O_TO_EXE = $(HOSTCC) $(HOST_LDFLAGS) $(LDFLAGS_$(@)) \
-	$(EXTRA_HOST_LDFLAGS) -o $@ $(OBJS-y) $(LDLIBS)
+	$(EXTRA_HOST_LDFLAGS) -o $@ $(OBJS-y) $(LDLIBS-y)
 O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight
 O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)","  HOSTLD $(@)")
 O_TO_EXE_CMD = "cmd_$@ = $(O_TO_EXE_STR)"
@@ -72,7 +72,7 @@ O_TO_EXE_DO = @set -e; \
 # list of .a files that are linked to this application
 LDLIBS_FILES := $(wildcard \
 	$(addprefix $(RTE_OUTPUT)/lib/, \
-	$(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))))
+	$(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS-y)))))
 
 #
 # Compile executable file if needed
mk/rte.shared.mk +6 -6
index fc6b0b4..56f20bb 100644
@@ -60,10 +60,10 @@ exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
 ifeq ($(LINK_USING_CC),1)
 override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS))
 O_TO_SO = $(CC) $(call linkerprefix,$(LDFLAGS)) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
-	-shared -o $@ $(OBJS-y) $(call linkerprefix,$(LDLIBS))
+	-shared -o $@ $(OBJS-y) $(call linkerprefix,$(LDLIBS-y))
 else
 O_TO_SO = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
-	-shared -o $@ $(OBJS-y) $(LDLIBS)
+	-shared -o $@ $(OBJS-y) $(LDLIBS-y)
 endif
 
 O_TO_SO_STR = $(subst ','\'',$(O_TO_SO)) #'# fix syntax highlight
@@ -77,12 +77,12 @@ O_TO_SO_DO = @set -e; \
 -include .$(SHARED).cmd
 
 # path where libraries are retrieved
-LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter -Wl$(comma)-L%,$(LDLIBS)))
-LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS)))
+LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter -Wl$(comma)-L%,$(LDLIBS-y)))
+LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS-y)))
 
 # list of .a files that are linked to this application
-LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))
-LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter -Wl$(comma)-l%,$(LDLIBS)))
+LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS-y)))
+LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter -Wl$(comma)-l%,$(LDLIBS-y)))
 
 # list of found libraries files (useful for deps). If not found, the
 # library is silently ignored and dep won't be checked
Signature · 1 line
2.3.0
#16 lore raw
Quoted 8 lines · Bruce
Quoted 7 lines · Keith Wiles

Trying to simplify the ifdefs in rte.app.mk to make the code more readable and maintainable by moving LDLIBS variable to use the same style as LDLIBS-y being used in the rest of the code.

Added a new variable called EXTRA_LDLIBS to be used by example apps instead of using LDLIBS directly.

Quoted 7 lines
Quoted 1 line

Since EXTRA_* flags are designed that they can be overridden on the makefile,
what happens if someone does a compile via: "EXTRA_LDLIBS=X make"? Does the
compile/link still work?

The code in rte.app.mk adds the EXTRA_LDLIBS to the end of LDLIBS-y

Quoted 438 lines

/Bruce

Quoted 434 lines
---
 examples/dpdk_qat/Makefile         |   4 +-
 examples/vm_power_manager/Makefile |   2 +-
 mk/rte.app.mk                      | 254
++++++++++---------------------------
 mk/rte.hostapp.mk                  |   4 +-
 mk/rte.shared.mk                   |  12 +-
 5 files changed, 77 insertions(+), 199 deletions(-)
examples/dpdk_qat/Makefile +2 -2
index f1e06a1..90ca1d3 100644
@@ -77,8 +77,8 @@ else
 ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a
 endif
 
-LDLIBS += -L$(ICP_ROOT)/build
-LDLIBS += $(ICP_LIBRARY_PATH) \
+EXTRA_LDLIBS += -L$(ICP_ROOT)/build
+EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \
                 -lz \
                 -losal \
                 -ladf_proxy \
examples/vm_power_manager/Makefile +1 -1
index 113dbc4..8fb78d4 100644
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c
 CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/
 CFLAGS += $(WERROR_FLAGS)
 
-LDLIBS += -lvirt
+EXTRA_LDLIBS += -lvirt
 
 # workaround for a gcc bug with noreturn attribute
 # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
mk/rte.app.mk +62 -184
index 62a76ae..ed471ad 100644
@@ -1,7 +1,7 @@
 #   BSD LICENSE
 #
-#   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.
-#   Copyright(c) 2014 6WIND S.A.
+#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.
+#   Copyright(c) 2015 6WIND S.A.
 #   All rights reserved.
 #
 #   Redistribution and use in source and binary forms, with or without
@@ -51,7 +51,7 @@ LDSCRIPT = $(RTE_LDSCRIPT)
 endif
 
 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y = -L$(RTE_SDK_BIN)/lib
 
 #
 # Include libraries depending on config if NO_AUTOLIBS is not set
@@ -59,215 +59,93 @@ LDLIBS += -L$(RTE_SDK_BIN)/lib
 #
 ifeq ($(NO_AUTOLIBS),)
 
-LDLIBS += --whole-archive
+LDLIBS-y += --whole-archive
 
-ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),y)
-LDLIBS += -l$(RTE_LIBNAME)
-endif
+LDLIBS-$(CONFIG_RTE_BUILD_COMBINE_LIBS)     += -l$(RTE_LIBNAME)
 
 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
 
-ifeq ($(CONFIG_RTE_LIBRTE_DISTRIBUTOR),y)
-LDLIBS += -lrte_distributor
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_REORDER),y)
-LDLIBS += -lrte_reorder
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR)     += -lrte_distributor
+LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER)         += -lrte_reorder
 
-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y)
 ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_kni
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_KNI)             += -lrte_kni
+LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM)         += -lrte_ivshmem
 endif
 
-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y)
-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y)
-LDLIBS += -lrte_ivshmem
-endif
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PIPELINE)        += -lrte_pipeline
+LDLIBS-$(CONFIG_RTE_LIBRTE_TABLE)           += -lrte_table
+LDLIBS-$(CONFIG_RTE_LIBRTE_PORT)            += -lrte_port
+LDLIBS-$(CONFIG_RTE_LIBRTE_TIMER)           += -lrte_timer
+LDLIBS-$(CONFIG_RTE_LIBRTE_HASH)            += -lrte_hash
+LDLIBS-$(CONFIG_RTE_LIBRTE_JOBSTATS)        += -lrte_jobstats
+LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)             += -lrte_lpm
+LDLIBS-$(CONFIG_RTE_LIBRTE_POWER)           += -lrte_power
+LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)             += -lrte_acl
+LDLIBS-$(CONFIG_RTE_LIBRTE_METER)           += -lrte_meter
 
-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y)
-LDLIBS += -lrte_pipeline
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)           += -lrte_sched
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)           += -lm
+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED)           += -lrt
 
-ifeq ($(CONFIG_RTE_LIBRTE_TABLE),y)
-LDLIBS += -lrte_table
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PORT),y)
-LDLIBS += -lrte_port
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_TIMER),y)
-LDLIBS += -lrte_timer
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_HASH),y)
-LDLIBS += -lrte_hash
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_JOBSTATS),y)
-LDLIBS += -lrte_jobstats
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_LPM),y)
-LDLIBS += -lrte_lpm
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_POWER),y)
-LDLIBS += -lrte_power
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y)
-LDLIBS += -lrte_acl
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_METER),y)
-LDLIBS += -lrte_meter
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_SCHED),y)
-LDLIBS += -lrte_sched
-LDLIBS += -lm
-LDLIBS += -lrt
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST), y)
-LDLIBS += -lrte_vhost
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)           += -lrte_vhost
 
 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS
 
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lpcap
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)        += -lpcap
 
-ifeq ($(CONFIG_RTE_LIBRTE_VHOST)$(CONFIG_RTE_LIBRTE_VHOST_USER),yn)
-LDLIBS += -lfuse
+ifeq ($(CONFIG_RTE_LIBRTE_VHOST_USER),n)
+LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST)           += -lfuse
 endif
 
-ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y)
-LDLIBS += -libverbs
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)        += -libverbs
 
-LDLIBS += --start-group
+LDLIBS-y += --start-group
 
 ifeq ($(CONFIG_RTE_BUILD_COMBINE_LIBS),n)
 
-ifeq ($(CONFIG_RTE_LIBRTE_KVARGS),y)
-LDLIBS += -lrte_kvargs
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MBUF),y)
-LDLIBS += -lrte_mbuf
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_IP_FRAG),y)
-LDLIBS += -lrte_ip_frag
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ETHER),y)
-LDLIBS += -lethdev
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MALLOC),y)
-LDLIBS += -lrte_malloc
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MEMPOOL),y)
-LDLIBS += -lrte_mempool
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_RING),y)
-LDLIBS += -lrte_ring
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_EAL),y)
-LDLIBS += -lrte_eal
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_CMDLINE),y)
-LDLIBS += -lrte_cmdline
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_CFGFILE),y)
-LDLIBS += -lrte_cfgfile
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y)
-LDLIBS += -lrte_pmd_bond
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y)
-LDLIBS += -lrte_pmd_xenvirt
-LDLIBS += -lxenstore
-endif
+LDLIBS-$(CONFIG_RTE_LIBRTE_KVARGS)          += -lrte_kvargs
+LDLIBS-$(CONFIG_RTE_LIBRTE_MBUF)            += -lrte_mbuf
+LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG)         += -lrte_ip_frag
+LDLIBS-$(CONFIG_RTE_LIBRTE_ETHER)           += -lethdev
+LDLIBS-$(CONFIG_RTE_LIBRTE_MALLOC)          += -lrte_malloc
+LDLIBS-$(CONFIG_RTE_LIBRTE_MEMPOOL)         += -lrte_mempool
+LDLIBS-$(CONFIG_RTE_LIBRTE_RING)            += -lrte_ring
+LDLIBS-$(CONFIG_RTE_LIBRTE_EAL)             += -lrte_eal
+LDLIBS-$(CONFIG_RTE_LIBRTE_CMDLINE)         += -lrte_cmdline
+LDLIBS-$(CONFIG_RTE_LIBRTE_CFGFILE)         += -lrte_cfgfile
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_BOND)        += -lrte_pmd_bond
+
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT)     += -lrte_pmd_xenvirt
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT)     += -lxenstore
 
 ifeq ($(CONFIG_RTE_BUILD_SHARED_LIB),n)
 # plugins (link only if static libraries)
 
-ifeq ($(CONFIG_RTE_LIBRTE_VMXNET3_PMD),y)
-LDLIBS += -lrte_pmd_vmxnet3_uio
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_VIRTIO_PMD),y)
-LDLIBS += -lrte_pmd_virtio
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_ENIC_PMD),y)
-LDLIBS += -lrte_pmd_enic
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_I40E_PMD),y)
-LDLIBS += -lrte_pmd_i40e
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_FM10K_PMD),y)
-LDLIBS += -lrte_pmd_fm10k
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_IXGBE_PMD),y)
-LDLIBS += -lrte_pmd_ixgbe
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_E1000_PMD),y)
-LDLIBS += -lrte_pmd_e1000
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_MLX4_PMD),y)
-LDLIBS += -lrte_pmd_mlx4
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_RING),y)
-LDLIBS += -lrte_pmd_ring
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_PCAP),y)
-LDLIBS += -lrte_pmd_pcap
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_AF_PACKET),y)
-LDLIBS += -lrte_pmd_af_packet
-endif
-
-ifeq ($(CONFIG_RTE_LIBRTE_PMD_NULL),y)
-LDLIBS += -lrte_pmd_null
-endif
-
-endif # plugins
+LDLIBS-$(CONFIG_RTE_LIBRTE_VMXNET3_PMD)     += -lrte_pmd_vmxnet3_uio
+LDLIBS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD)      += -lrte_pmd_virtio
+LDLIBS-$(CONFIG_RTE_LIBRTE_ENIC_PMD)        += -lrte_pmd_enic
+LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD)        += -lrte_pmd_i40e
+LDLIBS-$(CONFIG_RTE_LIBRTE_FM10K_PMD)       += -lrte_pmd_fm10k
+LDLIBS-$(CONFIG_RTE_LIBRTE_IXGBE_PMD)       += -lrte_pmd_ixgbe
+LDLIBS-$(CONFIG_RTE_LIBRTE_E1000_PMD)       += -lrte_pmd_e1000
+LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD)        += -lrte_pmd_mlx4
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_RING)        += -lrte_pmd_ring
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_PCAP)        += -lrte_pmd_pcap
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_AF_PACKET)   += -lrte_pmd_af_packet
+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_NULL)        += -lrte_pmd_null
+
+endif # ! $(CONFIG_RTE_BUILD_SHARED_LIB)
 
 endif # ! CONFIG_RTE_BUILD_COMBINE_LIBS
 
-LDLIBS += $(EXECENV_LDLIBS)
-
-LDLIBS += --end-group
-
-LDLIBS += --no-whole-archive
+LDLIBS-y += $(EXECENV_LDLIBS)
+LDLIBS-y += --end-group
+LDLIBS-y += --no-whole-archive
 
 endif # ifeq ($(NO_AUTOLIBS),)
 
-LDLIBS += $(CPU_LDLIBS)
+LDLIBS-y += $(EXTRA_LDLIBS)
 
 .PHONY: all
 all: install
@@ -286,10 +164,10 @@ ifeq ($(LINK_USING_CC),1)
 override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS))
 O_TO_EXE = $(CC) $(CFLAGS) $(LDFLAGS_$(@)) \
 	-Wl,-Map=$(@).map,--cref -o $@ $(OBJS-y) $(call
 linkerprefix,$(LDFLAGS)) \
-	$(EXTRA_LDFLAGS) $(call linkerprefix,$(LDLIBS))
+	$(EXTRA_LDFLAGS) $(call linkerprefix,$(LDLIBS-y))
 else
 O_TO_EXE = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
-	-Map=$(@).map --cref -o $@ $(OBJS-y) $(LDLIBS)
+	-Map=$(@).map --cref -o $@ $(OBJS-y) $(LDLIBS-y)
 endif
 O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight

O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)"," LD $(@)")

mk/rte.app.mk +4 -8
@@ -302,12 +180,12 @@ O_TO_EXE_DO = @set -e; \
 -include .$(APP).cmd
 
 # path where libraries are retrieved
-LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter
-Wl$(comma)-L%,$(LDLIBS)))
-LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS)))
+LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter
-Wl$(comma)-L%,$(LDLIBS-y)))
+LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS-y)))
 
 # list of .a files that are linked to this application
-LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))
-LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter
-Wl$(comma)-l%,$(LDLIBS)))
+LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS-y)))
+LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter
-Wl$(comma)-l%,$(LDLIBS-y)))
 
 # list of found libraries files (useful for deps). If not found, the
 # library is silently ignored and dep won't be checked
mk/rte.hostapp.mk +2 -2
index c44d0f8..51e8c1d 100644
@@ -58,7 +58,7 @@ build: _postbuild
 exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1))))
 
 O_TO_EXE = $(HOSTCC) $(HOST_LDFLAGS) $(LDFLAGS_$(@)) \
-	$(EXTRA_HOST_LDFLAGS) -o $@ $(OBJS-y) $(LDLIBS)
+	$(EXTRA_HOST_LDFLAGS) -o $@ $(OBJS-y) $(LDLIBS-y)
 O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight
 O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)","  HOSTLD $(@)")
 O_TO_EXE_CMD = "cmd_$@ = $(O_TO_EXE_STR)"
@@ -72,7 +72,7 @@ O_TO_EXE_DO = @set -e; \
 # list of .a files that are linked to this application
 LDLIBS_FILES := $(wildcard \
 	$(addprefix $(RTE_OUTPUT)/lib/, \
-	$(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))))
+	$(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS-y)))))
 
 #
 # Compile executable file if needed
mk/rte.shared.mk +2 -2
index fc6b0b4..56f20bb 100644
@@ -60,10 +60,10 @@ exe2cmd = $(strip $(call dotfile,$(patsubst
 %,%.cmd,$(1))))
 ifeq ($(LINK_USING_CC),1)
 override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS))
 O_TO_SO = $(CC) $(call linkerprefix,$(LDFLAGS)) $(LDFLAGS_$(@))
 $(EXTRA_LDFLAGS) \
-	-shared -o $@ $(OBJS-y) $(call linkerprefix,$(LDLIBS))
+	-shared -o $@ $(OBJS-y) $(call linkerprefix,$(LDLIBS-y))
 else
 O_TO_SO = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \
-	-shared -o $@ $(OBJS-y) $(LDLIBS)
+	-shared -o $@ $(OBJS-y) $(LDLIBS-y)
 endif

O_TO_SO_STR = $(subst ','\'',$(O_TO_SO)) #'# fix syntax highlight

mk/rte.shared.mk +4 -8
@@ -77,12 +77,12 @@ O_TO_SO_DO = @set -e; \
 -include .$(SHARED).cmd
 
 # path where libraries are retrieved
-LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter
-Wl$(comma)-L%,$(LDLIBS)))
-LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS)))
+LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter
-Wl$(comma)-L%,$(LDLIBS-y)))
+LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS-y)))
 
 # list of .a files that are linked to this application
-LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS)))
-LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter
-Wl$(comma)-l%,$(LDLIBS)))
+LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS-y)))
+LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter
-Wl$(comma)-l%,$(LDLIBS-y)))
 
 # list of found libraries files (useful for deps). If not found, the
 # library is silently ignored and dep won't be checked
Signature · 1 line
2.3.0
#10 lore raw

Re: [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

In reply to a message not in the archive
Quoted 60 lines · Sergio
Quoted 59 lines · Keith
Quoted 55 lines · Sergio
Quoted 54 lines · Keith Wiles
---
   doc/build-sdk-quick.txt                          | 1 +
   doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
   doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
   3 files changed, 4 insertions(+), 1 deletion(-)
doc/build-sdk-quick.txt +1 -0
index 041a40e..26d5442 100644
@@ -13,6 +13,7 @@ Build variables
   	EXTRA_CPPFLAGS   preprocessor options
   	EXTRA_CFLAGS     compiler options
   	EXTRA_LDFLAGS    linker options
+	EXTRA_LDLIBS     linker libary options
   	RTE_KERNELDIR    linux headers path
   	CROSS     toolchain prefix
   	V         verbose
doc/guides/prog_guide/dev_kit_build_system.rst +0 -0
index cf5c96f..b8ef167 100644
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User

in
a Makefile or Command Line

* EXTRA_LDFLAGS: The content of this variable is appended after
LDFLAGS when linking.

+* EXTRA_LDLIBS: The content of this variable is appended after
LDLIBS when linking.
+
* EXTRA_ASFLAGS: The content of this variable is appended after
ASFLAGS when assembling.

* EXTRA_CPPFLAGS: The content of this variable is appended after
CPPFLAGS when using a C preprocessor on assembly files.

doc/guides/prog_guide/dev_kit_root_make_help.rst +0 -0
index 4f30192..fdc5fea 100644
@@ -205,7 +205,7 @@ The following variables can be specified on the

command line:

Enable dependency debugging. This provides some useful
information about why a target is built or not.

doc/guides/prog_guide/dev_kit_root_make_help.rst +1 -1
-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=,

EXTRA_CPPFLAGS=

Quoted 6 lines
Quoted 4 lines
Quoted 3 lines
Quoted 2 lines

Append specific compilation, link or asm flags.

Do we need to remove LDLIBS from section 28.3.4?

Missed it, but it should be LDLIBS-y now

It would still be lost cause you are resetting LDLIBS-y value at the start of rte.app.mk, right?

Yes, LDLIBS-y is reset at the top, just as LDLIBS was reset in the original rte.app.mk file. I would assume this is the correct design and we should reset LDLIBS-y at the top of the file, right?

Quoted 7 lines

The only way to add to LDLIBS-y would be using EXTRA_LDLIBS.

Sergio

Quoted 3 lines
Quoted 3 lines

With the current patch the value of LDLIBS in the app makefile is lost.

Sergio

#12 lore raw

Re: [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

In reply to a message not in the archive
Quoted 66 lines · Keith
Quoted 62 lines · Sergio
Quoted 61 lines · Keith
Quoted 58 lines · Sergio
Quoted 54 lines · Keith Wiles
---
    doc/build-sdk-quick.txt                          | 1 +
    doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
    doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
    3 files changed, 4 insertions(+), 1 deletion(-)
doc/build-sdk-quick.txt +1 -0
index 041a40e..26d5442 100644
@@ -13,6 +13,7 @@ Build variables
    	EXTRA_CPPFLAGS   preprocessor options
    	EXTRA_CFLAGS     compiler options
    	EXTRA_LDFLAGS    linker options
+	EXTRA_LDLIBS     linker libary options
    	RTE_KERNELDIR    linux headers path
    	CROSS     toolchain prefix
    	V         verbose
doc/guides/prog_guide/dev_kit_build_system.rst +0 -0
index cf5c96f..b8ef167 100644
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User

in
a Makefile or Command Line

* EXTRA_LDFLAGS: The content of this variable is appended after
LDFLAGS when linking.

+* EXTRA_LDLIBS: The content of this variable is appended after
LDLIBS when linking.
+
* EXTRA_ASFLAGS: The content of this variable is appended after
ASFLAGS when assembling.

* EXTRA_CPPFLAGS: The content of this variable is appended after
CPPFLAGS when using a C preprocessor on assembly files.

doc/guides/prog_guide/dev_kit_root_make_help.rst +0 -0
index 4f30192..fdc5fea 100644
@@ -205,7 +205,7 @@ The following variables can be specified on the

command line:

Enable dependency debugging. This provides some useful
information about why a target is built or not.

doc/guides/prog_guide/dev_kit_root_make_help.rst +1 -1
-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=,

EXTRA_CPPFLAGS=

Quoted 2 lines

Append specific compilation, link or asm flags.

Do we need to remove LDLIBS from section 28.3.4?

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

Missed it, but it should be LDLIBS-y now

It would still be lost cause you are resetting LDLIBS-y value at the start of rte.app.mk, right?

Yes, LDLIBS-y is reset at the top, just as LDLIBS was reset in the original rte.app.mk file. I would assume this is the correct design and we should reset LDLIBS-y at the top of the file, right?

But LDLIBS was not reset pre-patch, was it?

 # default path for libs
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y = -L$(RTE_SDK_BIN)/lib

Sergio

Quoted 6 lines
Quoted 6 lines

The only way to add to LDLIBS-y would be using EXTRA_LDLIBS.

Sergio

Quoted 3 lines
Quoted 3 lines

With the current patch the value of LDLIBS in the app makefile is lost.

Sergio

#14 lore raw

Re: [PATCH v2 2/2] Update Docs for new EXTRA_LDLIBS variable

In reply to a message not in the archive
Quoted 80 lines · Sergio
Quoted 69 lines · Keith
Quoted 65 lines · Sergio
Quoted 64 lines · Keith
Quoted 61 lines · Sergio
Quoted 57 lines · Keith Wiles
---
    doc/build-sdk-quick.txt                          | 1 +
    doc/guides/prog_guide/dev_kit_build_system.rst   | 2 ++
    doc/guides/prog_guide/dev_kit_root_make_help.rst | 2 +-
    3 files changed, 4 insertions(+), 1 deletion(-)
doc/build-sdk-quick.txt +1 -0
index 041a40e..26d5442 100644
@@ -13,6 +13,7 @@ Build variables
    	EXTRA_CPPFLAGS   preprocessor options
    	EXTRA_CFLAGS     compiler options
    	EXTRA_LDFLAGS    linker options
+	EXTRA_LDLIBS     linker libary options
    	RTE_KERNELDIR    linux headers path
    	CROSS     toolchain prefix
    	V         verbose
doc/guides/prog_guide/dev_kit_build_system.rst +0 -0
index cf5c96f..b8ef167 100644
@@ -413,6 +413,8 @@ Variables that Can be Set/Overridden by the User

in
a Makefile or Command Line

* EXTRA_LDFLAGS: The content of this variable is appended
after
LDFLAGS when linking.

+* EXTRA_LDLIBS: The content of this variable is appended after
LDLIBS when linking.
+
* EXTRA_ASFLAGS: The content of this variable is appended
after
ASFLAGS when assembling.

* EXTRA_CPPFLAGS: The content of this variable is appended
after
CPPFLAGS when using a C preprocessor on assembly files.

doc/guides/prog_guide/dev_kit_root_make_help.rst +0 -0
index 4f30192..fdc5fea 100644
@@ -205,7 +205,7 @@ The following variables can be specified on the

command line:

Enable dependency debugging. This provides some useful
information about why a target is built or not.

doc/guides/prog_guide/dev_kit_root_make_help.rst +1 -1
-*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_ASFLAGS=, EXTRA_CPPFLAGS=
+*   EXTRA_CFLAGS=, EXTRA_LDFLAGS=, EXTRA_LDLIBS=, EXTRA_ASFLAGS=,

EXTRA_CPPFLAGS=

Quoted 2 lines

Append specific compilation, link or asm flags.

Do we need to remove LDLIBS from section 28.3.4?

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Missed it, but it should be LDLIBS-y now

It would still be lost cause you are resetting LDLIBS-y value at the start of rte.app.mk, right?

Yes, LDLIBS-y is reset at the top, just as LDLIBS was reset in the original rte.app.mk file. I would assume this is the correct design and we
should reset LDLIBS-y at the top of the file, right?

But LDLIBS was not reset pre-patch, was it?

 # default path for libs

Review

Quoted 2 lines
(quoted diff) +1 -1
-LDLIBS += -L$(RTE_SDK_BIN)/lib
+LDLIBS-y = -L$(RTE_SDK_BIN)/lib

OK, version 4 :-( doing to many things this morning.

Quoted 11 lines

Sergio

Quoted 7 lines
Quoted 7 lines

The only way to add to LDLIBS-y would be using EXTRA_LDLIBS.

Sergio

Quoted 4 lines
Quoted 4 lines

With the current patch the value of LDLIBS in the app makefile is lost.

Sergio