* [dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk. @ 2015-04-28 15:21 Keith Wiles 2015-04-28 15:28 ` Wiles, Keith 2015-04-28 16:25 ` Gonzalez Monroy, Sergio 0 siblings, 2 replies; 7+ messages in thread From: Keith Wiles @ 2015-04-28 15:21 UTC (permalink / raw) To: dev 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. Signed-off-by: Keith Wiles <keith.wiles@intel.com> --- mk/rte.app.mk | 253 ++++++++++++++---------------------------------------- mk/rte.hostapp.mk | 4 +- mk/rte.shared.mk | 12 +-- 3 files changed, 74 insertions(+), 195 deletions(-) diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 62a76ae..af38975 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -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,94 @@ 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 - -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y) -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) -LDLIBS += -lrte_kni -endif -endif - -ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y) -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) -LDLIBS += -lrte_ivshmem -endif -endif - -ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y) -LDLIBS += -lrte_pipeline -endif - -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 +LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor +LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) -LDLIBS += -lrte_acl +ifeq ($( CONFIG_RTE_EXEC_ENV_LINUXAPP),y) +LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni +LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem endif -ifeq ($(CONFIG_RTE_LIBRTE_METER),y) -LDLIBS += -lrte_meter -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_SCHED),y) -LDLIBS += -lrte_sched -LDLIBS += -lm -LDLIBS += -lrt -endif +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt -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 +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 +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 -ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y) -LDLIBS += -lrte_pmd_bond -endif +LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt +LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore -ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y) -LDLIBS += -lrte_pmd_xenvirt -LDLIBS += -lxenstore -endif 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 +# plugins (link only if static libraries) +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 += $(CPU_LDLIBS) .PHONY: all all: install @@ -286,10 +165,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 +181,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 diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk index c44d0f8..51e8c1d 100644 --- a/mk/rte.hostapp.mk +++ b/mk/rte.hostapp.mk @@ -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 diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk index fc6b0b4..56f20bb 100644 --- a/mk/rte.shared.mk +++ b/mk/rte.shared.mk @@ -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 -- 2.3.0 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk. 2015-04-28 15:21 [dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk Keith Wiles @ 2015-04-28 15:28 ` Wiles, Keith 2015-04-28 16:25 ` Gonzalez Monroy, Sergio 1 sibling, 0 replies; 7+ messages in thread From: Wiles, Keith @ 2015-04-28 15:28 UTC (permalink / raw) To: Wiles, Keith, dev I have not tested this change more then just building DPDK with GCC. On 4/28/15, 10:21 AM, "Keith Wiles" <keith.wiles@intel.com> wrote: >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. > >Signed-off-by: Keith Wiles <keith.wiles@intel.com> >--- > mk/rte.app.mk | 253 >++++++++++++++---------------------------------------- > mk/rte.hostapp.mk | 4 +- > mk/rte.shared.mk | 12 +-- > 3 files changed, 74 insertions(+), 195 deletions(-) > >diff --git a/mk/rte.app.mk b/mk/rte.app.mk >index 62a76ae..af38975 100644 >--- a/mk/rte.app.mk >+++ b/mk/rte.app.mk >@@ -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,94 @@ 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 >- >-ifeq ($(CONFIG_RTE_LIBRTE_KNI),y) >-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >-LDLIBS += -lrte_kni >-endif >-endif >- >-ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y) >-ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >-LDLIBS += -lrte_ivshmem >-endif >-endif >- >-ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y) >-LDLIBS += -lrte_pipeline >-endif >- >-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 >+LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor >+LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder > >-ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) >-LDLIBS += -lrte_acl >+ifeq ($( CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >+LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni >+LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem > endif > >-ifeq ($(CONFIG_RTE_LIBRTE_METER),y) >-LDLIBS += -lrte_meter >-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_SCHED),y) >-LDLIBS += -lrte_sched >-LDLIBS += -lm >-LDLIBS += -lrt >-endif >+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched >+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm >+LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt > >-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 >+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 >+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 > >-ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y) >-LDLIBS += -lrte_pmd_bond >-endif >+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt >+LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore > >-ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y) >-LDLIBS += -lrte_pmd_xenvirt >-LDLIBS += -lxenstore >-endif > > 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 >+# plugins (link only if static libraries) >+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 += $(CPU_LDLIBS) > > .PHONY: all > all: install >@@ -286,10 +165,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 +181,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 >diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk >index c44d0f8..51e8c1d 100644 >--- a/mk/rte.hostapp.mk >+++ b/mk/rte.hostapp.mk >@@ -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 >diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk >index fc6b0b4..56f20bb 100644 >--- a/mk/rte.shared.mk >+++ b/mk/rte.shared.mk >@@ -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 >-- >2.3.0 > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk. 2015-04-28 15:21 [dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk Keith Wiles 2015-04-28 15:28 ` Wiles, Keith @ 2015-04-28 16:25 ` Gonzalez Monroy, Sergio 2015-04-28 16:50 ` Wiles, Keith 1 sibling, 1 reply; 7+ messages in thread From: Gonzalez Monroy, Sergio @ 2015-04-28 16:25 UTC (permalink / raw) To: Keith Wiles, dev On 28/04/2015 16:21, Keith Wiles wrote: > 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. > > Signed-off-by: Keith Wiles <keith.wiles@intel.com> > --- +1 Patch looks good, just a few nits: > mk/rte.app.mk | 253 ++++++++++++++---------------------------------------- > mk/rte.hostapp.mk | 4 +- > mk/rte.shared.mk | 12 +-- > 3 files changed, 74 insertions(+), 195 deletions(-) > > diff --git a/mk/rte.app.mk b/mk/rte.app.mk > index 62a76ae..af38975 100644 > --- a/mk/rte.app.mk > +++ b/mk/rte.app.mk > @@ -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 > I think we should keep the current value of LDLIBS. Some apps (ie. examples/dpdk_qat ) preset LDLIBS before including rte.app.mk. > # > # Include libraries depending on config if NO_AUTOLIBS is not set > @@ -59,215 +59,94 @@ 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) > I think here is missing $( before CONFIG. > 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 > - > -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y) > -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) > -LDLIBS += -lrte_kni > -endif > -endif > - > -ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y) > -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) > -LDLIBS += -lrte_ivshmem > -endif > -endif > - > -ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y) > -LDLIBS += -lrte_pipeline > -endif > - > -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 > +LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor > +LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder > > -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) > -LDLIBS += -lrte_acl > +ifeq ($( CONFIG_RTE_EXEC_ENV_LINUXAPP),y) > +LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni > +LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem > endif > > -ifeq ($(CONFIG_RTE_LIBRTE_METER),y) > -LDLIBS += -lrte_meter > -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_SCHED),y) > -LDLIBS += -lrte_sched > -LDLIBS += -lm > -LDLIBS += -lrt > -endif > +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched > +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm > +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt > > -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 > +LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse > endif We could remove $(CONFIG_RTE_LIBRTE_VHOST) from the ifeq. > > -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 > +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 > > -ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y) > -LDLIBS += -lrte_pmd_bond > -endif > +LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt > +LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore > > -ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y) > -LDLIBS += -lrte_pmd_xenvirt > -LDLIBS += -lxenstore > -endif > > 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 > +# plugins (link only if static libraries) > +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 += $(CPU_LDLIBS) > > .PHONY: all > all: install > @@ -286,10 +165,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 +181,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 > diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk > index c44d0f8..51e8c1d 100644 > --- a/mk/rte.hostapp.mk > +++ b/mk/rte.hostapp.mk > @@ -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 > diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk > index fc6b0b4..56f20bb 100644 > --- a/mk/rte.shared.mk > +++ b/mk/rte.shared.mk > @@ -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 Sergio ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk. 2015-04-28 16:25 ` Gonzalez Monroy, Sergio @ 2015-04-28 16:50 ` Wiles, Keith 2015-04-29 8:04 ` Gonzalez Monroy, Sergio 0 siblings, 1 reply; 7+ messages in thread From: Wiles, Keith @ 2015-04-28 16:50 UTC (permalink / raw) To: Gonzalez Monroy, Sergio, dev Hi Sergio On 4/28/15, 11:25 AM, "Gonzalez Monroy, Sergio" <sergio.gonzalez.monroy@intel.com> wrote: >On 28/04/2015 16:21, Keith Wiles wrote: >> 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. >> >> Signed-off-by: Keith Wiles <keith.wiles@intel.com> >> --- >+1 > >Patch looks good, just a few nits: >> mk/rte.app.mk | 253 >>++++++++++++++---------------------------------------- >> mk/rte.hostapp.mk | 4 +- >> mk/rte.shared.mk | 12 +-- >> 3 files changed, 74 insertions(+), 195 deletions(-) >> >> diff --git a/mk/rte.app.mk b/mk/rte.app.mk >> index 62a76ae..af38975 100644 >> --- a/mk/rte.app.mk >> +++ b/mk/rte.app.mk >> @@ -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 >> >I think we should keep the current value of LDLIBS. >Some apps (ie. examples/dpdk_qat ) preset LDLIBS before including >rte.app.mk. I just modified the example apps to use a new VARIABLE called EXTRA_LDLIBS instead and added it towards the bottom of rte.app.mk. I think adding the EXTRA_LDLIBS is the right solution instead of using LDLIBS IMO. > >> # >> # Include libraries depending on config if NO_AUTOLIBS is not set >> @@ -59,215 +59,94 @@ 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) >> >I think here is missing $( before CONFIG. Ooops :-) > >> 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 >> - >> -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y) >> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >> -LDLIBS += -lrte_kni >> -endif >> -endif >> - >> -ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y) >> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >> -LDLIBS += -lrte_ivshmem >> -endif >> -endif >> - >> -ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y) >> -LDLIBS += -lrte_pipeline >> -endif >> - >> -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 >> +LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor >> +LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder >> >> -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) >> -LDLIBS += -lrte_acl >> +ifeq ($( CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >> +LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni >> +LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem >> endif >> >> -ifeq ($(CONFIG_RTE_LIBRTE_METER),y) >> -LDLIBS += -lrte_meter >> -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_SCHED),y) >> -LDLIBS += -lrte_sched >> -LDLIBS += -lm >> -LDLIBS += -lrt >> -endif >> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched >> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm >> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt >> >> -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 >> +LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse >> endif >We could remove $(CONFIG_RTE_LIBRTE_VHOST) from the ifeq. OK, fine with me. > >> >> -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 >> +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 >> >> -ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y) >> -LDLIBS += -lrte_pmd_bond >> -endif >> +LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt >> +LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore >> >> -ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y) >> -LDLIBS += -lrte_pmd_xenvirt >> -LDLIBS += -lxenstore >> -endif >> >> 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 >> +# plugins (link only if static libraries) >> +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 += $(CPU_LDLIBS) >> >> .PHONY: all >> all: install >> @@ -286,10 +165,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 +181,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 >> diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk >> index c44d0f8..51e8c1d 100644 >> --- a/mk/rte.hostapp.mk >> +++ b/mk/rte.hostapp.mk >> @@ -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 >> diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk >> index fc6b0b4..56f20bb 100644 >> --- a/mk/rte.shared.mk >> +++ b/mk/rte.shared.mk >> @@ -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 > >Sergio ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk. 2015-04-28 16:50 ` Wiles, Keith @ 2015-04-29 8:04 ` Gonzalez Monroy, Sergio 2015-04-29 14:09 ` Wiles, Keith 0 siblings, 1 reply; 7+ messages in thread From: Gonzalez Monroy, Sergio @ 2015-04-29 8:04 UTC (permalink / raw) To: Wiles, Keith; +Cc: dev On 28/04/2015 17:50, Wiles, Keith wrote: > Hi Sergio > > On 4/28/15, 11:25 AM, "Gonzalez Monroy, Sergio" > <sergio.gonzalez.monroy@intel.com> wrote: > >> On 28/04/2015 16:21, Keith Wiles wrote: >>> 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. >>> >>> Signed-off-by: Keith Wiles <keith.wiles@intel.com> >>> --- >> +1 >> >> Patch looks good, just a few nits: >>> mk/rte.app.mk | 253 >>> ++++++++++++++---------------------------------------- >>> mk/rte.hostapp.mk | 4 +- >>> mk/rte.shared.mk | 12 +-- >>> 3 files changed, 74 insertions(+), 195 deletions(-) >>> >>> diff --git a/mk/rte.app.mk b/mk/rte.app.mk >>> index 62a76ae..af38975 100644 >>> --- a/mk/rte.app.mk >>> +++ b/mk/rte.app.mk >>> @@ -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 >>> >> I think we should keep the current value of LDLIBS. >> Some apps (ie. examples/dpdk_qat ) preset LDLIBS before including >> rte.app.mk. > I just modified the example apps to use a new VARIABLE called EXTRA_LDLIBS > instead and added it towards the bottom of rte.app.mk. I think adding the > EXTRA_LDLIBS is the right solution instead of using LDLIBS IMO. Fair enough :) I suppose is semantics, and I may be wrong here, but my understanding was that EXTRA_xxxx vars were to be used from the command line to pass additional flags and/or override certain default flags, and that CFLAGS/LDFLAGS/LDLIBS were used from each app/example makefile to specify their own flags. IMO we could achieve the correct order (ie. example/app CFLAGS/LDFLAGS/LDLIBS being added at the end to override default flags) without using EXTRA_xxxx vars from makefiles. Regarding this patch it would be pretty simple by just adding LDLIBS at the end of LDLIBS-y. Sergio >>> # >>> # Include libraries depending on config if NO_AUTOLIBS is not set >>> @@ -59,215 +59,94 @@ 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) >>> >> I think here is missing $( before CONFIG. > Ooops :-) >>> 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 >>> - >>> -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y) >>> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >>> -LDLIBS += -lrte_kni >>> -endif >>> -endif >>> - >>> -ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y) >>> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >>> -LDLIBS += -lrte_ivshmem >>> -endif >>> -endif >>> - >>> -ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y) >>> -LDLIBS += -lrte_pipeline >>> -endif >>> - >>> -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 >>> +LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor >>> +LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder >>> >>> -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) >>> -LDLIBS += -lrte_acl >>> +ifeq ($( CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >>> +LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni >>> +LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem >>> endif >>> >>> -ifeq ($(CONFIG_RTE_LIBRTE_METER),y) >>> -LDLIBS += -lrte_meter >>> -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_SCHED),y) >>> -LDLIBS += -lrte_sched >>> -LDLIBS += -lm >>> -LDLIBS += -lrt >>> -endif >>> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched >>> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm >>> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt >>> >>> -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 >>> +LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse >>> endif >> We could remove $(CONFIG_RTE_LIBRTE_VHOST) from the ifeq. > OK, fine with me. >>> >>> -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 >>> +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 >>> >>> -ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y) >>> -LDLIBS += -lrte_pmd_bond >>> -endif >>> +LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt >>> +LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore >>> >>> -ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y) >>> -LDLIBS += -lrte_pmd_xenvirt >>> -LDLIBS += -lxenstore >>> -endif >>> >>> 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 >>> +# plugins (link only if static libraries) >>> +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 += $(CPU_LDLIBS) >>> >>> .PHONY: all >>> all: install >>> @@ -286,10 +165,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 +181,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 >>> diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk >>> index c44d0f8..51e8c1d 100644 >>> --- a/mk/rte.hostapp.mk >>> +++ b/mk/rte.hostapp.mk >>> @@ -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 >>> diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk >>> index fc6b0b4..56f20bb 100644 >>> --- a/mk/rte.shared.mk >>> +++ b/mk/rte.shared.mk >>> @@ -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 >> Sergio ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk. 2015-04-29 8:04 ` Gonzalez Monroy, Sergio @ 2015-04-29 14:09 ` Wiles, Keith 2015-04-29 14:25 ` Wiles, Keith 0 siblings, 1 reply; 7+ messages in thread From: Wiles, Keith @ 2015-04-29 14:09 UTC (permalink / raw) To: Gonzalez Monroy, Sergio; +Cc: dev On 4/29/15, 3:04 AM, "Gonzalez Monroy, Sergio" <sergio.gonzalez.monroy@intel.com> wrote: >On 28/04/2015 17:50, Wiles, Keith wrote: >> Hi Sergio >> >> On 4/28/15, 11:25 AM, "Gonzalez Monroy, Sergio" >> <sergio.gonzalez.monroy@intel.com> wrote: >> >>> On 28/04/2015 16:21, Keith Wiles wrote: >>>> 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. >>>> >>>> Signed-off-by: Keith Wiles <keith.wiles@intel.com> >>>> --- >>> +1 >>> >>> Patch looks good, just a few nits: >>>> mk/rte.app.mk | 253 >>>> ++++++++++++++---------------------------------------- >>>> mk/rte.hostapp.mk | 4 +- >>>> mk/rte.shared.mk | 12 +-- >>>> 3 files changed, 74 insertions(+), 195 deletions(-) >>>> >>>> diff --git a/mk/rte.app.mk b/mk/rte.app.mk >>>> index 62a76ae..af38975 100644 >>>> --- a/mk/rte.app.mk >>>> +++ b/mk/rte.app.mk >>>> @@ -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 >>>> >>> I think we should keep the current value of LDLIBS. >>> Some apps (ie. examples/dpdk_qat ) preset LDLIBS before including >>> rte.app.mk. >> I just modified the example apps to use a new VARIABLE called >>EXTRA_LDLIBS >> instead and added it towards the bottom of rte.app.mk. I think adding >>the >> EXTRA_LDLIBS is the right solution instead of using LDLIBS IMO. >Fair enough :) > >I suppose is semantics, and I may be wrong here, but my understanding >was that EXTRA_xxxx vars were to be used from the command line to pass >additional flags and/or override certain default flags, and that >CFLAGS/LDFLAGS/LDLIBS were used from each app/example makefile to >specify their own flags. > >IMO we could achieve the correct order (ie. example/app >CFLAGS/LDFLAGS/LDLIBS being added at the end to override default flags) >without using EXTRA_xxxx vars from makefiles. Regarding this patch it >would be pretty simple by just adding LDLIBS at the end of LDLIBS-y. Does anyone else have an opinion about EXTRA_XXX? I just did not realize the EXTRA_XXX was only for command line, personally I would have preferred keeping .mk internal variables internal and have external variables to augment the internal variables instead of using the internal ones in the Makefiles. Someone could abuse the internal variables. Using the EXTRA_XXX with a Œ+=Œ should be reasonable, correct? Let me know which way I need to update the patch. Regards, ++Keith > >Sergio >>>> # >>>> # Include libraries depending on config if NO_AUTOLIBS is not set >>>> @@ -59,215 +59,94 @@ 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) >>>> >>> I think here is missing $( before CONFIG. >> Ooops :-) >>>> 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 >>>> - >>>> -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y) >>>> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >>>> -LDLIBS += -lrte_kni >>>> -endif >>>> -endif >>>> - >>>> -ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y) >>>> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >>>> -LDLIBS += -lrte_ivshmem >>>> -endif >>>> -endif >>>> - >>>> -ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y) >>>> -LDLIBS += -lrte_pipeline >>>> -endif >>>> - >>>> -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 >>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor >>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder >>>> >>>> -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) >>>> -LDLIBS += -lrte_acl >>>> +ifeq ($( CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni >>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem >>>> endif >>>> >>>> -ifeq ($(CONFIG_RTE_LIBRTE_METER),y) >>>> -LDLIBS += -lrte_meter >>>> -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_SCHED),y) >>>> -LDLIBS += -lrte_sched >>>> -LDLIBS += -lm >>>> -LDLIBS += -lrt >>>> -endif >>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched >>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm >>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt >>>> >>>> -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 >>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse >>>> endif >>> We could remove $(CONFIG_RTE_LIBRTE_VHOST) from the ifeq. >> OK, fine with me. >>>> >>>> -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 >>>> +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 >>>> >>>> -ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y) >>>> -LDLIBS += -lrte_pmd_bond >>>> -endif >>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt >>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore >>>> >>>> -ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y) >>>> -LDLIBS += -lrte_pmd_xenvirt >>>> -LDLIBS += -lxenstore >>>> -endif >>>> >>>> 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 >>>> +# plugins (link only if static libraries) >>>> +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 += $(CPU_LDLIBS) >>>> >>>> .PHONY: all >>>> all: install >>>> @@ -286,10 +165,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 +181,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 >>>> diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk >>>> index c44d0f8..51e8c1d 100644 >>>> --- a/mk/rte.hostapp.mk >>>> +++ b/mk/rte.hostapp.mk >>>> @@ -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 >>>> diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk >>>> index fc6b0b4..56f20bb 100644 >>>> --- a/mk/rte.shared.mk >>>> +++ b/mk/rte.shared.mk >>>> @@ -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 >>> Sergio > ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk. 2015-04-29 14:09 ` Wiles, Keith @ 2015-04-29 14:25 ` Wiles, Keith 0 siblings, 0 replies; 7+ messages in thread From: Wiles, Keith @ 2015-04-29 14:25 UTC (permalink / raw) To: Wiles, Keith, Gonzalez Monroy, Sergio; +Cc: dev On 4/29/15, 9:09 AM, "Wiles, Keith" <keith.wiles@intel.com> wrote: > > >On 4/29/15, 3:04 AM, "Gonzalez Monroy, Sergio" ><sergio.gonzalez.monroy@intel.com> wrote: > >>On 28/04/2015 17:50, Wiles, Keith wrote: >>> Hi Sergio >>> >>> On 4/28/15, 11:25 AM, "Gonzalez Monroy, Sergio" >>> <sergio.gonzalez.monroy@intel.com> wrote: >>> >>>> On 28/04/2015 16:21, Keith Wiles wrote: >>>>> 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. >>>>> >>>>> Signed-off-by: Keith Wiles <keith.wiles@intel.com> >>>>> --- >>>> +1 >>>> >>>> Patch looks good, just a few nits: >>>>> mk/rte.app.mk | 253 >>>>> ++++++++++++++---------------------------------------- >>>>> mk/rte.hostapp.mk | 4 +- >>>>> mk/rte.shared.mk | 12 +-- >>>>> 3 files changed, 74 insertions(+), 195 deletions(-) >>>>> >>>>> diff --git a/mk/rte.app.mk b/mk/rte.app.mk >>>>> index 62a76ae..af38975 100644 >>>>> --- a/mk/rte.app.mk >>>>> +++ b/mk/rte.app.mk >>>>> @@ -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 >>>>> >>>> I think we should keep the current value of LDLIBS. >>>> Some apps (ie. examples/dpdk_qat ) preset LDLIBS before including >>>> rte.app.mk. >>> I just modified the example apps to use a new VARIABLE called >>>EXTRA_LDLIBS >>> instead and added it towards the bottom of rte.app.mk. I think adding >>>the >>> EXTRA_LDLIBS is the right solution instead of using LDLIBS IMO. >>Fair enough :) >> >>I suppose is semantics, and I may be wrong here, but my understanding >>was that EXTRA_xxxx vars were to be used from the command line to pass >>additional flags and/or override certain default flags, and that >>CFLAGS/LDFLAGS/LDLIBS were used from each app/example makefile to >>specify their own flags. >> >>IMO we could achieve the correct order (ie. example/app >>CFLAGS/LDFLAGS/LDLIBS being added at the end to override default flags) >>without using EXTRA_xxxx vars from makefiles. Regarding this patch it >>would be pretty simple by just adding LDLIBS at the end of LDLIBS-y. > >Does anyone else have an opinion about EXTRA_XXX? > >I just did not realize the EXTRA_XXX was only for command line, personally >I would have preferred keeping .mk internal variables internal and have >external variables to augment the internal variables instead of using the >internal ones in the Makefiles. Someone could abuse the internal >variables. > >Using the EXTRA_XXX with a Œ+=Œ should be reasonable, correct? > >Let me know which way I need to update the patch. Bruce just pointed to the following http://dpdk.org/doc/guides/prog_guide/dev_kit_build_system.html session 28.3.6 It states the EXTRA_XXX can be used on command line or Makefiles. Then I just need to send my patch with the corrected version number, correct? > >Regards, >++Keith >> >>Sergio >>>>> # >>>>> # Include libraries depending on config if NO_AUTOLIBS is not set >>>>> @@ -59,215 +59,94 @@ 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) >>>>> >>>> I think here is missing $( before CONFIG. >>> Ooops :-) >>>>> 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 >>>>> - >>>>> -ifeq ($(CONFIG_RTE_LIBRTE_KNI),y) >>>>> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >>>>> -LDLIBS += -lrte_kni >>>>> -endif >>>>> -endif >>>>> - >>>>> -ifeq ($(CONFIG_RTE_LIBRTE_IVSHMEM),y) >>>>> -ifeq ($(CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >>>>> -LDLIBS += -lrte_ivshmem >>>>> -endif >>>>> -endif >>>>> - >>>>> -ifeq ($(CONFIG_RTE_LIBRTE_PIPELINE),y) >>>>> -LDLIBS += -lrte_pipeline >>>>> -endif >>>>> - >>>>> -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 >>>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor >>>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_REORDER) += -lrte_reorder >>>>> >>>>> -ifeq ($(CONFIG_RTE_LIBRTE_ACL),y) >>>>> -LDLIBS += -lrte_acl >>>>> +ifeq ($( CONFIG_RTE_EXEC_ENV_LINUXAPP),y) >>>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_KNI) += -lrte_kni >>>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_IVSHMEM) += -lrte_ivshmem >>>>> endif >>>>> >>>>> -ifeq ($(CONFIG_RTE_LIBRTE_METER),y) >>>>> -LDLIBS += -lrte_meter >>>>> -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_SCHED),y) >>>>> -LDLIBS += -lrte_sched >>>>> -LDLIBS += -lm >>>>> -LDLIBS += -lrt >>>>> -endif >>>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrte_sched >>>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lm >>>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_SCHED) += -lrt >>>>> >>>>> -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 >>>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_VHOST) += -lfuse >>>>> endif >>>> We could remove $(CONFIG_RTE_LIBRTE_VHOST) from the ifeq. >>> OK, fine with me. >>>>> >>>>> -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 >>>>> +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 >>>>> >>>>> -ifeq ($(CONFIG_RTE_LIBRTE_PMD_BOND),y) >>>>> -LDLIBS += -lrte_pmd_bond >>>>> -endif >>>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lrte_pmd_xenvirt >>>>> +LDLIBS-$(CONFIG_RTE_LIBRTE_PMD_XENVIRT) += -lxenstore >>>>> >>>>> -ifeq ($(CONFIG_RTE_LIBRTE_PMD_XENVIRT),y) >>>>> -LDLIBS += -lrte_pmd_xenvirt >>>>> -LDLIBS += -lxenstore >>>>> -endif >>>>> >>>>> 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 >>>>> +# plugins (link only if static libraries) >>>>> +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 += $(CPU_LDLIBS) >>>>> >>>>> .PHONY: all >>>>> all: install >>>>> @@ -286,10 +165,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 +181,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 >>>>> diff --git a/mk/rte.hostapp.mk b/mk/rte.hostapp.mk >>>>> index c44d0f8..51e8c1d 100644 >>>>> --- a/mk/rte.hostapp.mk >>>>> +++ b/mk/rte.hostapp.mk >>>>> @@ -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 >>>>> diff --git a/mk/rte.shared.mk b/mk/rte.shared.mk >>>>> index fc6b0b4..56f20bb 100644 >>>>> --- a/mk/rte.shared.mk >>>>> +++ b/mk/rte.shared.mk >>>>> @@ -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 >>>> Sergio >> > ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-04-29 14:25 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2015-04-28 15:21 [dpdk-dev] [RFC PATCH] Simplify the ifdefs in rte.app.mk Keith Wiles 2015-04-28 15:28 ` Wiles, Keith 2015-04-28 16:25 ` Gonzalez Monroy, Sergio 2015-04-28 16:50 ` Wiles, Keith 2015-04-29 8:04 ` Gonzalez Monroy, Sergio 2015-04-29 14:09 ` Wiles, Keith 2015-04-29 14:25 ` Wiles, Keith
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).