[dpdk-dev] [PATCH v3 4/6] Update library build process

Sergio Gonzalez Monroy sergio.gonzalez.monroy at intel.com
Thu Oct 9 15:04:56 CEST 2014


Remove all code related to building a separated static libs, and by default
only build a single/combined library when building static libs.
Build both separated and combined libraries when building shared libs.

Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy at intel.com>
---
 mk/rte.lib.mk | 39 +++++++++++----------------------------
 1 file changed, 11 insertions(+), 28 deletions(-)

diff --git a/mk/rte.lib.mk b/mk/rte.lib.mk
index 53a149d..e7420bf 100644
--- a/mk/rte.lib.mk
+++ b/mk/rte.lib.mk
@@ -66,19 +66,12 @@ 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_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; \
+	cp -f $(OBJS-y) $(RTE_OUTPUT)/build/lib; \
 	echo $(O_TO_S_DISP); \
 	$(O_TO_S) && \
 	echo $(O_TO_S_CMD) > $(call exe2cmd,$(@))
@@ -88,8 +81,8 @@ O_TO_S_DO = @set -e; \
 #
 # Archive objects in .a file if needed
 #
-ifeq ($(RTE_BUILD_SHARED_LIB),y)
 $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
+ifeq ($(RTE_BUILD_SHARED_LIB),y)
 	@[ -d $(dir $@) ] || mkdir -p $(dir $@)
 	$(if $(D),\
 		@echo -n "$< -> $@ " ; \
@@ -98,35 +91,25 @@ $(LIB): $(OBJS-y) $(DEP_$(LIB)) FORCE
 		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))
-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_S_STR)),\
 	    $(depfile_missing),\
 	    $(depfile_newer)),\
-	    $(O_TO_A_DO))
+	    $(O_TO_S_DO))
+else
+	@set -e; \
+	cp -f $(OBJS-y) $(RTE_OUTPUT)/build/lib;
 endif
 
 #
 # install lib in $(RTE_OUTPUT)/lib
 #
 $(RTE_OUTPUT)/lib/$(LIB): $(LIB)
+ifeq ($(RTE_BUILD_SHARED_LIB),y)
 	@echo "  INSTALL-LIB $(LIB)"
 	@[ -d $(RTE_OUTPUT)/lib ] || mkdir -p $(RTE_OUTPUT)/lib
 	$(Q)cp -f $(LIB) $(RTE_OUTPUT)/lib
+endif
 
 #
 # Clean all generated files
-- 
1.9.3



More information about the dev mailing list