# /***************************************************************************** | |
#* °æÈ¨ËùÓÐ (C)2015, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£ | |
#* | |
#* ÎļþÃû³Æ: lib_rules.mk | |
#* Îļþ±êʶ: lib_rules.mk | |
#* ÄÚÈÝÕªÒª: ¿âÎļþ¹æÔò | |
#* ʹÓ÷½·¨: include lib_rules.mk | |
#* | |
#* ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ | |
#* ----------------------------------------------------------------------------- | |
#* 2015/05/20 V1.0 ÕûºÏ ÁõÑÇÄÏ ÕûºÏ | |
#* | |
# ******************************************************************************/ | |
define BUILD_GCC_LIBRARY | |
$(if $(wildcard $(_SUBSYS_NAME)ar.mac),@$(RM) $(_SUBSYS_NAME)ar.mac) | |
$(if $(filter %.o,$(_ALL_OBJECTS)),$(VERB) $(AR) $(ARFLAGS) $@ $(filter %.o, $(_ALL_OBJECTS))) | |
$(if $(filter %.a, $(_ALL_OBJECTS)), | |
$(if $(filter %.o,$(_ALL_OBJECTS)), | |
@$(ECHO) OPEN $@ > $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac, | |
@$(ECHO) CREATE $@ > $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac | |
) | |
$(foreach LIB, $(filter %.a, $(_ALL_OBJECTS)), | |
@echo ADDLIB $(LIB) >> $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac | |
) | |
@$(ECHO) SAVE >> $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac | |
@$(ECHO) END >> $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac | |
@$(AR) -M < $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac | |
@$(RM) $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac | |
) | |
endef | |
lib: $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME).a | |
$(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME).a: $(_ALL_MDLS) | |
@$(ECHO) "" | |
@-$(MKDIR) $(_SUBSYS_LIB_PATH) | |
ifeq ($(USE_ENABLE_LTO),yes) | |
ifneq ($(DISABLE_LTO_ONCE),yes) | |
@$(RM) $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)-builtin.o | |
@$(AR2) $(ARFLAGS2) $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)-builtin.o $(sort $(_ALL_OBJECTS)) | |
else | |
$(AR) $(ARFLAGS) $@ $(_ALL_OBJECTS) | |
endif | |
else | |
$(AR) $(ARFLAGS) $@ $(_ALL_OBJECTS) | |
endif | |
@$(ECHO) "==================================================================" | |
@$(ECHO) "--- make lib $@ done." | |
@$(ECHO) "==================================================================" | |
@$(ECHO) "" | |
clean: $(addsuffix clean, $(_ALL_MDLS)) | |
@-$(RM) $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME).a | |
@$(ECHO) "==================================================================" | |
@$(ECHO) "--- clean lib file $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME).a done." | |
@$(ECHO) "==================================================================" | |
@$(ECHO) "" | |