Ignore:
Timestamp:
Dec 29, 2004, 8:43:09 PM (21 years ago)
Author:
bird
Message:

Added support for merging libs.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/tools/GCC3.kmk

    r188 r206  
    131131# @param        $(dirdep)   Directory creation dependency.
    132132# @param        $(deps)         Other dependencies.
    133 #
    134 # @param    $(outbase)  Output basename (full). Use this for list files and such.
     133# @param        $(othersrc) Unhandled sources.
     134#
     135# @param    $(outbase)  Output basename (full). Use this for list files and such.
     136
     137define TOOL_GCC3_LINK_LIBRARY_ADDMODE
     138
     139        echo "ADDMOD $(o)" >> $$@.ar-script
     140endef
     141
     142define TOOL_GCC3_LINK_LIBRARY_EXPAND_LIB
     143
     144        $(MKDIR) -p $(dir $(outbase))ar.extract/$(notdir $(srclib))
     145        cd $(dir $(outbase))ar.extract/$(notdir $(srclib)) && $(TOOL_GCC3_AR) x $(srclib)
     146        for o in `$(TOOL_GCC3_AR) t $(srclib)`; do echo "ADDMOD $(dir $(outbase))ar.extract/$(notdir $(srclib))/$$$${o}" >> $$@.ar-script; done
     147endef
     148
    135149define TOOL_GCC3_LINK_LIBRARY
    136 #$ (warning dbg: TOOL_GCC3_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) outbase=$(outbase))
    137 $(lib): $(dirdep) $(objs) $(deps)
     150#$ (warning dbg: TOOL_GCC3_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
     151$(lib): $(dirdep) $(objs) $(deps) $(filter %.a %.lib,$(othersrc))
    138152        $(call MSG_L1,Creating Library $$@)
    139153        $(RM) -f $$@
     154ifneq ($(strip $(filter %.a %.lib,$(othersrc))),,)
     155        echo "CREATE $$@" > $$@.ar-script
     156        $(foreach o, $(objs), $(TOOL_GCC3_LINK_LIBRARY_ADDMOD))
     157        $(foreach srclib, $(filter %.a %.lib,$(othersrc)),$(TOOL_GCC3_LINK_LIBRARY_EXPAND_LIB))
     158        echo "SAVE" >> $$@.ar-script
     159        echo "END" >> $$@.ar-script
     160        $(TOOL_GCC3_AR) -M < $$@.ar-script
     161        $(RM) -Rf "$(dir $(outbase))ar.extract/"
     162else
    140163        $(TOOL_GCC3_AR) $(flags) $$@ $(objs)
     164endif
    141165
    142166endef
Note: See TracChangeset for help on using the changeset viewer.