Ignore:
Timestamp:
Dec 18, 2005, 2:52:47 PM (20 years ago)
Author:
bird
Message:

Big command dependency job. More installation stuff.

File:
1 edited

Legend:

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

    r353 r380  
    9494# @param    $(outbase)  Output basename (full). Use this for list files and such.
    9595# @param    $(objsuff)  Object suffix.
    96 define TOOL_GCC3_COMPILE_C
    97 #$ (warning dbg: TOOL_GCC3_COMPILE_C: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff))
    98 $(obj): $(deps) $(source) | $(dirdep)
    99         $(call MSG_L2,Compiling $$@ using GCC3)
     96TOOL_GCC3_COMPILE_C_OUTPUT =
     97TOOL_GCC3_COMPILE_C_DEPEND =
     98TOOL_GCC3_COMPILE_C_DEPORD =
     99define TOOL_GCC3_COMPILE_C_CMDS
    100100        $(TOOL_GCC3_CC) -c\
    101101                $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
    102                 -Wp,-MD,$(dep) -Wp,-MT,$$@ -Wp,-MP \
    103                 -o $$@\
     102                -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
     103                -o $(obj)\
    104104                $(call ABSPATH,$(source))
    105 
    106105endef
    107106
     
    117116# @param    $(dirdep)   Directory creation dependency.
    118117# @param    $(deps)             Other dependencies.
    119 #
    120118# @param    $(outbase)  Output basename (full). Use this for list files and such.
    121119# @param    $(objsuff)  Object suffix.
    122 define TOOL_GCC3_COMPILE_CXX
    123 #$ (warning dbg: TOOL_GCC3_COMPILE_CXX: target=$(target) source=$(source) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff))
    124 $(obj): $(deps) $(source) | $(dirdep)
    125         $(call MSG_L2,Compiling $$@ using GCC3)
     120TOOL_GCC3_COMPILE_CXX_OUTPUT =
     121TOOL_GCC3_COMPILE_CXX_DEPEND =
     122TOOL_GCC3_COMPILE_CXX_DEPORD =
     123define TOOL_GCC3_COMPILE_CXX_CMDS
    126124        $(TOOL_GCC3_CXX) -c\
    127125                $(flags) $(addprefix -I, $(incs)) $(addprefix -D, $(defs))\
    128                 -Wp,-MD,$(dep) -Wp,-MT,$$@ -Wp,-MP \
    129                 -o $$@\
     126                -Wp,-MD,$(dep) -Wp,-MT,$(obj) -Wp,-MP\
     127                -o $(obj)\
    130128                $(call ABSPATH,$(source))
    131 
    132129endef
    133130
     
    135132## Link library
    136133# @param    $(target)   Normalized main target name.
    137 # @param    $(lib)              Library name.
     134# @param    $(out)              Library name.
    138135# @param    $(objs)     Object files to put in the library.
    139136# @param    $(flags)    Flags.
     
    141138# @param    $(deps)             Other dependencies.
    142139# @param    $(othersrc) Unhandled sources.
    143 #
    144 # @param    $(outbase)  Output basename (full). Use this for list files and such.
    145 
    146 define TOOL_GCC3_LINK_LIBRARY_ADDMOD
    147 
    148         echo "ADDMOD $(o)" >> $(lib).ar-script
    149 endef
    150 
    151 define TOOL_GCC3_LINK_LIBRARY_EXPAND_LIB
    152 
    153         $(MKDIR) -p $(dir $(outbase))ar.extract/$(notdir $(srclib))
    154         cd $(dir $(outbase))ar.extract/$(notdir $(srclib)) && $(TOOL_GCC3_AR) x $(srclib)
    155         for o in `$(TOOL_GCC3_AR) t $(srclib)`; do echo "ADDMOD $(dir $(outbase))ar.extract/$(notdir $(srclib))/$$$${o}" >> $(lib).ar-script; done
    156 endef
    157 
    158 define TOOL_GCC3_LINK_LIBRARY
    159 #$ (warning dbg: TOOL_GCC3_LINK_LIBRARY: target=$(target) lib=$(lib) objs=$(objs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
    160 $(lib): $(deps) $(objs) $(filter %.a %.lib,$(othersrc)) | $(dirdep)
    161         $(call MSG_L1,Creating Library $$@)
    162         $(RM) -f $$@
    163 ifneq ($(strip $(filter %.a %.lib,$(othersrc))),)
    164         echo "CREATE $$@" > $(lib).ar-script
    165         $(foreach o, $(objs),$(TOOL_GCC3_LINK_LIBRARY_ADDMOD))
    166         $(foreach srclib, $(filter %.a %.lib,$(othersrc)),$(TOOL_GCC3_LINK_LIBRARY_EXPAND_LIB))
    167         echo "SAVE" >> $(lib).ar-script
    168         echo "END" >> $(lib).ar-script
    169         $(TOOL_GCC3_AR) -M < $(lib).ar-script
    170         $(RM) -Rf "$(dir $(outbase))ar.extract/"
    171 
    172 _OUT_FILES += $(lib).ar-script
    173 else
    174         $(TOOL_GCC3_AR) $(flags) $$@ $(objs)
    175 endif
    176 
     140# @param    $(outbase)  Output basename (full). Use this for list files and such.
     141TOOL_GCC3_LINK_LIBRARY_OUTPUT = $(out).ar-script
     142TOOL_GCC3_LINK_LIBRARY_DEPEND = $(filter %.a %.lib,$(othersrc))
     143TOOL_GCC3_LINK_LIBRARY_DEPORD =
     144define TOOL_GCC3_LINK_LIBRARY_CMDS
     145        $(APPEND) $(out).ar-script "CREATE $(out)"
     146        $(foreach o, $(objs)\
     147                ,$(NL)$(TAB)$(APPEND) $(out).ar-script "ADDMOD $(o)")
     148        $(foreach srclib, $(filter %.a %.lib,$(othersrc))\
     149                ,$(NL)$(TAB)$(APPEND) $(out).ar-script "ADDLIB $(srclib)")
     150        $(APPEND) $(out).ar-script "SAVE"
     151        $(APPEND) $(out).ar-script "END"
     152        $(TOOL_GCC3_AR) -M < $(out).ar-script
    177153endef
    178154
     
    190166# @param    $(custom_pre)   Custom step invoked before linking.
    191167# @param    $(custom_post)  Custom step invoked after linking.
    192 #
    193 # @param    $(outbase)  Output basename (full). Use this for list files and such.
    194 define TOOL_GCC3_LINK_PROGRAM
    195 #$ (warning dbg: TOOL_GCC3_LINK_PROGRAM: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase))
    196 $(out) $(outbase).map: $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) | $(dirdep)
    197         $(call MSG_L1,Creating Program $$@)
    198 ifneq ($(custom_pre),)
    199         $(eval $(custom_pre))
    200 endif
    201         $(RM) -f $$@
    202         $(TOOL_GCC3_LD) $(flags) -o $$@ $(objs) \
    203                 $(foreach p,$(libpath), -L$(p)) \
    204                 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) \
     168# @param    $(outbase)  Output basename (full). Use this for list files and such.
     169TOOL_GCC3_LINK_PROGRAM_OUTPUT = $(outbase).map
     170TOOL_GCC3_LINK_PROGRAM_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
     171TOOL_GCC3_LINK_PROGRAM_DEPORD =
     172define TOOL_GCC3_LINK_PROGRAM_CMDS
     173        $(TOOL_GCC3_LD) $(flags) -o $(out) $(objs)\
     174                $(foreach p,$(libpath), -L$(p))\
     175                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
    205176                $(call TOOL_GCC3_LD_MAP,$(outbase).map)
    206 ifneq ($(custom_post),)
    207         $(eval $(custom_post))
    208 endif
    209 _OUT_FILES += $(outbase).map
    210 
    211177endef
    212178
     
    224190# @param    $(custom_pre)   Custom step invoked before linking.
    225191# @param    $(custom_post)  Custom step invoked after linking.
    226 #
    227 # @param    $(outbase)  Output basename (full). Use this for list files and such.
    228 define TOOL_GCC3_LINK_DLL
    229 #$ (warning dbg: TOOL_GCC3_LINK_PROGRAM: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) deffile=$(deffile) outbase=$(outbase))
    230 $(out) $(outbase).map: $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) | $(dirdep)
    231         $(call MSG_L1,Creating Program $$@)
    232 ifneq ($(custom_pre),)
    233         $(eval $(custom_pre))
    234 endif
    235         $(RM) -f $$@
    236         $(TOOL_GCC3_LD) $(TOOL_GCC3_LDFLAGS.dll) $(flags) -o $$@ \
    237                 $(if $(filter-out win32 os2, $(BUILD_TARGET)),$(call TOOL_GCC3_LD_SONAME,$(target),$(out))) \
    238                 $(objs) \
    239                 $(foreach p,$(libpath), -L$(p)) \
    240                 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) \
     192# @param    $(outbase)  Output basename (full). Use this for list files and such.
     193TOOL_GCC3_LINK_DLL_OUTPUT = $(outbase).map
     194TOOL_GCC3_LINK_DLL_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
     195TOOL_GCC3_LINK_DLL_DEPORD =
     196define TOOL_GCC3_LINK_DLL_CMDS
     197        $(TOOL_GCC3_LD) $(TOOL_GCC3_LDFLAGS.dll) $(flags) -o $(out)\
     198                $(if $(filter-out win32 os2, $(BUILD_TARGET)),$(call TOOL_GCC3_LD_SONAME,$(target),$(out)))\
     199                $(objs)\
     200                $(foreach p,$(libpath), -L$(p))\
     201                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
    241202                $(call TOOL_GCC3_LD_MAP,$(outbase).map)
    242 ifneq ($(custom_post),)
    243         $(eval $(custom_post))
    244 endif
    245 _OUT_FILES += $(outbase).map
    246 
    247 endef
     203endef
     204
    248205
    249206## Link system module (windows aka driver, linux aka kernel module)
     
    259216# @param    $(custom_pre)   Custom step invoked before linking.
    260217# @param    $(custom_post)  Custom step invoked after linking.
    261 #
    262 # @param    $(outbase)  Output basename (full). Use this for list files and such.
    263 define TOOL_GCC3_LINK_SYSMOD
    264 #$ (warning dbg: TOOL_GCC3_LINK_SYSMOD: target=$(target) out=$(out) objs=$(objs) libs=$(libs) deps=$(deps) flags=$(flags) dirdep=$(dirdep) othersrc=$(othersrc) outbase=$(outbase))
    265 $(out) $(outbase).map: $(deps) $(objs) $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib))) | $(dirdep)
    266         $(call MSG_L1,Creating Program $$@)
    267 ifneq ($(custom_pre),)
    268         $(eval $(custom_pre))
    269 endif
    270         $(RM) -f $$@
    271         $(TOOL_GCC3_LD_SYSMOD) $(TOOL_GCC3_LDFLAGS.sysmod) $(flags) -o $$@ $(objs) \
    272                 $(foreach p,$(libpath), -L$(p)) \
    273                 $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib))) \
     218# @param    $(outbase)  Output basename (full). Use this for list files and such.
     219TOOL_GCC3_LINK_SYSMOD_OUTPUT = $(outbase).map
     220TOOL_GCC3_LINK_SYSMOD_DEPEND = $(foreach lib,$(libs),$(if $(findstring $(lib),$(subst /,x,$(lib))),, $(lib)))
     221TOOL_GCC3_LINK_SYSMOD_DEPORD =
     222define TOOL_GCC3_LINK_SYSMOD_CMDS
     223        $(TOOL_GCC3_LD_SYSMOD) $(TOOL_GCC3_LDFLAGS.sysmod) $(flags) -o $(out) $(objs)\
     224                $(foreach p,$(libpath), -L$(p))\
     225                $(foreach lib,$(libs), $(if $(findstring $(lib),$(subst /,x,$(lib))), -l$(patsubst lib%,%,$(basename $(lib))), $(lib)))\
    274226                $(call TOOL_GCC3_LD_SYSMOD_MAP,$(outbase).map)
    275 ifneq ($(custom_post),)
    276         $(eval $(custom_post))
    277 endif
    278 _OUT_FILES += $(outbase).map
    279 
    280 endef
    281 
     227endef
     228
Note: See TracChangeset for help on using the changeset viewer.