From: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH 4/4] Cleanup
Date: Thu, 2 Oct 2014 16:56:26 +0100 [thread overview]
Message-ID: <1412265386-26291-5-git-send-email-sergio.gonzalez.monroy@intel.com> (raw)
In-Reply-To: <1412265386-26291-1-git-send-email-sergio.gonzalez.monroy@intel.com>
Reduce code duplication.
This patch is not required for the patch set to work.
Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
---
mk/rte.lib.mk | 88 +++++++++++++-----------------------------------------
mk/rte.sharelib.mk | 39 ++++++++++--------------
2 files changed, 35 insertions(+), 92 deletions(-)
diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index d594692..84f5a64 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -66,93 +66,45 @@ LD_MULDEFS := $(call linkerprefix,-z$(comma)muldefs)
CPU_LDFLAGS := $(call linkerprefix,$(CPU_LDFLAGS))
endif
-O_TO_A = $(AR) crus $(LIB) $(OBJS-y)
-O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight
-O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," AR $(@)")
-O_TO_A_CMD = "cmd_$@ = $(O_TO_A_STR)"
-O_TO_A_DO = @set -e; \
- echo $(O_TO_A_DISP); \
- $(O_TO_A) && \
- echo $(O_TO_A_CMD) > $(call exe2cmd,$(@))
-
-O_TO_S = $(LD) $(CPU_LDFLAGS) $(LD_MULDEFS) -shared $(OBJS-y) -o $(LIB)
-O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
-O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)")
-O_TO_S_DO = @set -e; \
- echo $(O_TO_S_DISP); \
- $(O_TO_S) && \
- echo $(O_TO_S_CMD) > $(call exe2cmd,$(@))
-
-ifeq ($(RTE_BUILD_SHARED_LIB),n)
-O_TO_C = $(AR) crus $(LIB_ONE) $(OBJS-y)
-O_TO_C_STR = $(subst ','\'',$(O_TO_C)) #'# fix syntax highlight
-O_TO_C_DISP = $(if $(V),"$(O_TO_C_STR)"," AR_C $(@)")
-O_TO_C_DO = @set -e; \
- $(lib_dir) \
- $(copy_obj)
+ifeq ($(RTE_BUILD_COMBINE_LIBS),y)
+O_TO_L_DO = @set -e; \
+ cp -f $(OBJS-y) $(RTE_OUTPUT)/build/lib;
+else
+ifeq ($(RTE_BUILD_SHARED_LIB),y)
+O_TO_L = $(LD) $(CPU_LDFLAGS) $(LD_MULDEFS) -shared $(OBJS-y) -o $(LIB)
+L_DISP=LD
else
-O_TO_C = $(LD) $(LD_MULDEFS) -shared $(OBJS-y) -o $(LIB_ONE)
-O_TO_C_STR = $(subst ','\'',$(O_TO_C)) #'# fix syntax highlight
-O_TO_C_DISP = $(if $(V),"$(O_TO_C_STR)"," LD_C $(@)")
-O_TO_C_DO = @set -e; \
- $(lib_dir) \
- $(copy_obj)
+O_TO_L = $(AR) crus $(LIB) $(OBJS-y)
+L_DISP=AR
+endif
+O_TO_L_STR = $(subst ','\'',$(O_TO_L)) #') # fix syntax highlight
+O_TO_L_DISP = $(if $(V),"$(O_TO_L_STR)"," $(L_DISP) $(@)")
+O_TO_L_CMD = "cmd_$@ = $(O_TO_L_STR)"
+O_TO_L_DO = @set -e; \
+ echo $(O_TO_L_DISP); \
+ $(O_TO_L) && \
+ echo $(O_TO_L_CMD) > $(call exe2cmd,$(@))
endif
-copy_obj = cp -f $(OBJS-y) $(RTE_OUTPUT)/build/lib;
-lib_dir = [ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib;
-include .$(LIB).cmd
#
# Archive objects in .a file if needed
#
-ifeq ($(RTE_BUILD_SHARED_LIB),y)
$(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
@[ -d $(dir $@) ] || mkdir -p $(dir $@)
$(if $(D),\
@echo -n "$< -> $@ " ; \
echo -n "file_missing=$(call boolean,$(file_missing)) " ; \
- echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_S_STR))) " ; \
+ echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_L_STR))) " ; \
echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \
echo "depfile_newer=$(call boolean,$(depfile_newer)) ")
$(if $(or \
- $(file_missing),\
- $(call cmdline_changed,$(O_TO_S_STR)),\
- $(depfile_missing),\
- $(depfile_newer)),\
- $(O_TO_S_DO))
-ifeq ($(RTE_BUILD_COMBINE_LIBS),y)
- $(if $(or \
- $(file_missing),\
- $(call cmdline_changed,$(O_TO_C_STR)),\
- $(depfile_missing),\
- $(depfile_newer)),\
- $(O_TO_C_DO))
-endif
-else
-$(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
- @[ -d $(dir $@) ] || mkdir -p $(dir $@)
- $(if $(D),\
- @echo -n "$< -> $@ " ; \
- echo -n "file_missing=$(call boolean,$(file_missing)) " ; \
- echo -n "cmdline_changed=$(call boolean,$(call cmdline_changed,$(O_TO_A_STR))) " ; \
- echo -n "depfile_missing=$(call boolean,$(depfile_missing)) " ; \
- echo "depfile_newer=$(call boolean,$(depfile_newer)) ")
- $(if $(or \
$(file_missing),\
- $(call cmdline_changed,$(O_TO_A_STR)),\
+ $(call cmdline_changed,$(O_TO_L_STR)),\
$(depfile_missing),\
$(depfile_newer)),\
- $(O_TO_A_DO))
-ifeq ($(RTE_BUILD_COMBINE_LIBS),y)
- $(if $(or \
- $(file_missing),\
- $(call cmdline_changed,$(O_TO_C_STR)),\
- $(depfile_missing),\
- $(depfile_newer)),\
- $(O_TO_C_DO))
-endif
-endif
+ $(O_TO_L_DO))
#
# install lib in $(RTE_OUTPUT)/lib
diff --git a/mk/rte.sharelib.mk b/mk/rte.sharelib.mk
index 942671d..0efa0b7 100644
--- a/mk/rte.sharelib.mk
+++ b/mk/rte.sharelib.mk
@@ -52,37 +52,28 @@ sharelib: $(LIB_ONE) FORCE
OBJS = $(wildcard $(RTE_OUTPUT)/build/lib/*.o)
-O_TO_S = $(LD) $(CPU_LDFLAGS) $(LD_MULDEFS) -shared $(OBJS)\
+ifeq ($(RTE_BUILD_SHARED_LIB),y)
+O_TO_L = $(LD) $(CPU_LDFLAGS) $(LD_MULDEFS) -shared $(OBJS)\
-o $(RTE_OUTPUT)/lib/$(LIB_ONE)
-O_TO_S_STR = $(subst ','\'',$(O_TO_S)) #'# fix syntax highlight
-O_TO_S_DISP = $(if $(V),"$(O_TO_S_STR)"," LD $(@)")
-O_TO_S_CMD = "cmd_$@ = $(O_TO_S_STR)"
-O_TO_S_DO = @set -e; \
- echo $(O_TO_S_DISP); \
- $(O_TO_S)
+L_DISP=LD
+else
+O_TO_L = $(AR) crus $(RTE_OUTPUT)/lib/$(LIB_ONE) $(OBJS)
+L_DISP=AR
+endif
+O_TO_L_STR = $(subst ','\'',$(O_TO_L)) #')# fix syntax highlight
+O_TO_L_DISP = $(if $(V),"$(O_TO_L_STR)"," $(L_DISP) $(@)")
+O_TO_L_CMD = "cmd_$@ = $(O_TO_L_STR)"
+O_TO_L_DO = @set -e; \
+ mkdir -p $(RTE_OUTPUT)/lib; \
+ echo $(O_TO_L_DISP); \
+ $(O_TO_L)
-O_TO_A = $(AR) crus $(RTE_OUTPUT)/lib/$(LIB_ONE) $(OBJS)
-O_TO_A_STR = $(subst ','\'',$(O_TO_A)) #'# fix syntax highlight
-O_TO_A_DISP = $(if $(V),"$(O_TO_A_STR)"," LD $(@)")
-O_TO_A_CMD = "cmd_$@ = $(O_TO_A_STR)"
-O_TO_A_DO = @set -e; \
- echo $(O_TO_A_DISP); \
- $(O_TO_A)
#
# Archive objects to share library
#
-ifeq ($(RTE_BUILD_COMBINE_LIBS),y)
-ifeq ($(RTE_BUILD_SHARED_LIB),y)
$(LIB_ONE): FORCE
- @[ -d $(dir $@) ] || mkdir -p $(dir $@)
- $(O_TO_S_DO)
-else
-$(LIB_ONE): FORCE
- @[ -d $(dir $@) ] || mkdir -p $(dir $@)
- $(O_TO_A_DO)
-endif
-endif
+ $(O_TO_L_DO)
#
# Clean all generated files
--
1.9.3
next prev parent reply other threads:[~2014-10-02 15:49 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-02 15:56 [dpdk-dev] [PATCH 0/4] Fix build issues with CONFIG_RTE_BUILD_COMBINE_LIBS=y Sergio Gonzalez Monroy
2014-10-02 15:56 ` [dpdk-dev] [PATCH 1/4] Link combined shared library using CC Sergio Gonzalez Monroy
2014-10-02 15:56 ` [dpdk-dev] [PATCH 2/4] Do not generate individual libs when configured with RTE_BUILD_COMBINE_LIBS=y Sergio Gonzalez Monroy
2014-10-02 20:00 ` Matthew Hall
2014-10-02 15:56 ` [dpdk-dev] [PATCH 3/4] Link apps only against combined lib or individual libs, not both Sergio Gonzalez Monroy
2014-10-02 15:56 ` Sergio Gonzalez Monroy [this message]
2014-10-02 17:26 ` [dpdk-dev] [PATCH 0/4] Fix build issues with CONFIG_RTE_BUILD_COMBINE_LIBS=y Neil Horman
2014-10-02 20:04 ` Matthew Hall
2014-10-02 20:24 ` Neil Horman
2014-10-02 21:10 ` Matthew Hall
2014-10-03 0:52 ` Neil Horman
2014-10-03 10:31 ` Sergio Gonzalez Monroy
2014-10-03 11:28 ` Neil Horman
2014-10-03 23:52 ` Stephen Hemminger
2014-10-04 2:30 ` Neil Horman
2014-10-03 7:15 ` Thomas Monjalon
2014-10-03 8:10 ` Sergio Gonzalez Monroy
2014-10-03 8:27 ` Thomas Monjalon
2014-10-03 11:32 ` Neil Horman
2014-10-03 18:17 ` Matthew Hall
2014-10-03 19:15 ` Neil Horman
2014-10-03 21:21 ` Matthew Hall
2014-10-06 14:45 ` Neil Horman
2014-10-03 18:13 ` Matthew Hall
2014-10-03 18:00 ` Matthew Hall
2014-10-06 10:52 ` [dpdk-dev] [PATCH v2 0/4] Update build process Sergio Gonzalez Monroy
2014-10-06 10:52 ` [dpdk-dev] [PATCH v2 1/4] Link combined shared library using CC Sergio Gonzalez Monroy
2014-10-06 10:52 ` [dpdk-dev] [PATCH v2 2/4] Link apps only against single/combined library Sergio Gonzalez Monroy
2014-10-06 10:52 ` [dpdk-dev] [PATCH v2 3/4] Update library build process Sergio Gonzalez Monroy
2014-10-06 20:46 ` Matthew Hall
2014-10-07 9:55 ` Sergio Gonzalez Monroy
2014-10-08 22:36 ` Matthew Hall
2014-10-09 9:44 ` Sergio Gonzalez Monroy
2014-10-08 15:38 ` Thomas Monjalon
2014-10-06 10:52 ` [dpdk-dev] [PATCH v2 4/4] Link apps/DSOs against EXECENV_LDLIBS with --as-needed Sergio Gonzalez Monroy
2014-10-08 15:38 ` Thomas Monjalon
2014-10-09 9:23 ` Sergio Gonzalez Monroy
2014-10-06 14:49 ` [dpdk-dev] [PATCH v2 0/4] Update build process Neil Horman
2014-10-06 15:01 ` Sergio Gonzalez Monroy
2014-10-06 16:05 ` Neil Horman
2014-10-09 13:04 ` [dpdk-dev] [PATCH v3 0/6] Update libs " Sergio Gonzalez Monroy
2014-10-09 13:04 ` [dpdk-dev] [PATCH v3 1/6] Link combined shared library using CC Sergio Gonzalez Monroy
2014-10-09 13:04 ` [dpdk-dev] [PATCH v3 2/6] Link apps only against single/combined library Sergio Gonzalez Monroy
2014-10-09 13:04 ` [dpdk-dev] [PATCH v3 3/6] Remove CONFIG_RTE_BUILD_COMBINE_LIBS and related Sergio Gonzalez Monroy
2014-10-09 13:04 ` [dpdk-dev] [PATCH v3 4/6] Update library build process Sergio Gonzalez Monroy
2014-10-09 13:04 ` [dpdk-dev] [PATCH v3 5/6] Avoid duplicated code Sergio Gonzalez Monroy
2014-10-09 13:04 ` [dpdk-dev] [PATCH v3 6/6] Link apps/DSOs against EXECENV_LDLIBS with --as-needed Sergio Gonzalez Monroy
2014-10-13 16:01 ` [dpdk-dev] [PATCH v3 0/6] Update libs build process Gonzalez Monroy, Sergio
2014-10-21 9:43 ` Gonzalez Monroy, Sergio
2014-10-22 16:14 ` Gonzalez Monroy, Sergio
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1412265386-26291-5-git-send-email-sergio.gonzalez.monroy@intel.com \
--to=sergio.gonzalez.monroy@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).