blob: 72356be81c9264a8f2f391bb0df6ed25ab4303fa [file] [log] [blame]
# /*****************************************************************************
#* °æÈ¨ËùÓÐ (C)2015, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
#*
#* ÎļþÃû³Æ: drv_sdk_lib_rules.mk
#* Îļþ±êʶ: drv_sdk_lib_rules.mk
#* ÄÚÈÝÕªÒª: ¿âÎļþ¹æÔò
#* ʹÓ÷½·¨: include drv_sdk_lib_rules.mk
#*
#* ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
#* -----------------------------------------------------------------------------
#* 2015/05/20 V1.0 ÕûºÏ ÁõÑÇÄÏ ÕûºÏ
#*
# ******************************************************************************/
define BUILD_SDKLIBRARY
$(if $(wildcard $(_SUBSYS_SDK_NAME)arsdk.mac),@$(RM) $(_SUBSYS_SDK_NAME)arsdk.mac)
$(if $(filter %.o,$(_ALL_OBJECTS_SDK)),$(AR) $(ARFLAGS) $@ $(filter %.o, $(_ALL_OBJECTS_SDK)))
$(if $(filter %.a, $(_ALL_OBJECTS_SDK)),
$(if $(filter %.o,$(_ALL_OBJECTS_SDK)),
@$(ECHO) OPEN $@ > $(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME)arsdk.mac,
@$(ECHO) CREATE $@ > $(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME)arsdk.mac
)
$(foreach LIB, $(filter %.a, $(_ALL_OBJECTS_SDK)),
@echo ADDLIB $(LIB) >> $(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME)arsdk.mac
)
@$(ECHO) SAVE >> $(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME)arsdk.mac
@$(ECHO) END >> $(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME)arsdk.mac
@$(AR) -M < $(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME)arsdk.mac
@$(RM) $(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME)arsdk.mac
)
endef
ifeq ($(USE_SDK_COMPILE),yes)
lib: $(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME).a
$(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME).a: $(_ALL_MDLS_SDK)
@$(ECHO) ""
@-$(MKDIR) $(_SUBSYS_SDK_LIB_PATH)
ifeq ($(USE_ENABLE_LTO),yes)
@$(RM) $(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME)-builtin.o
@$(AR2) $(ARFLAGS2) $(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME)-builtin.o $(_ALL_OBJECTS_SDK)
else
ifeq ($(CMPL_TYPE),gcc_arm_linux)
$(BUILD_SDKLIBRARY)
else
$(VERB)$(AR) $(ARFLAGS) $@ $(_ALL_OBJECTS_SDK)
endif
endif
@$(ECHO) "=================================================================="
@$(ECHO) "--- make lib $@ done."
@$(ECHO) "=================================================================="
@$(ECHO) ""
clean : sdkclean
sdkclean: $(addsuffix clean, $(_ALL_MDLS_SDK))
@-$(RM) $(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME).a
@$(ECHO) "=================================================================="
@$(ECHO) "--- clean lib file $(_SUBSYS_SDK_LIB_PATH)/$(_SUBSYS_SDK_NAME).a done."
@$(ECHO) "=================================================================="
@$(ECHO) ""
endif