Changeset 74 for trunk/kBuild/footer.kmk


Ignore:
Timestamp:
May 31, 2004, 4:19:05 AM (21 years ago)
Author:
bird
Message:

..

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/footer.kmk

    r73 r74  
    6060# @param    $1      source file
    6161# @param    $2      normalized main target
    62 _SOURCE_TOOL = $(firstword $($1_$2_TOOL) $($1_TOOL) $($2_TOOL) )
     62_SOURCE_TOOL = $(firstword $($1_$2_TOOL) $($1_TOOL) $($2_TOOL) $(TOOL))
    6363
    6464## Figure out where to put object files.
     
    9292endef
    9393$(foreach template, $(_TEMPLATES), $(eval $(def_templates)))
    94        
     94
    9595
    9696#
     
    102102# @param    $(target)   Target name.
    103103define def_inherit_defaults_one
    104 ifndef $1_$(prop)
     104ifndef $(target)_$(prop)
    105105ifdef $(prop)
    106 $1_$(prop) := $($(prop))
     106$(target)_$(prop) := $($(prop))
    107107endif
    108108endif
     
    215215$(eval tool:=$(call _SOURCE_TOOL,$(source),$(target)))
    216216$(eval defs        :=\
     217        $(TOOL_$(tool)_$(type)DEFS)\
     218        $(TOOL_$(tool)_$(type)DEFS.$(BUILD_TYPE))\
     219        $(DEFS)\
     220        $(DEFS.$(BUILD_TYPE))\
     221        $($(target)_DEFS)\
     222        $($(target)_DEFS.$(BUILD_TYPE))\
     223        $($(target)_DEFS.$(BUILD_TARGET))\
     224        $($(source)_DEFS)\
     225        $($(source)_DEFS.$(BUILD_TYPE))\
     226        $($(source)_DEFS.$(BUILD_TARGET))\
     227        $($(source)_$(type)DEFS)\
     228        $($(source)_$(type)DEFS.$(BUILD_TYPE))\
     229        $($(source)_$(type)DEFS.$(BUILD_TARGET))\
     230        $($(target)_$(type)DEFS)\
     231        $($(target)_$(type)DEFS.$(BUILD_TYPE))\
     232        $($(target)_$(type)DEFS.$(BUILD_TARGET))\
     233        $($(target)_$(source)_DEFS)\
     234        $($(target)_$(source)_DEFS.$(BUILD_TYPE))\
     235        $($(target)_$(source)_DEFS.$(BUILD_TARGET))\
    217236        $($(target)_$(source)_$(type)DEFS)\
    218         $($(target)_$(source)_DEFS)\
    219         $($(source)_$(type)DEFS)\
    220         $($(source)_DEFS)\
    221         $($(target)_$(type)DEFS)\
    222         $($(target)_DEFS)\
    223         $(DEFS)\
    224         $(TOOL_$(tool)_$(type)DEFS)\
     237        $($(target)_$(source)_$(type)DEFS.$(BUILD_TYPE))\
     238        $($(target)_$(source)_$(type)DEFS.$(BUILD_TARGET))\
    225239        )
    226240$(eval incs        :=\
     241        $($(target)_$(source)_$(type)INCS.$(BUILD_TARGET))\
     242        $($(target)_$(source)_$(type)INCS.$(BUILD_TYPE))\
    227243        $($(target)_$(source)_$(type)INCS)\
     244        $($(target)_$(source)_INCS.$(BUILD_TARGET))\
     245        $($(target)_$(source)_INCS.$(BUILD_TYPE))\
    228246        $($(target)_$(source)_INCS)\
     247        $($(source)_$(type)INCS.$(BUILD_TARGET))\
     248        $($(source)_$(type)INCS.$(BUILD_TYPE))\
    229249        $($(source)_$(type)INCS)\
     250        $($(source)_INCS.$(BUILD_TARGET))\
     251        $($(source)_INCS.$(BUILD_TYPE))\
    230252        $($(source)_INCS)\
     253        $($(target)_$(type)INCS.$(BUILD_TARGET))\
     254        $($(target)_$(type)INCS.$(BUILD_TYPE))\
    231255        $($(target)_$(type)INCS)\
     256        $($(target)_INCS.$(BUILD_TARGET))\
     257        $($(target)_INCS.$(BUILD_TYPE))\
    232258        $($(target)_INCS)\
     259        $(INCS.$(BUILD_TARGET))\
     260        $(INCS.$(BUILD_TYPE))\
    233261        $(INCS)\
     262        $(TOOL_$(tool)_$(type)INCS.$(BUILD_TARGET))\
     263        $(TOOL_$(tool)_$(type)INCS.$(BUILD_TYPE))\
    234264        $(TOOL_$(tool)_$(type)INCS)\
    235265        )
     
    237267        $(TOOL_$(tool)_$(type)FLAGS)\
    238268        $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TYPE))\
     269        $(TOOL_$(tool)_$(type)FLAGS.$(BUILD_TARGET))\
    239270        $($(type)FLAGS)\
    240271        $($(type)FLAGS.$(BUILD_TYPE))\
     272        $($(type)FLAGS.$(BUILD_TARGET))\
    241273        $($(target)_$(type)FLAGS)\
    242274        $($(target)_$(type)FLAGS.$(BUILD_TYPE))\
     275        $($(target)_$(type)FLAGS.$(BUILD_TARGET))\
    243276        $($(source)_$(type)FLAGS)\
    244277        $($(source)_$(type)FLAGS.$(BUILD_TYPE))\
     278        $($(source)_$(type)FLAGS.$(BUILD_TARGET))\
    245279        $($(target)_$(source)_$(type)FLAGS)\
    246280        $($(target)_$(source)_$(type)FLAGS.$(BUILD_TYPE))\
     281        $($(target)_$(source)_$(type)FLAGS.$(BUILD_TARGET))\
    247282        )
    248283$(eval outbase     := $(call _OBJECT_BASE,$(source),$(target)))
    249284$(eval dirdep      := $(dir $(outbase)).dir_created)
    250 $(eval objsuff     := $(firstword $($(target)_$(source)_OBJSUFF) $($(source)_OBJSUFF) $($(target)_OBJSUFF) $(TOOL_$(tool)_$(type)OBJSUFF) $(SUFF_OBJ)))
     285$(eval objsuff     := $(firstword \
     286        $($(target)_$(source)_OBJSUFF.$(BUILD_TARGET))\
     287        $($(target)_$(source)_OBJSUFF)\
     288        $($(source)_OBJSUFF.$(BUILD_TARGET))\
     289        $($(source)_OBJSUFF)\
     290        $($(target)_OBJSUFF.$(BUILD_TARGET))\
     291        $($(target)_OBJSUFF)\
     292        $(TOOL_$(tool)_$(type)OBJSUFF.$(BUILD_TARGET))\
     293        $(TOOL_$(tool)_$(type)OBJSUFF)\
     294        $(SUFF_OBJ)\
     295        ))
    251296$(eval obj         := $(outbase)$(objsuff))
    252 $(eval depfile     := $(outbase)$(SUFF_DEP))
     297$(eval dep         := $(outbase)$(SUFF_DEP))
    253298
    254299#$ (warning dbg: target=$(target) source=$(source) tool=$(tool) obj=$(obj) dep=$(dep) flags=$(flags) defs=$(defs) incs=$(incs) dirdep=$(dirdep) outbase=$(outbase) objsuff=$(objsuff))
     
    261306
    262307## Generic macro for processing all target sources.
    263 # @param    $target     Normalized target name.
     308# @param    $(target)   Normalized target name.
    264309define def_target_sources
    265310#$ (warning def_target_sources)
     
    283328
    284329## Library (one).
    285 # @param    $(lib)  Library name
     330# @param    $(target)   Normalized library (target) name.
    286331define def_lib
    287332# source -> object
     
    290335# library
    291336$(eval tool        := $(firstword $($(target)_TOOL) $(TOOL)))
    292 $(eval flags       := $($(target)_ARFLAGS) $(ARFLAGS) $(TOOL_$(tool)_ARFLAGS))
    293 $(eval libsuff     := $(firstword $($(target)_LIBSUFF) $($(target)_LIBSUFF) $(TOOL_$(tool)_ARLIBSUFF) $(SUFF_LIB)))
     337$(eval flags       :=\
     338        $(TOOL_$(tool)_ARFLAGS)\
     339        $(TOOL_$(tool)_ARFLAGS.$(BUILD_TYPE))\
     340        $(ARFLAGS)\
     341        $(ARFLAGS.$(BUILD_TYPE))\
     342        $($(target)_ARFLAGS)\
     343        $($(target)_ARFLAGS.$(BUILD_TYPE))\
     344        )
     345$(eval libsuff     := $(firstword\
     346        $($(target)_LIBSUFF.$(BUILD_TARGET))\
     347        $($(target)_LIBSUFF)\
     348        $(TOOL_$(tool)_ARLIBSUFF.$(BUILD_TARGET))\
     349        $(TOOL_$(tool)_ARLIBSUFF)\
     350        $(SUFF_LIB)\
     351))
    294352## @todo prefix
    295353$(eval outbase     := $(call _TARGET_BASE,$(target),$(target)))
     
    315373#
    316374
     375## Program (one).
     376# @param    $(target)   Normalized target (program) name.
     377define def_program
     378# source -> object
     379$(eval $(def_target_sources))
     380
     381# library
     382$(eval tool        := $(firstword $($(target)_TOOL) $(TOOL)))
     383$(eval flags       :=\
     384        $(TOOL_$(tool)_LDFLAGS)\
     385        $(TOOL_$(tool)_LDFLAGS.$(BUILD_TYPE))\
     386        $(LDFLAGS)\
     387        $(LDFLAGS.$(BUILD_TYPE))\
     388        $($(target)_LDFLAGS)\
     389        $($(target)_LDFLAGS.$(BUILD_TYPE))\
     390)
     391$(eval exesuff     := $(firstword $($(target)_EXESUFF) $($(target)_EXESUFF) $(TOOL_$(tool)_LDEXESUFF) $(SUFF_EXE)))
     392$(eval outbase     := $(call _TARGET_BASE,$(target),$(target)))
     393$(eval exe         := $(outbase)$(exesuff))
     394$(eval objs         = $(_OBJS_$(target)))
     395$(eval libs        :=\
     396        $($(target)_LIBS.$(BUILD_TYPE))\
     397        $($(target)_LIBS)\
     398        $(LIBS.$(BUILD_TYPE))\
     399        $(LIBS)\
     400        $(TOOL_$(tool)_LIBS.$(BUILD_TYPE))\
     401        $(TOOL_$(tool)_LIBS)\
     402)
     403$(eval libpath    :=\
     404        $($(target)_LIBPATH.$(BUILD_TYPE))\
     405        $($(target)_LIBPATH)\
     406        $(LIBPATH.$(BUILD_TYPE))\
     407        $(LIBPATH)\
     408        $(TOOL_$(tool)_LIBPATH.$(BUILD_TYPE))\
     409        $(TOOL_$(tool)_LIBPATH)\
     410)
     411$(eval dirdep      := $(dir $(exe)).dir_created)
     412## @todo fix dependencies
     413$(eval deps        := )
     414#
     415$(eval deffile    := $(strip $(firstword
     416        $($(target)_DEFFILE.$(BUILD_TARGET).$(BUILD_TYPE))\
     417        $($(target)_DEFFILE.$(BUILD_TARGET))\
     418        $($(target)_DEFFILE.$(BUILD_TYPE))\
     419        $($(target)_DEFFILE)\
     420        $(DEFFILE.$(BUILD_TARGET).$(BUILD_TYPE))\
     421        $(DEFFILE.$(BUILD_TARGET))\
     422        $(DEFFILE.$(BUILD_TYPE))\
     423        $(DEFFILE)\
     424)))
     425$(eval custom_pre    := $(strip $(firstword
     426        $($(target)_CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
     427        $($(target)_CUSTOM_PRE.$(BUILD_TARGET))\
     428        $($(target)_CUSTOM_PRE.$(BUILD_TYPE))\
     429        $($(target)_CUSTOM_PRE)\
     430        $(CUSTOM_PRE.$(BUILD_TARGET).$(BUILD_TYPE))\
     431        $(CUSTOM_PRE.$(BUILD_TARGET))\
     432        $(CUSTOM_PRE.$(BUILD_TYPE))\
     433        $(CUSTOM_PRE)\
     434)))
     435$(eval custom_post    := $(strip $(firstword
     436        $($(target)_CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
     437        $($(target)_CUSTOM_POST.$(BUILD_TARGET))\
     438        $($(target)_CUSTOM_POST.$(BUILD_TYPE))\
     439        $($(target)_CUSTOM_POST)\
     440        $(CUSTOM_POST.$(BUILD_TARGET).$(BUILD_TYPE))\
     441        $(CUSTOM_POST.$(BUILD_TARGET))\
     442        $(CUSTOM_POST.$(BUILD_TYPE))\
     443        $(CUSTOM_POST)\
     444)))
     445
     446$(eval $(TOOL_$(tool)_LINK_PROGRAM))
     447
     448_OBJS += $(_OBJS_$(target))
     449_EXES += $(exe)
     450endef
     451
     452# Process libraries
     453$(foreach target, $(PROGRAMS), $(eval $(def_program)))
     454
    317455
    318456
     
    360498
    361499
    362 objs: $(_OBJS)
     500objects: $(_OBJS)
    363501        echo "dbg: _OBJS = $(_OBJS)"
    364502
    365 libs: $(_LIBS)
     503libraries: $(_LIBS)
    366504        echo "dbg: _LIBS = $(_LIBS)"
     505
     506programs: $(_EXES)
     507        echo "dbg: _EXES = $(_EXES)"
    367508
    368509
Note: See TracChangeset for help on using the changeset viewer.