Simplify the ifdefs in rte.app.mk.
PATCH 1/1 Simplify the ifdefs in rte.app.mk.
Trying to simplify the ifdefs in rte.app.mk to make the code more readable and maintainable by moving LDLIBS variable to use the same style as LDLIBS-y being used in the rest of the code.
Added a new variable called EXTRA_LDLIBS to be used by example apps instead of using LDLIBS directly.
--- examples/dpdk_qat/Makefile | 4 +- examples/vm_power_manager/Makefile | 2 +- mk/rte.app.mk | 254 ++++++++++--------------------------- mk/rte.hostapp.mk | 4 +- mk/rte.shared.mk | 12 +- 5 files changed, 77 insertions(+), 199 deletions(-)
examples/dpdk_qat/Makefile +2 -2
@@ -77,8 +77,8 @@ else ICP_LIBRARY_PATH = $(ICP_ROOT)/build/libicp_qa_al.a endif -LDLIBS += -L$(ICP_ROOT)/build -LDLIBS += $(ICP_LIBRARY_PATH) \ +EXTRA_LDLIBS += -L$(ICP_ROOT)/build +EXTRA_LDLIBS += $(ICP_LIBRARY_PATH) \ -lz \ -losal \ -ladf_proxy \
examples/vm_power_manager/Makefile +1 -1
@@ -48,7 +48,7 @@ SRCS-y += channel_monitor.c CFLAGS += -O3 -I$(RTE_SDK)/lib/librte_power/ CFLAGS += $(WERROR_FLAGS) -LDLIBS += -lvirt +EXTRA_LDLIBS += -lvirt # workaround for a gcc bug with noreturn attribute # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12603
mk/rte.app.mk +66 -188
317 lines not on this page · raw message
mk/rte.hostapp.mk +2 -2
@@ -58,7 +58,7 @@ build: _postbuild exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) O_TO_EXE = $(HOSTCC) $(HOST_LDFLAGS) $(LDFLAGS_$(@)) \ - $(EXTRA_HOST_LDFLAGS) -o $@ $(OBJS-y) $(LDLIBS) + $(EXTRA_HOST_LDFLAGS) -o $@ $(OBJS-y) $(LDLIBS-y) O_TO_EXE_STR = $(subst ','\'',$(O_TO_EXE)) #'# fix syntax highlight O_TO_EXE_DISP = $(if $(V),"$(O_TO_EXE_STR)"," HOSTLD $(@)") O_TO_EXE_CMD = "cmd_$@ = $(O_TO_EXE_STR)"
@@ -72,7 +72,7 @@ O_TO_EXE_DO = @set -e; \ # list of .a files that are linked to this application LDLIBS_FILES := $(wildcard \ $(addprefix $(RTE_OUTPUT)/lib/, \ - $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS))))) + $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS-y))))) # # Compile executable file if needed
mk/rte.shared.mk +6 -6
@@ -60,10 +60,10 @@ exe2cmd = $(strip $(call dotfile,$(patsubst %,%.cmd,$(1)))) ifeq ($(LINK_USING_CC),1) override EXTRA_LDFLAGS := $(call linkerprefix,$(EXTRA_LDFLAGS)) O_TO_SO = $(CC) $(call linkerprefix,$(LDFLAGS)) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ - -shared -o $@ $(OBJS-y) $(call linkerprefix,$(LDLIBS)) + -shared -o $@ $(OBJS-y) $(call linkerprefix,$(LDLIBS-y)) else O_TO_SO = $(LD) $(LDFLAGS) $(LDFLAGS_$(@)) $(EXTRA_LDFLAGS) \ - -shared -o $@ $(OBJS-y) $(LDLIBS) + -shared -o $@ $(OBJS-y) $(LDLIBS-y) endif O_TO_SO_STR = $(subst ','\'',$(O_TO_SO)) #'# fix syntax highlight
@@ -77,12 +77,12 @@ O_TO_SO_DO = @set -e; \ -include .$(SHARED).cmd # path where libraries are retrieved -LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter -Wl$(comma)-L%,$(LDLIBS))) -LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS))) +LDLIBS_PATH := $(subst -Wl$(comma)-L,,$(filter -Wl$(comma)-L%,$(LDLIBS-y))) +LDLIBS_PATH += $(subst -L,,$(filter -L%,$(LDLIBS-y))) # list of .a files that are linked to this application -LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS))) -LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter -Wl$(comma)-l%,$(LDLIBS))) +LDLIBS_NAMES := $(patsubst -l%,lib%.a,$(filter -l%,$(LDLIBS-y))) +LDLIBS_NAMES += $(patsubst -Wl$(comma)-l%,lib%.a,$(filter -Wl$(comma)-l%,$(LDLIBS-y))) # list of found libraries files (useful for deps). If not found, the # library is silently ignored and dep won't be checked
Signature · 1 line
2.3.0
Hi Keith,
Thanks for trying to improve maintainability.
It seems this is the second version of your patch. Please add v2 prefix and a changelog to ease review and patch management.
As you probably know, it is explained here:
http://dpdk.org/dev#send
2015-04-28 19:03 GMT+02:00 Keith Wiles <[email protected]>:
Quoted 8 lines
Trying to simplify the ifdefs in rte.app.mk to make the code more readable and maintainable by moving LDLIBS variable to use the same style as LDLIBS-y being used in the rest of the code.
Added a new variable called
EXTRA_LDLIBSto be used by example apps instead of using LDLIBS directly.Signed-off-by Keith Wiles <[email protected]>
Quoted 9 lines · Thomas Monjalon
Hi Keith,
Thanks for trying to improve maintainability.
It seems this is the second version of your patch. Please add v2 prefix and a changelog to ease review and patch management.
As you probably know, it is explained here:
http://dpdk.org/dev#send
Hi Thomas,
Just to clarify as I tend to use RFC PATCH as well, do we still mark it as v2 even though the first patch was an RFC PATCH?
Sergio
Quoted 9 lines
2015-04-28 19:03 GMT+02:00 Keith Wiles <[email protected]>:
Quoted 8 lines
Trying to simplify the ifdefs in rte.app.mk to make the code more readable and maintainable by moving LDLIBS variable to use the same style as LDLIBS-y being used in the rest of the code.
Added a new variable called
EXTRA_LDLIBSto be used by example apps instead of using LDLIBS directly.Signed-off-by Keith Wiles <[email protected]>
2015-04-29 13:08 GMT+02:00 Gonzalez Monroy, Sergio <[email protected]>:
Quoted 11 lines · Thomas Monjalon
Quoted 5 lines
It seems this is the second version of your patch. Please add v2 prefix and a changelog to ease review and patch management.
As you probably know, it is explained here:
http://dpdk.org/dev#sendHi Thomas,
Just to clarify as I tend to use RFC PATCH as well, do we still mark it as v2 even though the first patch was an RFC PATCH?
Yes it's clearer to include RFC PATCH in versioning.
RFC is only a keyword to highlight the desire of debating and/or improving with review comments.
So I think RFC patch should be considered as the number one. Adding v1 is possible.
Quoted 15 lines · Thomas Monjalon
2015-04-29 13:08 GMT+02:00 Gonzalez Monroy, Sergio <[email protected]>:
Quoted 7 lines · Thomas Monjalon
Quoted 5 lines
It seems this is the second version of your patch. Please add v2 prefix and a changelog to ease review and patch management.
As you probably know, it is explained here:
http://dpdk.org/dev#sendQuoted 5 lines
Hi Thomas,
Just to clarify as I tend to use RFC PATCH as well, do we still mark it as
v2 even though the first patch was an RFC PATCH?
Quoted 5 lines
Yes it's clearer to include RFC PATCH in versioning.
RFC is only a keyword to highlight the desire of debating and/or improving with review comments.
So I think RFC patch should be considered as the number one. Adding v1 is possible.
OK, will send a new patch with the correct version.