From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id 07FB37DE4 for ; Thu, 2 Oct 2014 17:49:41 +0200 (CEST) Received: from azsmga001.ch.intel.com ([10.2.17.19]) by orsmga103.jf.intel.com with ESMTP; 02 Oct 2014 08:54:08 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.04,639,1406617200"; d="scan'208";a="481528969" Received: from irvmail001.ir.intel.com ([163.33.26.43]) by azsmga001.ch.intel.com with ESMTP; 02 Oct 2014 08:56:27 -0700 Received: from sivswdev02.ir.intel.com (sivswdev02.ir.intel.com [10.237.217.46]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id s92FuRwH020624 for ; Thu, 2 Oct 2014 16:56:27 +0100 Received: from sivswdev02.ir.intel.com (localhost [127.0.0.1]) by sivswdev02.ir.intel.com with ESMTP id s92FuRpX026356 for ; Thu, 2 Oct 2014 16:56:27 +0100 Received: (from smonroy@localhost) by sivswdev02.ir.intel.com with id s92FuRZp026352 for dev@dpdk.org; Thu, 2 Oct 2014 16:56:27 +0100 From: Sergio Gonzalez Monroy To: dev@dpdk.org Date: Thu, 2 Oct 2014 16:56:26 +0100 Message-Id: <1412265386-26291-5-git-send-email-sergio.gonzalez.monroy@intel.com> X-Mailer: git-send-email 1.8.5.4 In-Reply-To: <1412265386-26291-1-git-send-email-sergio.gonzalez.monroy@intel.com> References: <1412265386-26291-1-git-send-email-sergio.gonzalez.monroy@intel.com> Subject: [dpdk-dev] [PATCH 4/4] Cleanup X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Oct 2014 15:49:43 -0000 Reduce code duplication. This patch is not required for the patch set to work. Signed-off-by: Sergio Gonzalez Monroy --- 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