Rewrite rules to avoid duplicated code. Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy at intel.com> --- mk/rte.sharelib.mk | 37 +++++++++++++++---------------------- 1 file changed, 15 insertions(+), 22 deletions(-)
diff --git a/mk/rte.sharelib.mk b/mk/rte.sharelib.mk index b32bd35..8fc6548 100644 --- a/mk/rte.sharelib.mk +++ b/mk/rte.sharelib.mk @@ -52,35 +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_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 + $(O_TO_L_DO) # # Clean all generated files -- 1.9.3