lh | 9ed821d | 2023-04-07 01:36:19 -0700 | [diff] [blame^] | 1 | # /*****************************************************************************
|
| 2 | #* °æÈ¨ËùÓÐ (C)2015, ÖÐÐËͨѶ¹É·ÝÓÐÏÞ¹«Ë¾¡£
|
| 3 | #*
|
| 4 | #* ÎļþÃû³Æ: lib_rules.mk
|
| 5 | #* Îļþ±êʶ: lib_rules.mk
|
| 6 | #* ÄÚÈÝÕªÒª: ¿âÎļþ¹æÔò
|
| 7 | #* ʹÓ÷½·¨: include lib_rules.mk
|
| 8 | #*
|
| 9 | #* ÐÞ¸ÄÈÕÆÚ °æ±¾ºÅ Ð޸ıê¼Ç ÐÞ¸ÄÈË ÐÞ¸ÄÄÚÈÝ
|
| 10 | #* -----------------------------------------------------------------------------
|
| 11 | #* 2015/05/20 V1.0 ÕûºÏ ÁõÑÇÄÏ ÕûºÏ
|
| 12 | #*
|
| 13 | # ******************************************************************************/
|
| 14 |
|
| 15 | define BUILD_GCC_LIBRARY
|
| 16 | $(if $(wildcard $(_SUBSYS_NAME)ar.mac),@$(RM) $(_SUBSYS_NAME)ar.mac)
|
| 17 | $(if $(filter %.o,$(_ALL_OBJECTS)),$(VERB) $(AR) $(ARFLAGS) $@ $(filter %.o, $(_ALL_OBJECTS)))
|
| 18 | $(if $(filter %.a, $(_ALL_OBJECTS)),
|
| 19 | $(if $(filter %.o,$(_ALL_OBJECTS)),
|
| 20 | @$(ECHO) OPEN $@ > $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac,
|
| 21 | @$(ECHO) CREATE $@ > $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac
|
| 22 | )
|
| 23 | $(foreach LIB, $(filter %.a, $(_ALL_OBJECTS)),
|
| 24 | @echo ADDLIB $(LIB) >> $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac
|
| 25 | )
|
| 26 | @$(ECHO) SAVE >> $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac
|
| 27 | @$(ECHO) END >> $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac
|
| 28 | @$(AR) -M < $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac
|
| 29 | @$(RM) $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)ar.mac
|
| 30 | )
|
| 31 | endef
|
| 32 |
|
| 33 | lib: $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME).a
|
| 34 |
|
| 35 | $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME).a: $(_ALL_MDLS)
|
| 36 | @$(ECHO) ""
|
| 37 | @-$(MKDIR) $(_SUBSYS_LIB_PATH)
|
| 38 | ifeq ($(USE_ENABLE_LTO),yes)
|
| 39 | ifneq ($(DISABLE_LTO_ONCE),yes)
|
| 40 | @$(RM) $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)-builtin.o
|
| 41 | @$(AR2) $(ARFLAGS2) $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME)-builtin.o $(sort $(_ALL_OBJECTS))
|
| 42 | else
|
| 43 | $(AR) $(ARFLAGS) $@ $(_ALL_OBJECTS)
|
| 44 | endif
|
| 45 | else
|
| 46 | $(AR) $(ARFLAGS) $@ $(_ALL_OBJECTS)
|
| 47 | endif
|
| 48 | @$(ECHO) "=================================================================="
|
| 49 | @$(ECHO) "--- make lib $@ done."
|
| 50 | @$(ECHO) "=================================================================="
|
| 51 | @$(ECHO) ""
|
| 52 |
|
| 53 | clean: $(addsuffix clean, $(_ALL_MDLS))
|
| 54 | @-$(RM) $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME).a
|
| 55 | @$(ECHO) "=================================================================="
|
| 56 | @$(ECHO) "--- clean lib file $(_SUBSYS_LIB_PATH)/$(_SUBSYS_NAME).a done."
|
| 57 | @$(ECHO) "=================================================================="
|
| 58 | @$(ECHO) ""
|
| 59 |
|