Changeset 1496 for trunk/kBuild


Ignore:
Timestamp:
Apr 7, 2008, 1:16:10 AM (17 years ago)
Author:
bird
Message:

Use %, $(commands ), local vars, evalval and the other new stuff.

Location:
trunk/kBuild
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/footer.kmk

    r1472 r1496  
    346346# @param    properties_deferred_r List of the properties with deferred expansion (e.g. function), accumulating on the right side.
    347347define def_inherit_keyword
    348 prefix   := $(word 1,$(subst :, ,$(prefix_keyword)))
    349 trg_key  := $(word 2,$(subst :, ,$(prefix_keyword)))
    350 src_key  := $($(prefix)_$(trg_key)_EXTENDS)
    351 by       := $($(prefix)_$(trg_key)_EXTENDS_BY)
     348local prefix   := $(word 1,$(subst :, ,$(prefix_keyword)))
     349local trg_key  := $(word 2,$(subst :, ,$(prefix_keyword)))
     350local src_key  := $($(prefix)_$(trg_key)_EXTENDS)
     351local by       := $($(prefix)_$(trg_key)_EXTENDS_BY)
    352352
    353353# Inherit the properties.
     
    546546define def_inherit
    547547
    548 # Load it.
     548# Load it - loading is a mess, fix.
    549549ifneq ($(load_function),)
    550  loading := $(patsubst $(src_prefix)%,%,$(trg))
    551  $(eval $(value $(load_function)))
    552 endif
    553 
    554 src := $(strip $($(trg)_EXTENDS))
     550 local loading := $(patsubst $(src_prefix)%,%,$(trg))
     551 $(evalvalctx $(load_function))
     552endif
     553
     554local src := $(strip $($(trg)_EXTENDS))
    555555ifneq ($(src),)
    556556 ifndef $(trg)_EXTENDS_STATUS_
     
    559559  # Load the source.
    560560  ifneq ($(load_function),)
    561    loading := $(src)
    562    $(eval $(value $(load_function)))
     561   local loading := $(src)
     562   $(evalvalctx $(load_function))
    563563  endif
    564564
    565565  # less typing.
    566   src := $(src_prefix)$(src)
     566  local src := $(src_prefix)$(src)
    567567
    568568  # Recursivly process the parent (src) if it's inherting from somebody too.
     
    572572        # out current variable. 'src' OTOH will be overwritten.
    573573    #$ (warning def_inherit: recursing into $(src) from $(trg))
    574     $(foreach trg, $(src), $(eval $(value def_inherit)))
    575     src := $(src_prefix)$(strip $($(trg)_EXTENDS))
     574    $(foreach trg, $(src), $(evalval def_inherit))
     575    local src := $(src_prefix)$(strip $($(trg)_EXTENDS))
    576576   endif
    577577  endif
    578578
    579579  # Get & check EXTENDS_BY.
    580   by = $(strip $($(trg)_EXTENDS_BY))
     580  local by = $(strip $($(trg)_EXTENDS_BY))
    581581  ifeq ($(by),)
    582    by = overriding
     582   local by = overriding
    583583  else ifn1of ($(by), overriding appending prepending)
    584584   $(error kBuild: Invalid EXTENDS_BY value '$(by)' on '$(trg)'!)
     
    604604
    605605# Keyword inheritance.
    606 $(foreach prefix_keyword, $(join $(_KEYWORDS_PREFIX), $(addprefix :,$(_KEYWORDS_EXTENDS))), $(eval $(value def_inherit_keyword)))
     606$(foreach prefix_keyword, $(join $(_KEYWORDS_PREFIX), $(addprefix :,$(_KEYWORDS_EXTENDS))), $(evalval def_inherit_keyword))
    607607
    608608endef # def_inherit
     
    630630ifndef TEMPLATE_$(loading)
    631631 TEMPLATE_$(loading)_KMK_FILE := $(firstword $(foreach path, $(KBUILD_TEMPLATE_PATHS) $(PATH_KBUILD)/templates $(KBUILD_DEFAULT_PATHS), $(wildcard $(path)/$(loading).kmk)))
    632  ifneq ($(TEMPLATE_$(loading)_KMK_FILE),)
     632 ifeq ($(TEMPLATE_$(loading)_KMK_FILE),)
    633633  $(error kBuild: Cannot find include file for the template '$(loading)'! Searched: $(KBUILD_TEMPLATE_PATHS) $(PATH_KBUILD)/templates $(KBUILD_DEFAULT_PATHS))
    634634 endif
     
    639639endif
    640640endef # def_templates_load_function
    641 $(foreach loading, $(_TEMPLATES), $(eval $(value def_templates_load_function)))
     641$(foreach loading, $(_TEMPLATES), $(evalval def_templates_load_function))
    642642
    643643
     
    682682endef # def_collect_bld_xyz
    683683$(foreach src, $(addprefix TEMPLATE_, $(_TEMPLATES)) $(_ALL_TARGETS) \
    684         ,$(eval $(value def_collect_bld_xyz)))
     684        ,$(evalval def_collect_bld_xyz))
    685685
    686686# Drop duplicate values.
     
    697697define def_keyword_ordering
    698698# Check for EXTENDS, fix and validate it if found.
    699 src := $(strip $($(prefix)_$(keyword)_EXTENDS))
     699local src := $(strip $($(prefix)_$(keyword)_EXTENDS))
    700700ifneq ($(src),)
    701701 ifndef $(prefix)_$(keyword)_EXTENDS_STATUS_
     
    709709   # 'foreach' will create 'keyword' in a new variable context hiding
    710710   # out current variable. 'src' OTOH will be overwritten.
    711    $(foreach keyword, $(src), $(eval $(value def_keyword_ordering)))
    712    src := $(strip $($(prefix)_$(keyword)_EXTENDS))
     711   $(foreach keyword, $(src), $(evalval def_keyword_ordering))
     712   local src := $(strip $($(prefix)_$(keyword)_EXTENDS))
    713713  endif
    714714
    715715  # Check and strip EXTENDS_BY.
    716   by = $(strip $($(prefix)_$(keyword)_EXTENDS_BY))
     716  local by = $(strip $($(prefix)_$(keyword)_EXTENDS_BY))
    717717  ifeq ($(by),)
    718    by = overriding
     718   local by = overriding
    719719  else ifn1of ($(by), overriding appending prepending)
    720720   $(error kBuild: Invalid EXTENDS_BY value '$(by)' on '$(keyword)'!)
     
    750750prefix := BLD_TYPE
    751751valid := $(KBUILD_BLD_TYPES)
    752 $(foreach keyword, $(_BLD_TYPES)  , $(eval $(value def_keyword_ordering)))
     752$(foreach keyword, $(_BLD_TYPES)  , $(evalval def_keyword_ordering))
    753753
    754754prefix := BLD_TRG
    755755valid := $(KBUILD_OSES)
    756 $(foreach keyword, $(_BLD_TARGETS), $(eval $(value def_keyword_ordering)))
     756$(foreach keyword, $(_BLD_TARGETS), $(evalval def_keyword_ordering))
    757757
    758758prefix := BLD_ARCH
    759759valid := $(KBUILD_ARCHES)
    760 $(foreach keyword, $(_BLD_ARCHES) , $(eval $(value def_keyword_ordering)))
     760$(foreach keyword, $(_BLD_ARCHES) , $(evalval def_keyword_ordering))
    761761
    762762prefix := BLD_CPU
    763763valid := $(KBUILD_CPUS)
    764 $(foreach keyword, $(_BLD_CPUS)   , $(eval $(value def_keyword_ordering)))
     764$(foreach keyword, $(_BLD_CPUS)   , $(evalval def_keyword_ordering))
    765765
    766766## @todo Inherit bld_trg.bld_arch for too?
     
    799799properties_now_r    := $(PROPS_FETCHES_ACCUMULATE_R)
    800800properties_deferred := $(PROPS_FETCHES_DEFERRED)
    801 $(foreach trg, $(_ALL_FETCHES),$(eval $(value def_inherit)))
     801$(foreach trg, $(_ALL_FETCHES),$(evalval def_inherit))
    802802
    803803## Patches. - not implemented yet.
     
    806806#properties_now_r    := $(PROPS_PATCHES_ACCUMULATE_R)
    807807#properties_deferred := $(PROPS_PATCHES_DEFERRED)
    808 #$(foreach trg, $(_ALL_PATCHES),$(eval $(value def_inherit)))
     808#$(foreach trg, $(_ALL_PATCHES),$(evalval def_inherit))
    809809
    810810# Programs and build programs.
     
    813813properties_now_r    := $(PROPS_PROGRAMS_ACCUMULATE_R)
    814814properties_deferred := $(PROPS_PROGRAMS_DEFERRED)
    815 $(foreach trg, $(_ALL_BLDPROGS) $(_ALL_PROGRAMS),$(eval $(value def_inherit)))
     815$(foreach trg, $(_ALL_BLDPROGS) $(_ALL_PROGRAMS),$(evalval def_inherit))
    816816
    817817# Libraries and import libraries.
     
    821821properties_deferred := $(PROPS_LIBRARIES_DEFERRED)
    822822if1of ($(BUILD_TARGET), nt os2 win)
    823  $(foreach trg, $(_ALL_LIBRARIES) $(_ALL_IMPORT_LIBS),$(eval $(value def_inherit)))
     823 $(foreach trg, $(_ALL_LIBRARIES) $(_ALL_IMPORT_LIBS),$(evalval def_inherit))
    824824else
    825  $(foreach trg, $(_ALL_LIBRARIES),$(eval $(value def_inherit)))
     825 $(foreach trg, $(_ALL_LIBRARIES),$(evalval def_inherit))
    826826endif
    827827
     
    832832properties_deferred := $(PROPS_DLLS_DEFERRED)
    833833if1of ($(BUILD_TARGET), nt os2 win)
    834  $(foreach trg, $(_ALL_DLLS),$(eval $(value def_inherit)))
     834 $(foreach trg, $(_ALL_DLLS),$(evalval def_inherit))
    835835else
    836  $(foreach trg, $(_ALL_DLLS) $(_ALL_IMPORT_LIBS),$(eval $(value def_inherit)))
     836 $(foreach trg, $(_ALL_DLLS) $(_ALL_IMPORT_LIBS),$(evalval def_inherit))
    837837endif
    838838
     
    842842properties_now_r    := $(PROPS_SYSMODS_ACCUMULATE_R)
    843843properties_deferred := $(PROPS_SYSMODS_DEFERRED)
    844 $(foreach trg, $(_ALL_SYSMODS),$(eval $(value def_inherit)))
     844$(foreach trg, $(_ALL_SYSMODS),$(evalval def_inherit))
    845845
    846846# Installs.
     
    849849properties_now_r    := $(PROPS_INSTALLS_ACCUMULATE_R)
    850850properties_deferred := $(PROPS_INSTALLS_DEFERRED)
    851 $(foreach trg, $(_ALL_INSTALLS),$(eval $(value def_inherit)))
     851$(foreach trg, $(_ALL_INSTALLS),$(evalval def_inherit))
    852852
    853853ifdef KBUILD_PROFILE_SELF
     
    878878properties_deferred_l := $(PROPS_ACCUMULATE_L)
    879879properties_deferred_r := $(PROPS_ACCUMULATE_R)
    880 $(foreach trg, $(addprefix TEMPLATE_,$(_TEMPLATES)),$(eval $(value def_inherit)))
     880$(foreach trg, $(addprefix TEMPLATE_,$(_TEMPLATES)),$(evalval def_inherit))
    881881
    882882# done inheriting.
     
    10631063# Expand the template if specified.
    10641064ifneq ($($(target)_TEMPLATE),)
    1065 $(foreach prop,$(PROPS_SINGLE),$(eval $(value def_inherit_template_one)))
     1065$(foreach prop,$(PROPS_SINGLE),$(evalval def_inherit_template_one))
    10661066$(foreach prop,$(PROPS_DEFERRED),$(eval $(def_inherit_template_one_deferred))) # exploits the 2 evaluation, so no value!
    10671067$(foreach prop,$(PROPS_ACCUMULATE_L),$(eval $(def_inherit_template_one_accumulate_l))) # += works fine without value
     
    10741074bld_trg_arch := $(BUILD_TARGET_ARCH)
    10751075bld_trg_cpu := $(BUILD_TARGET_CPU)
    1076 $(foreach target, $(_ALL_BUILD_TARGET_TARGETS),$(eval $(value def_inherit_template)))
     1076$(foreach target, $(_ALL_BUILD_TARGET_TARGETS),$(evalval def_inherit_template))
    10771077
    10781078bld_trg := $(BUILD_PLATFORM)
    10791079bld_trg_arch := $(BUILD_PLATFORM_ARCH)
    10801080bld_trg_cpu := $(BUILD_PLATFORM_CPU)
    1081 $(foreach target, $(_ALL_BUILD_PLATFORM_TARGETS),$(eval $(value def_inherit_template)))
     1081$(foreach target, $(_ALL_BUILD_PLATFORM_TARGETS),$(evalval def_inherit_template))
    10821082
    10831083ifdef KBUILD_PROFILE_SELF
     
    11261126
    11271127define def_tools_sdks_target
    1128 _bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
    1129 _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
    1130 _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
    1131 _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(bld_trg_cpu))
     1128local _bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
     1129local _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
     1130local _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
     1131local _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(bld_trg_cpu))
    11321132
    11331133$(eval _TOOLS += $(foreach prop, $(PROPS_TOOLS), \
     
    11481148        $($(target)_SOURCES.$(_bld_type)) \
    11491149        $($(target)_SOURCES) \
    1150         , $(eval $(value def_tools_sdks_target_source)))
     1150        , $(evalval def_tools_sdks_target_source))
    11511151endef # def_tools_sdks_target
    11521152
    11531153define def_tools_srcname_target
    1154 _bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
    1155 _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
    1156 _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
    1157 _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(bld_trg_cpu))
     1154local _bld_type := $(firstword $($(target)_BLD_TYPE) $(BUILD_TYPE))
     1155local _bld_trg := $(firstword $($(target)_BLD_TRG) $(bld_trg))
     1156local _bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(bld_trg_arch))
     1157local _bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU) $(bld_trg_cpu))
    11581158
    11591159$(foreach source, $(notdir\
     
    11641164        $($(target)_SOURCES.$(_bld_type)) \
    11651165        $($(target)_SOURCES) \
    1166         ), $(eval $(value def_tools_sdks_target_source)))
     1166        ), $(evalval def_tools_sdks_target_source))
    11671167endef # def_tools_srcname_target
    11681168
     
    11701170bld_trg_arch := $(BUILD_TARGET_ARCH)
    11711171bld_trg_cpu := $(BUILD_TARGET_CPU)
    1172 $(foreach target, $(_ALL_BUILD_TARGET_TARGETS), $(eval $(value def_tools_sdks_target)))
    1173 $(foreach target, $(_ALL_SRCNAME_TARGETS), $(eval $(value def_tools_srcname_target)))
     1172$(foreach target, $(_ALL_BUILD_TARGET_TARGETS), $(evalval def_tools_sdks_target))
     1173$(foreach target, $(_ALL_SRCNAME_TARGETS), $(evalval def_tools_srcname_target))
    11741174
    11751175bld_trg := $(BUILD_PLATFORM)
    11761176bld_trg_arch := $(BUILD_PLATFORM_ARCH)
    11771177bld_trg_cpu := $(BUILD_PLATFORM_CPU)
    1178 $(foreach target, $(_ALL_BUILD_PLATFORM_TARGETS), $(eval $(value def_tools_sdks_target)))
     1178$(foreach target, $(_ALL_BUILD_PLATFORM_TARGETS), $(evalval def_tools_sdks_target))
    11791179
    11801180_TOOLS := $(sort $(_TOOLS))
     
    12211221src_prefix := TOOL_
    12221222load_function := def_tools_load_function
    1223 $(foreach trg, $(_TOOLS), $(eval $(value def_inherit)))
     1223$(foreach trg, $(_TOOLS), $(evalval def_inherit))
    12241224
    12251225src_prefix := SDK_
    12261226load_function := def_sdk_load_function
    1227 $(foreach trg, $(_SDKS) , $(eval $(value def_inherit)))
     1227$(foreach trg, $(_SDKS) , $(evalval def_inherit))
    12281228
    12291229# done inheriting.
     
    12691269define def_pass1_link_common
    12701270
    1271 bld_type    := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
    1272 bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_$(bld_trg_base_var)))
    1273 bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
    1274 bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_$(bld_trg_base_var)_CPU))
    1275 
    1276 tool        := $(call _TARGET_TOOL,$(target),$(tool_prefix))
    1277 name        := $(firstword\
     1271local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
     1272local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_$(bld_trg_base_var)))
     1273local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
     1274local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_$(bld_trg_base_var)_CPU))
     1275
     1276local tool        := $(call _TARGET_TOOL,$(target),$(tool_prefix))
     1277local name        := $(firstword\
    12781278        $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
    12791279        $($(target)_NAME.$(bld_trg_arch))\
     
    12821282        $($(target)_NAME)\
    12831283        $(target))
    1284 outbase     := $(call TARGET_BASE,$(name),$(target))
     1284local outbase     := $(call TARGET_BASE,$(name),$(target))
    12851285ifndef PATH_$(target)
    12861286 PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
     
    12891289endif
    12901290ifeq ($(tool_prefix),AR) ## @todo fix this mess!
    1291 suff := $(firstword\
     1291local suff := $(firstword\
    12921292        $($(target)_$(EXT)SUFF.$(bld_trg).$(bld_trg_arch))\
    12931293        $($(target)_$(EXT)SUFF.$(bld_trg))\
     
    12981298        $(SUFF_LIB))
    12991299else
    1300 suff := $(firstword \
     1300local suff := $(firstword \
    13011301        $($(target)_$(EXT)SUFF) \
    13021302        $($(target)_$(EXT)SUFF) \
     
    13041304        $($(EXTPRE)SUFF_$(EXT)))
    13051305endif
    1306 out := $(outbase)$(suff)
     1306local out := $(outbase)$(suff)
    13071307
    13081308# TARGET_*
     
    13291329$(target)_NOINST := 1
    13301330endif
    1331 $(eval $(value def_pass1_link_common))
     1331$(evalval def_pass1_link_common)
    13321332endef
    13331333
     
    13381338bld_trg_base_var := PLATFORM
    13391339$(foreach target, $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)), \
    1340         $(eval $(value def_pass1_bldprog)))
     1340        $(evalval def_pass1_bldprog))
    13411341
    13421342
     
    13501350bld_trg_base_var := TARGET
    13511351$(foreach target, $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
    1352         $(eval $(value def_pass1_link_common)))
     1352        $(evalval def_pass1_link_common))
    13531353
    13541354
     
    13621362bld_trg_base_var := TARGET
    13631363$(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
    1364         $(eval $(value def_pass1_link_common)))
     1364        $(evalval def_pass1_link_common))
    13651365
    13661366
     
    13781378 bld_trg_base_var := TARGET
    13791379 $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
    1380         $(eval $(value def_pass1_link_common)))
     1380        $(evalval def_pass1_link_common))
    13811381else
    13821382 EXT     := DLL
     
    13861386 bld_trg_base_var := TARGET
    13871387 $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
    1388         $(eval $(value def_pass1_link_common)))
     1388        $(evalval def_pass1_link_common))
    13891389endif
    13901390
     
    13991399bld_trg_base_var := TARGET
    14001400$(foreach target, $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
    1401         $(eval $(value def_pass1_link_common)))
     1401        $(evalval def_pass1_link_common))
    14021402
    14031403
     
    14111411bld_trg_base_var := TARGET
    14121412$(foreach target, $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
    1413         $(eval $(value def_pass1_link_common)))
     1413        $(evalval def_pass1_link_common))
    14141414
    14151415
     
    14191419#
    14201420define def_pass1_install
    1421 bld_type    := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
    1422 bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_TARGET))
    1423 bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
    1424 bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_TARGET_CPU))
     1421local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
     1422local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_TARGET))
     1423local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
     1424local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_TARGET_CPU))
    14251425# TARGET_*
    14261426TARGET_$(target) := $(PATH_TARGET)/$(target).ins
     
    14281428endef
    14291429$(foreach target, $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
    1430         $(eval $(value def_pass1_install)))
     1430        $(evalval def_pass1_install))
    14311431
    14321432ifdef KBUILD_PROFILE_SELF
     
    15061506$(out) + $($(target)_$(srcname)_FETCH_OUTPUT_) +| $($(target)_$(srcname)_FETCH_OUTPUT_MAYBE_)  : \
    15071507                | $($(target)_$(srcname)_FETCH_DEPORD_)
    1508         $$(call MSG_FETCH_DL,$(target),$(source),$(out))
     1508        %$$(call MSG_FETCH_DL,$(target),$(source),$(out))
    15091509        @## @todo do fancy stuff like download continuation.
    15101510        $$(QUIET)$$(RM) -f $(out)
     
    15161516# Intermediate goal for making sure the md5 and size matches. it will (re) fetch the archive if necessary.
    15171517$(out).checked_$(md5)_$(size): $($(target)_$(srcname)_FETCH_DEPEND_) | $($(target)_$(srcname)_FETCH_DEPORD_)
    1518         $$(call MSG_FETCH_CHK,$(target),$(source),$(out))
     1518        %$$(call MSG_FETCH_CHK,$(target),$(source),$(out))
    15191519        $$(QUIET)$$(RM) -f $$@
    15201520        @# (re)fetch the file if it doesn't exist or if it doesn't matches the md5.
     
    15381538                $($(target)_$(srcname)_UNPACK_DEPEND_) \
    15391539                | $($(target)_$(srcname)_UNPACK_DEPORD_) $(archive).checked_$(md5)_$(size)
    1540         $$(call MSG_FETCH_UP,$(target),$(archive),$(inst))
     1540        %$$(call MSG_FETCH_UP,$(target),$(archive),$(inst))
    15411541        $$(QUIET)$$(RM) -f $(out)
    15421542        @# if the source archive doesn't exist fetch it (can have been deleted to save space).
     
    15611561
    15621562# common
    1563 srcname := $(notdir $(source))
    1564 inst := $(firstword \
     1563local srcname := $(notdir $(source))
     1564local inst := $(firstword \
    15651565        $($(target)_$(source)_INST)\
    15661566        $($(target)_$(srcname)_INST)\
     
    15731573endif
    15741574INSTARGET_$(target)_$(srcname) := $(inst)
    1575 fetchdir := $(firstword \
     1575local fetchdir := $(firstword \
    15761576        $($(target)_$(source)_FETCHDIR)\
    15771577        $($(target)_$(srcname)_FETCHDIR)\
     
    15821582        $(PATH_TARGET)\
    15831583)
    1584 deps := \
     1584local deps := \
    15851585        $($(target)_$(source)_DEPS)\
    15861586        $($(target)_$(srcname)_DEPS)\
     
    15881588        $($(srcname)_DEPS)\
    15891589        $($(target)_DEPS)
    1590 orderdeps := \
     1590local orderdeps := \
    15911591        $($(target)_$(source)_ORDERDEPS)\
    15921592        $($(target)_$(srcname)_ORDERDEPS)\
     
    15941594        $($(srcname)_ORDERDEPS)\
    15951595        $($(target)_ORDERDEPS)
    1596 md5 := $(firstword \
     1596local md5 := $(firstword \
    15971597        $($(target)_$(source)_MD5)\
    15981598        $($(target)_$(srcname)_MD5)\
     
    16011601        $($(target)_MD5)\
    16021602)
    1603 size := $(firstword \
     1603local size := $(firstword \
    16041604        $($(target)_$(source)_SIZE)\
    16051605        $($(target)_$(srcname)_SIZE)\
     
    16081608        $($(target)_SIZE)\
    16091609)
    1610 dep := # not legal for fetch and unpack tools
     1610local dep := # not legal for fetch and unpack tools
    16111611
    16121612
     
    16141614# The fetching.
    16151615#
    1616 out := $(fetchdir)/$(srcname)
    1617 archive := $(out)
     1616local out := $(fetchdir)/$(srcname)
     1617local archive := $(out)
    16181618TARGET_$(target)_$(srcname) := $(out)
    1619 dirdep := $(call DIRDEP,$(fetchdir))
    1620 tool := $(firstword \
     1619local dirdep := $(call DIRDEP,$(fetchdir))
     1620local tool := $(firstword \
    16211621        $($(target)_$(source)_FETCHTOOL)\
    16221622        $($(target)_$(srcname)_FETCHTOOL)\
     
    16301630        $($(target)_TOOL)\
    16311631        )
    1632 flags :=\
     1632local flags :=\
    16331633        $(TOOL_$(tool)_FETCHFLAGS)\
    16341634        $(FETCHFLAGS)\
     
    16701670# The unpacking / installing.
    16711671#
    1672 out := $(inst)_kBuild_$(target)_$(srcname)_unpacked.lst
    1673 dirdep := $(call DIRDEP,$(inst))
    1674 tool := $(firstword \
     1672local out := $(inst)_kBuild_$(target)_$(srcname)_unpacked.lst
     1673local dirdep := $(call DIRDEP,$(inst))
     1674local tool := $(firstword \
    16751675        $($(target)_$(source)_UNPACKTOOL)\
    16761676        $($(target)_$(srcname)_UNPACKTOOL)\
     
    16851685        )
    16861686ifeq ($(tool),)
    1687 tool := $(toupper $(subst .,,$(suffix $(subst tar.,TAR,$(srcname)))))
    1688 $(eval $(value def_tools_include))
    1689 endif
    1690 flags :=\
     1687local tool := $(toupper $(subst .,,$(suffix $(subst tar.,TAR,$(srcname)))))
     1688$(evalval def_tools_include)
     1689endif
     1690local flags :=\
    16911691        $(TOOL_$(tool)_UNPACKFLAGS)\
    16921692        $(UNPACKFLAGS)\
     
    17421742
    17431743$(out).lst: $(_TARGET_$(target)_UNPACKED) | $(call DIRDEP,$(inst))
    1744         $$(call MSG_FETCH_OK,$(target))
     1744        %$$(call MSG_FETCH_OK,$(target))
    17451745        $$(QUIET)$$(RM) -f $$@ $$@.tmp
    17461746        $$(QUIET2)$$(APPEND) $$@.tmp '$(notdir $(out))'
     
    17491749
    17501750$(out)_unfetched:
    1751         $$(call MSG_UNFETCH,$(target))
     1751        %$$(call MSG_UNFETCH,$(target))
    17521752        $$(QUIET)$$(RM) -f $$(addprefix $(inst),$$(shell $$(CAT_EXT) $(out).lst 2> /dev/null | $$(SED) -e '/\/$$$$/d'))
    17531753        $$(QUIET)$$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist $$(dir $$@) \
     
    17581758$(out): $(comp-vars _TARGET_$(target)_DIGEST_PREV,_TARGET_$(target)_DIGEST,FORCE) | $(call DIRDEP,$(inst))
    17591759        $$(QUIET)$$(RM) -f $$@
    1760         $$(if $$(_TARGET_$(target)_DIGEST),$$(if $$(wildcard $(out).lst)\
     1760        %$$(if $$(_TARGET_$(target)_DIGEST),$$(if $$(wildcard $(out).lst)\
    17611761                ,$$(call MSG_REFETCH,$(target)),$$(call MSG_FETCH,$(target))),$$(call MSG_UNFETCH,$(target)))
    17621762        $$(QUIET)$$(if $$(wildcard $(out).lst      ),$$(MAKE) -f $(MAKEFILE) --no-print-directory $(out)_unfetched)
     
    17881788#$ (warning dbg fetch: target=$(target) sources=$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TYPE)) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_TARGET_ARCH)) $($(target)_SOURCES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)))
    17891789$(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TYPE)) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_TARGET_ARCH)) $($(target)_SOURCES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),\
    1790         $(eval $(value def_fetch_src)))
     1790        $(evalval def_fetch_src))
    17911791
    17921792# The target.
    1793 inst := $(INSTARGET_$(target))
    1794 out := $(inst)_kBuild_fetch_$(target)
     1793local inst := $(INSTARGET_$(target))
     1794local out := $(inst)_kBuild_fetch_$(target)
    17951795
    17961796$(eval includedep $(out))
     
    18141814bld_trg_arch := $(BUILD_TARGET_ARCH)
    18151815$(foreach target, $(FETCHES) $(FETCHES.$(BUILD_TARGET)) $(FETCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
    1816         $(eval $(value def_fetch)))
     1816        $(evalval def_fetch))
    18171817
    18181818# some aliases.
     
    18441844#
    18451845#$(foreach source,$($(target)_SOURCES) $($(target)_SOURCES.$(BUILD_TYPE)) $($(target)_SOURCES.$(BUILD_TARGET)) $($(target)_SOURCES.$(BUILD_TARGET_ARCH)) $($(target)_SOURCES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)),\
    1846 #       $(eval $(value def_patch_src)))
     1846#       $(evalval def_patch_src))
    18471847#
    18481848#_PATCHES +=
     
    18501850#
    18511851#$(foreach target, $(PATCHES) $(PATCHES.$(BUILD_TARGET)) $(PATCHES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
    1852 #       $(eval $(value def_patch)))
     1852#       $(evalval def_patch))
    18531853#
    18541854
     
    18601860## wrapper the compile command dependency check.
    18611861ifndef NO_COMPILE_CMDS_DEPS
    1862  _DEP_COMPILE_CMDS = $(comp-cmds $(target)_$(source)_CMDS_PREV_,$(target)_$(source)_CMDS_,FORCE)
     1862 _DEP_COMPILE_CMDS = $$(comp-cmds-ex $$($(target)_$(source)_CMDS_PREV_),$$(commands $(obj)),FORCE)
    18631863else
    18641864 _DEP_COMPILE_CMDS =
     
    18771877                $($(target)_$(source)_DEPORD_) \
    18781878                $$($(target)_INTERMEDIATES)
    1879         $$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
     1879        %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
    18801880else
    18811881$(obj) + $($(target)_$(source)_OUTPUT_) +| $($(target)_$(source)_OUTPUT_MAYBE_) : \
     
    18851885                $($(target)_$(source)_DEPORD_) \
    18861886                $$($(target)_INTERMEDIATES)
    1887         $$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
     1887        %$$(call MSG_COMPILE,$(target),$(source),$$@,$(type))
    18881888ifdef TOOL_$(tool)_COMPILE_$(type)_DONT_PURGE_OUTPUT
    18891889        $$(QUIET)$$(RM) -f $(dep) $(obj) $($(target)_$(source)_OUTPUT_) $($(target)_OUTPUT_MAYBE_)
     
    18941894
    18951895ifndef NO_COMPILE_CMDS_DEPS
    1896         $$(QUIET2)$$(APPEND) '$(dep)'
    1897         $$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(source)_CMDS_PREV_'
    1898         $$(QUIET2)$$(APPEND) -v '$(dep)' '$(target)_$(source)_CMDS_'
    1899         $$(QUIET2)$$(APPEND) '$(dep)' 'endef'
     1896        %$$(QUIET2)$$(APPEND) '$(dep)'
     1897        %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(source)_CMDS_PREV_'
     1898        %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(obj)'
     1899        %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
    19001900endif
    19011901
    19021902$(basename $(notdir $(obj))).o: $(obj)
    19031903$(basename $(notdir $(obj))).obj: $(obj)
     1904
     1905## @todo make this 'local cmds' in 0.2.x or when a new kb-src-one is added.
     1906$(target)_$(source)_CMDS_ :=
    19041907endef
    19051908
     
    19071910## wrapper the link command dependency check.
    19081911ifndef NO_COMPILE_CMDS_DEPS
    1909  _DEP_LINK_CMDS = $(comp-cmds $(target)_CMDS_PREV_,$(target)_CMDS_,FORCE)
     1912 _DEP_LINK_CMDS = $$(comp-cmds-ex $$($(target)_CMDS_PREV_),$$(commands $(out)),FORCE)
    19101913else
    19111914 _DEP_LINK_CMDS =
     
    19191922# @param    $($(target)_OUTPUT_)    Output files from the link.
    19201923# @param    $($(target)_OUTPUT_MAYBE_)  Output files that the link may perhaps create.
    1921 # @param    $($(target)_DEPEND_)        Dependencies.
     1924# @param    $($(target)_DEPEND_)    Dependencies.
    19221925# @param    $($(target)_DEPORD_)    Dependencies which should only affect build order.
    1923 # @param    $($(target)_CMDS_)      The link commands.
     1926# @param    $(cmds)                 The link commands.
    19241927# @param    $($(target)_CMDS_PREV_) The link commands from the previous run.
    19251928define def_link_rule
     
    19291932                | \
    19301933                $($(target)_DEPORD_)
    1931         $$(call MSG_LINK,$(target),$$@,$(tool_do))
     1934        %$$(call MSG_LINK,$(target),$$@,$(tool_do))
    19321935        $$(QUIET)$$(RM) -f $(dep) $(out) $($(target)_OUTPUT_) $($(target)_OUTPUT_MAYBE_)
    19331936
    1934 $($(target)_CMDS_)
     1937$(cmds)
    19351938
    19361939ifndef NO_LINK_CMDS_DEPS
    1937         $$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_CMDS_PREV_'
    1938         $$(QUIET2)$$(APPEND) -v '$(dep)' '$(target)_CMDS_'
    1939         $$(QUIET2)$$(APPEND) '$(dep)' 'endef'
     1940        %$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_CMDS_PREV_'
     1941        %$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
     1942        %$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
    19401943endif
    19411944
     
    19521955define def_link_install_rule
    19531956$(INSTARGET_$(target)) : $(out) | $(call DIRDEP,$(dir $(INSTARGET_$(target))))
    1954         $$(call MSG_INST_TRG,$(target),$(out),$$@)
     1957        %$$(call MSG_INST_TRG,$(target),$(out),$$@)
    19551958        $$(QUIET)$$(INSTALL) $$(if $(mode),-m $(mode)) $(out) $$@
    19561959
     
    19651968# @{
    19661969define def_src_handler_c
    1967 type := C
     1970local type := C
    19681971 $(kb-src-one )
    19691972endef
    19701973
    19711974define def_src_handler_cxx
    1972 type := CXX
     1975local type := CXX
    19731976 $(kb-src-one )
    19741977endef
    19751978
    19761979define def_src_handler_objc
    1977 type := OBJC
     1980local type := OBJC
    19781981 $(kb-src-one )
    19791982endef
    19801983
    19811984define def_src_handler_asm
    1982 type := AS
     1985local type := AS
    19831986 $(kb-src-one )
    19841987endef
    19851988
    19861989define def_src_handler_rc
    1987 type := RC
     1990local type := RC
    19881991 $(kb-src-one )
    19891992endef
     
    20012004# .
    20022005define def_src_handler_one
    2003 suff := $(suffix $(source))
    2004 src_handler := $(firstword $(filter $(suff):%, $($(target)_$(source)_SRC_HANDLERS) $($(source)_SRC_HANDLERS) $(target_src_handlers) ))
    2005 handler := $(patsubst $(suff):%,%,$(src_handler))
     2006local suff := $(suffix $(source))
     2007local src_handler := $(firstword $(filter $(suff):%, $($(target)_$(source)_SRC_HANDLERS) $($(source)_SRC_HANDLERS) $(target_src_handlers) ))
     2008local handler := $(patsubst $(suff):%,%,$(src_handler))
    20062009#$ (warning def_src_handler_one: source=$(source) suff=$(suff) src_handler=$(src_handler) handler=$(handler))
    20072010ifneq ($(handler),)
    2008  $(eval $(value $(handler)))
     2011 $(evalval $(handler))
    20092012else
    20102013 othersrc += $(source)
     
    20182021# @returns  othersrc, $(target)_OBJS_, ++
    20192022define def_target_sources
    2020 target_src_handlers := $($(target)_SRC_HANDLERS) $(KBUILD_SRC_HANDLERS)
     2023local target_src_handlers := $($(target)_SRC_HANDLERS) $(KBUILD_SRC_HANDLERS)
    20212024$(foreach source,\
    20222025        $($(target)_SOURCES)\
     
    20262029        $($(target)_SOURCES.$(bld_trg_cpu))\
    20272030        $($(target)_SOURCES.$(bld_type))\
    2028         ,$(eval $(value def_src_handler_one)) )
     2031        ,$(evalval def_src_handler_one) )
    20292032endef
    20302033
     
    20752078# library basics
    20762079## @todo prefix
    2077 bld_type    := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
    2078 bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_TARGET))
    2079 bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
    2080 bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_TARGET_CPU))
    2081 tool        := $(call _TARGET_TOOL,$(target),AR)
     2080local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
     2081local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_TARGET))
     2082local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
     2083local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_TARGET_CPU))
     2084local tool        := $(call _TARGET_TOOL,$(target),AR)
    20822085ifeq ($(tool),)
    20832086$(error kBuild: Library target $(target) does not have a tool defined!)
    20842087endif
    2085 name        := $(firstword\
     2088local name        := $(firstword\
    20862089        $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
    20872090        $($(target)_NAME.$(bld_trg_arch))\
     
    20902093        $($(target)_NAME)\
    20912094        $(target))
    2092 outbase     := $(call TARGET_BASE,$(name),$(target))
     2095local outbase     := $(call TARGET_BASE,$(name),$(target))
    20932096ifndef PATH_$(target)
    2094  PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
     2097 PATH_$(target)   := $(patsubst %/,%,$(dir $(outbase)))
    20952098else
    20962099 ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
     
    20982101 endif
    20992102endif
    2100 suff        := $(firstword\
     2103local suff        := $(firstword\
    21012104        $($(target)_LIBSUFF.$(bld_trg).$(bld_trg_arch))\
    21022105        $($(target)_LIBSUFF.$(bld_trg))\
     
    21062109        $(TOOL_$(tool)_ARLIBSUFF)\
    21072110        $(SUFF_LIB))
    2108 out         := $(outbase)$(suff)
    2109 TARGET_$(target) := $(out)
    2110 $(target)_OBJS_ :=
    2111 defpath := $($(target)_PATH)
    2112 othersrc :=
     2111local out         := $(outbase)$(suff)
     2112local defpath     := $($(target)_PATH)
     2113TARGET_$(target)  := $(out)
     2114# no local here - must be writable across some foreachs.
     2115othersrc          :=
     2116$(target)_OBJS_   :=
    21132117
    21142118# source -> object
    2115 $(eval $(value def_target_sources))
     2119$(evalval def_target_sources)
    21162120
    21172121# library linking
    2118 tool        := $(call _TARGET_TOOL,$(target),AR)
    2119 name        := $(firstword\
     2122local tool        := $(call _TARGET_TOOL,$(target),AR)
     2123local name        := $(firstword\
    21202124        $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
    21212125        $($(target)_NAME.$(bld_trg_arch))\
     
    21242128        $($(target)_NAME)\
    21252129        $(target))
    2126 outbase     := $(call TARGET_BASE,$(name),$(target))
    2127 flags       :=\
     2130local outbase     := $(call TARGET_BASE,$(name),$(target))
     2131local flags       :=\
    21282132        $(TOOL_$(tool)_ARFLAGS)\
    21292133        $(TOOL_$(tool)_ARFLAGS.$(bld_type))\
     
    21362140        $($(target)_ARFLAGS.$(bld_trg).$(bld_trg_arch)) \
    21372141        $($(target)_ARFLAGS.$(bld_trg_cpu))
    2138 dirdep      := $(call DIRDEP,$(dir $(out)))
    2139 deps        := $($(target)_DEPS)
    2140 orderdeps   := $($(target)_ORDERDEPS)
     2142local dirdep      := $(call DIRDEP,$(dir $(out)))
     2143local deps        := $($(target)_DEPS)
     2144local orderdeps   := $($(target)_ORDERDEPS)
    21412145
    21422146# Adjust paths if we got a default path.
    21432147ifneq ($(defpath),)
    2144  $(target)_OBJS_ := $(abspathex $($(target)_OBJS_),$(defpath))
    2145  deps := $(abspathex $(deps),$(defpath))
    2146  orderdeps := $(abspathex $(orderdeps),$(defpath))
     2148 $(target)_OBJS_  := $(abspathex $($(target)_OBJS_),$(defpath))
     2149 local deps      := $(abspathex $(deps),$(defpath))
     2150 local orderdeps := $(abspathex $(orderdeps),$(defpath))
    21472151 othersrc := $(abspathex $(othersrc),$(defpath))
    21482152endif
     
    21512155# Custom pre-link actions.
    21522156ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2153  pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
     2157 local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    21542158else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch)
    2155  pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch))
     2159 local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch))
    21562160else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_type)
    2157  pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_type))
     2161 local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_type))
    21582162else ifdef $(target)_PRE_CMDS.$(bld_trg_arch)
    2159  pre_cmds := $($(target)_PRE_CMDS.$(bld_trg_arch))
     2163 local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg_arch))
    21602164else ifdef $(target)_PRE_CMDS.$(bld_trg)
    2161  pre_cmds := $($(target)_PRE_CMDS.$(bld_trg))
     2165 local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg))
    21622166else ifdef $(target)_PRE_CMDS.$(bld_type)
    2163  pre_cmds := $($(target)_PRE_CMDS.$(bld_type))
     2167 local pre_cmds := $($(target)_PRE_CMDS.$(bld_type))
    21642168else ifdef $(target)_PRE_CMDS
    2165  pre_cmds := $($(target)_PRE_CMDS)
     2169 local pre_cmds := $($(target)_PRE_CMDS)
    21662170else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2167  pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
     2171 local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    21682172else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch)
    2169  pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch))
     2173 local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch))
    21702174else ifdef PRE_CMDS.$(bld_trg).$(bld_type)
    2171  pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_type))
     2175 local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_type))
    21722176else ifdef PRE_CMDS.$(bld_trg_arch)
    2173  pre_cmds := $(PRE_CMDS.$(bld_trg_arch))
     2177 local pre_cmds := $(PRE_CMDS.$(bld_trg_arch))
    21742178else ifdef PRE_CMDS.$(bld_trg)
    2175  pre_cmds := $(PRE_CMDS.$(bld_trg))
     2179 local pre_cmds := $(PRE_CMDS.$(bld_trg))
    21762180else ifdef PRE_CMDS.$(bld_type)
    2177  pre_cmds := $(PRE_CMDS.$(bld_type))
     2181 local pre_cmds := $(PRE_CMDS.$(bld_type))
    21782182else
    2179  pre_cmds := $(PRE_CMDS)
     2183 local pre_cmds := $(PRE_CMDS)
    21802184endif
    21812185
    21822186# Custom post-link actions.
    21832187ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2184  post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
     2188 local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    21852189else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch)
    2186  post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch))
     2190 local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch))
    21872191else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_type)
    2188  post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_type))
     2192 local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_type))
    21892193else ifdef $(target)_POST_CMDS.$(bld_trg_arch)
    2190  post_cmds := $($(target)_POST_CMDS.$(bld_trg_arch))
     2194 local post_cmds := $($(target)_POST_CMDS.$(bld_trg_arch))
    21912195else ifdef $(target)_POST_CMDS.$(bld_trg)
    2192  post_cmds := $($(target)_POST_CMDS.$(bld_trg))
     2196 local post_cmds := $($(target)_POST_CMDS.$(bld_trg))
    21932197else ifdef $(target)_POST_CMDS.$(bld_type)
    2194  post_cmds := $($(target)_POST_CMDS.$(bld_type))
     2198 local post_cmds := $($(target)_POST_CMDS.$(bld_type))
    21952199else ifdef $(target)_POST_CMDS
    2196  post_cmds := $($(target)_POST_CMDS)
     2200 local post_cmds := $($(target)_POST_CMDS)
    21972201else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2198  post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
     2202 local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    21992203else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch)
    2200  post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch))
     2204 local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch))
    22012205else ifdef POST_CMDS.$(bld_trg).$(bld_type)
    2202  post_cmds := $(POST_CMDS.$(bld_trg).$(bld_type))
     2206 local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_type))
    22032207else ifdef POST_CMDS.$(bld_trg_arch)
    2204  post_cmds := $(POST_CMDS.$(bld_trg_arch))
     2208 local post_cmds := $(POST_CMDS.$(bld_trg_arch))
    22052209else ifdef POST_CMDS.$(bld_trg)
    2206  post_cmds := $(POST_CMDS.$(bld_trg))
     2210 local post_cmds := $(POST_CMDS.$(bld_trg))
    22072211else ifdef POST_CMDS.$(bld_type)
    2208  post_cmds := $(POST_CMDS.$(bld_type))
     2212 local post_cmds := $(POST_CMDS.$(bld_type))
    22092213else
    2210  post_cmds := $(POST_CMDS)
     2214 local post_cmds := $(POST_CMDS)
    22112215endif
    22122216
    22132217# eliminate this guy?
    2214 objs = $($(target)_OBJS_)
     2218local objs = $($(target)_OBJS_)
    22152219
    22162220# dependency file
    2217 dep := $(out)$(SUFF_DEP)
     2221local dep := $(out)$(SUFF_DEP)
    22182222ifndef NO_LINK_CMDS_DEPS
    22192223 _DEPFILES_INCLUDED += $(dep)
     
    22402244
    22412245# call the tool
    2242 $(target)_CMDS_  := $(TOOL_$(tool)_LINK_LIBRARY_CMDS)
     2246local cmds := $(TOOL_$(tool)_LINK_LIBRARY_CMDS)
    22432247ifneq ($(pre_cmds),)
    2244  $(target)_CMDS_  := $(TAB)$(pre_cmds)$(NL)$(TAB)$($(target)_CMDS_)
     2248 local cmds := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
    22452249endif
    22462250ifneq ($(post_cmds),)
    2247  $(target)_CMDS_  := $($(target)_CMDS_)$(NL)$(TAB)$(post_cmds)
     2251 local cmds  := $(cmds)$(NL)$(TAB)$(post_cmds)
    22482252endif
    22492253$(target)_OUTPUT_ := $(TOOL_$(tool)_LINK_LIBRARY_OUTPUT)
     
    22562260
    22572261# installing and globals
    2258 $(eval $(value def_target_install_pluss))
     2262$(evalval def_target_install_pluss)
    22592263endef
    22602264
     
    22642268tool_do := LINK_LIBRARY
    22652269mode := 0644
    2266 $(foreach target, $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_lib)))
     2270$(foreach target, $(LIBRARIES) $(LIBRARIES.$(BUILD_TARGET)) $(LIBRARIES.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(evalval def_lib))
    22672271
    22682272ifdef KBUILD_PROFILE_SELF
     
    22872291define def_link_common
    22882292# basics
    2289 bld_type    := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
    2290 bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_$(bld_trg_base_var)))
    2291 bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
    2292 bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_$(bld_trg_base_var)_CPU))
    2293 
    2294 tool        := $(call _TARGET_TOOL,$(target),LD)
    2295 name        := $(firstword\
     2293local bld_type    := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
     2294local bld_trg     := $(firstword $($(target)_BLD_TRG)      $(BUILD_$(bld_trg_base_var)))
     2295local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_$(bld_trg_base_var)_ARCH))
     2296local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_$(bld_trg_base_var)_CPU))
     2297
     2298local tool        := $(call _TARGET_TOOL,$(target),LD)
     2299local name        := $(firstword\
    22962300        $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
    22972301        $($(target)_NAME.$(bld_trg_arch))\
     
    23002304        $($(target)_NAME)\
    23012305        $(target))
    2302 outbase     := $(call TARGET_BASE,$(name),$(target))
     2306local outbase     := $(call TARGET_BASE,$(name),$(target))
    23032307ifndef PATH_$(target)
    2304  PATH_$(target) := $(patsubst %/,%,$(dir $(outbase)))
     2308 PATH_$(target)   := $(patsubst %/,%,$(dir $(outbase)))
    23052309else
    23062310 ifneq ($(PATH_$(target)),$(patsubst %/,%,$(dir $(outbase))))
     
    23082312 endif
    23092313endif
    2310 suff        := $(firstword \
     2314local suff        := $(firstword \
    23112315        $($(target)_$(EXT)SUFF) \
    23122316        $($(target)_$(EXT)SUFF) \
    23132317        $(TOOL_$(tool)_LD$(EXT)SUFF) \
    23142318        $($(EXTPRE)SUFF_$(EXT)))
    2315 out         := $(outbase)$(suff)
    2316 TARGET_$(target) := $(out)
    2317 $(target)_OBJS_  :=
    2318 defpath := $($(target)_PATH)
    2319 othersrc :=
     2319local out         := $(outbase)$(suff)
     2320TARGET_$(target)  := $(out)
     2321local defpath     := $($(target)_PATH)
     2322# no local here - must be writable across some foreachs.
     2323othersrc          :=
     2324$(target)_OBJS_   :=
    23202325
    23212326# source -> object
    2322 $(eval $(value def_target_sources))
     2327$(evalval def_target_sources)
    23232328
    23242329# more link stuff.
    2325 tool        := $(call _TARGET_TOOL,$(target),LD)
    2326 name        := $(firstword\
     2330local tool        := $(call _TARGET_TOOL,$(target),LD)
     2331local name        := $(firstword\
    23272332        $($(target)_NAME.$(bld_trg).$(bld_trg_arch))\
    23282333        $($(target)_NAME.$(bld_trg_arch))\
     
    23312336        $($(target)_NAME)\
    23322337        $(target))
    2333 outbase     := $(call TARGET_BASE,$(name),$(target))
    2334 flags       :=\
     2338local outbase     := $(call TARGET_BASE,$(name),$(target))
     2339local flags       :=\
    23352340        $(TOOL_$(tool)_LDFLAGS)\
    23362341        $(TOOL_$(tool)_LDFLAGS.$(bld_type))\
     
    23732378        $($(target)_LDFLAGS.$(bld_trg).$(bld_trg_arch))\
    23742379        $($(target)_LDFLAGS.$(bld_trg_cpu))
    2375 libs        :=\
     2380local libs        :=\
    23762381        $($(target)_LIBS.$(bld_trg_cpu))\
    23772382        $($(target)_LIBS.$(bld_trg).$(bld_trg_arch))\
     
    24142419        $(TOOL_$(tool)_LIBS.$(bld_type))\
    24152420        $(TOOL_$(tool)_LIBS)
    2416 libpath    :=\
     2421local libpath    :=\
    24172422        $($(target)_LIBPATH.$(bld_trg_cpu))\
    24182423        $($(target)_LIBPATH.$(bld_trg).$(bld_trg_arch))\
     
    24552460        $(TOOL_$(tool)_LIBPATH.$(bld_type))\
    24562461        $(TOOL_$(tool)_LIBPATH)
    2457 dirdep      := $(call DIRDEP,$(dir $(out)))
    2458 deps        := $($(target)_DEPS)
    2459 orderdeps   := $($(target)_ORDERDEPS)
     2462local dirdep      := $(call DIRDEP,$(dir $(out)))
     2463local deps        := $($(target)_DEPS)
     2464local orderdeps   := $($(target)_ORDERDEPS)
    24602465
    24612466# Adjust paths if we got a default path.
    24622467ifneq ($(defpath),)
    2463  libpath := $(abspathex $(libpath),$(defpath))
    2464  $(target)_OBJS_ := $(abspathex $($(target)_OBJS_),$(defpath))
    2465  deps := $(abspathex $(deps),$(defpath))
    2466  orderdeps := $(abspathex $(orderdeps),$(defpath))
     2468 local libpath    := $(abspathex $(libpath),$(defpath))
     2469 $(target)_OBJS_  := $(abspathex $($(target)_OBJS_),$(defpath))
     2470 local deps      := $(abspathex $(deps),$(defpath))
     2471 local orderdeps := $(abspathex $(orderdeps),$(defpath))
    24672472 othersrc := $(abspathex $(othersrc),$(defpath))
    24682473 # libs are not subject to this because of the the -l<lib> stuff. Use $(<target>_PATH)/lib if relative to current dir!
     
    24712476# Custom pre-link actions.
    24722477ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2473  pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
     2478 local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    24742479else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch)
    2475  pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch))
     2480 local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch))
    24762481else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_type)
    2477  pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_type))
     2482 local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_type))
    24782483else ifdef $(target)_PRE_CMDS.$(bld_trg_arch)
    2479  pre_cmds := $($(target)_PRE_CMDS.$(bld_trg_arch))
     2484 local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg_arch))
    24802485else ifdef $(target)_PRE_CMDS.$(bld_trg)
    2481  pre_cmds := $($(target)_PRE_CMDS.$(bld_trg))
     2486 local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg))
    24822487else ifdef $(target)_PRE_CMDS.$(bld_type)
    2483  pre_cmds := $($(target)_PRE_CMDS.$(bld_type))
     2488 local pre_cmds := $($(target)_PRE_CMDS.$(bld_type))
    24842489else ifdef $(target)_PRE_CMDS
    2485  pre_cmds := $($(target)_PRE_CMDS)
     2490 local pre_cmds := $($(target)_PRE_CMDS)
    24862491else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2487  pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
     2492 local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    24882493else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch)
    2489  pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch))
     2494 local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch))
    24902495else ifdef PRE_CMDS.$(bld_trg).$(bld_type)
    2491  pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_type))
     2496 local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_type))
    24922497else ifdef PRE_CMDS.$(bld_trg_arch)
    2493  pre_cmds := $(PRE_CMDS.$(bld_trg_arch))
     2498 local pre_cmds := $(PRE_CMDS.$(bld_trg_arch))
    24942499else ifdef PRE_CMDS.$(bld_trg)
    2495  pre_cmds := $(PRE_CMDS.$(bld_trg))
     2500 local pre_cmds := $(PRE_CMDS.$(bld_trg))
    24962501else ifdef PRE_CMDS.$(bld_type)
    2497  pre_cmds := $(PRE_CMDS.$(bld_type))
     2502 local pre_cmds := $(PRE_CMDS.$(bld_type))
    24982503else
    2499  pre_cmds := $(PRE_CMDS)
     2504 local pre_cmds := $(PRE_CMDS)
    25002505endif
    25012506
    25022507# Custom post-link actions.
    25032508ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2504  post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
     2509 local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    25052510else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch)
    2506  post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch))
     2511 local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch))
    25072512else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_type)
    2508  post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_type))
     2513 local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_type))
    25092514else ifdef $(target)_POST_CMDS.$(bld_trg_arch)
    2510  post_cmds := $($(target)_POST_CMDS.$(bld_trg_arch))
     2515 local post_cmds := $($(target)_POST_CMDS.$(bld_trg_arch))
    25112516else ifdef $(target)_POST_CMDS.$(bld_trg)
    2512  post_cmds := $($(target)_POST_CMDS.$(bld_trg))
     2517 local post_cmds := $($(target)_POST_CMDS.$(bld_trg))
    25132518else ifdef $(target)_POST_CMDS.$(bld_type)
    2514  post_cmds := $($(target)_POST_CMDS.$(bld_type))
     2519 local post_cmds := $($(target)_POST_CMDS.$(bld_type))
    25152520else ifdef $(target)_POST_CMDS
    2516  post_cmds := $($(target)_POST_CMDS)
     2521 local post_cmds := $($(target)_POST_CMDS)
    25172522else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2518  post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
     2523 local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    25192524else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch)
    2520  post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch))
     2525 local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch))
    25212526else ifdef POST_CMDS.$(bld_trg).$(bld_type)
    2522  post_cmds := $(POST_CMDS.$(bld_trg).$(bld_type))
     2527 local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_type))
    25232528else ifdef POST_CMDS.$(bld_trg_arch)
    2524  post_cmds := $(POST_CMDS.$(bld_trg_arch))
     2529 local post_cmds := $(POST_CMDS.$(bld_trg_arch))
    25252530else ifdef POST_CMDS.$(bld_trg)
    2526  post_cmds := $(POST_CMDS.$(bld_trg))
     2531 local post_cmds := $(POST_CMDS.$(bld_trg))
    25272532else ifdef POST_CMDS.$(bld_type)
    2528  post_cmds := $(POST_CMDS.$(bld_type))
     2533 local post_cmds := $(POST_CMDS.$(bld_type))
    25292534else
    2530  post_cmds := $(POST_CMDS)
     2535 local post_cmds := $(POST_CMDS)
    25312536endif
    25322537
    25332538# eliminate this guy?
    2534 objs = $($(target)_OBJS_)
     2539local objs = $($(target)_OBJS_)
    25352540
    25362541# installation targets
     
    25522557
    25532558# dependency file
    2554 dep := $(outbase)$(SUFF_DEP)
     2559local dep := $(outbase)$(SUFF_DEP)
    25552560ifndef NO_LINK_CMDS_DEPS
    25562561 _DEPFILES_INCLUDED += $(dep)
     
    25772582
    25782583# call the tool
    2579 $(target)_CMDS_   := $(TOOL_$(tool)_$(tool_do)_CMDS)
     2584local cmds   := $(TOOL_$(tool)_$(tool_do)_CMDS)
    25802585ifneq ($(pre_cmds),)
    2581  $(target)_CMDS_  := $(TAB)$(pre_cmds)$(NL)$(TAB)$($(target)_CMDS_)
     2586 local cmds  := $(TAB)$(pre_cmds)$(NL)$(TAB)$(cmds)
    25822587endif
    25832588ifneq ($(post_cmds),)
    2584  $(target)_CMDS_  := $($(target)_CMDS_)$(NL)$(TAB)$(post_cmds)
     2589 local cmds  := $(cmds)$(NL)$(TAB)$(post_cmds)
    25852590endif
    25862591$(target)_OUTPUT_ := $(TOOL_$(tool)_$(tool_do)_OUTPUT)
     
    26172622
    26182623# do the usual stuff.
    2619 $(eval $(value def_link_common))
     2624$(evalval def_link_common)
    26202625
    26212626endef
     
    26292634mode    := 0755
    26302635bld_trg_base_var := PLATFORM
    2631 $(foreach target, $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)), $(eval $(value def_bldprog)))
     2636$(foreach target, $(BLDPROGS) $(BLDPROGS.$(BUILD_PLATFORM)) $(BLDPROGS.$(BUILD_PLATFORM).$(BUILD_PLATFORM_ARCH)), $(evalval def_bldprog))
    26322637
    26332638ifdef KBUILD_PROFILE_SELF
     
    26512656mode    := 0644
    26522657bld_trg_base_var := TARGET
    2653 $(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_link_common)))
     2658$(foreach target, $(DLLS) $(DLLS.$(BUILD_TARGET)) $(DLLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(evalval def_link_common))
    26542659
    26552660ifdef KBUILD_PROFILE_SELF
     
    26752680 tool_do := LINK_LIBRARY
    26762681 definst := $(PATH_LIB)
    2677  $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_lib)))
     2682 $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(evalval def_lib))
    26782683else
    26792684 EXT     := DLL
    26802685 tool_do := LINK_DLL
    26812686 definst := $(PATH_DLL)
    2682  $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_link_common)))
     2687 $(foreach target, $(IMPORT_LIBS) $(IMPORT_LIBS.$(BUILD_TARGET)) $(IMPORT_LIBS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(evalval def_link_common))
    26832688endif
    26842689
     
    27032708mode    := 0755
    27042709bld_trg_base_var := TARGET
    2705 $(foreach target, $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_link_common)))
     2710$(foreach target, $(PROGRAMS) $(PROGRAMS.$(BUILD_TARGET)) $(PROGRAMS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(evalval def_link_common))
    27062711
    27072712ifdef KBUILD_PROFILE_SELF
     
    27252730mode    := 0644
    27262731bld_trg_base_var := TARGET
    2727 $(foreach target, $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(eval $(value def_link_common)))
     2732$(foreach target, $(SYSMODS) $(SYSMODS.$(BUILD_TARGET)) $(SYSMODS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), $(evalval def_link_common))
    27282733
    27292734ifdef KBUILD_PROFILE_SELF
     
    27492754# the install rule
    27502755$(insdst) : $(srcsrc) | $(call DIRDEP,$(dir $(insdst)))
    2751         $$(call MSG_INST_FILE,$(srcsrc),$(insdst))
     2756        %$$(call MSG_INST_FILE,$(srcsrc),$(insdst))
    27522757        $$(QUIET)$(inscmd)
    27532758endef
     
    27572762
    27582763# deal with '=>' in the source file name.
    2759 srcdst := $(subst =>, ,$(src))
    2760 srcsrc := $(firstword $(srcdst))
    2761 srcdstdir := $(dir $(word 2,$(srcdst)))
    2762 srcdst := $(word $(words $(srcdst)),$(srcdst))
     2764local srcdst := $(subst =>, ,$(src))
     2765local srcsrc := $(firstword $(srcdst))
     2766local srcdstdir := $(dir $(word 2,$(srcdst)))
     2767local srcdst := $(word $(words $(srcdst)),$(srcdst))
    27632768
    27642769# _INSTFUN
    27652770ifdef $(srcsrc)_INSTFUN
    2766  instfun := $(srcsrc)_INSTFUN
     2771 local instfun := $(srcsrc)_INSTFUN
    27672772else ifdef $(target)_INSTFUN
    2768  instfun := $(target)_INSTFUN
     2773 local instfun := $(target)_INSTFUN
    27692774else
    2770  instfun := _INSTALL_FILE
     2775 local instfun := _INSTALL_FILE
    27712776endif
    27722777
    27732778# _INST
    27742779ifdef $(srcsrc)_INST
    2775  inst := $(patsubst %/,%,$($(srcsrc)_INST))/$(dir $(srcdstdir))
     2780 local inst := $(patsubst %/,%,$($(srcsrc)_INST))/$(dir $(srcdstdir))
    27762781else ifdef $(target)_INST
    2777  inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(srcdstdir))
     2782 local inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(srcdstdir))
    27782783else
    2779  inst := $(dir $(srcdstdir))
     2784 local inst := $(dir $(srcdstdir))
    27802785endif
    27812786
    27822787# calc target
    2783 insdst := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS))
     2788local insdst := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS))
    27842789#$(warning instfun=$(instfun) srcdst=$(srcdst) target=$(target) inst=$(inst) => insdst=$(insdst))
    27852790
    27862791# mode, uid and gid
    2787 mode := $(firstword \
     2792local mode := $(firstword \
    27882793        $($(target)_$(srcsrc)_MODE.$(bld_trg).$(bld_trg_arch)) \
    27892794        $($(target)_$(srcsrc)_MODE.$(bld_trg)) \
     
    28012806        $($(target)_MODE.$(bld_trg)) \
    28022807        $($(target)_MODE))
    2803 uid := $(firstword \
     2808local uid := $(firstword \
    28042809        $($(target)_$(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
    28052810        $($(target)_$(srcsrc)_UID.$(bld_trg)) \
     
    28172822        $($(target)_UID.$(bld_trg)) \
    28182823        $($(target)_UID))
    2819 gid := $(firstword \
     2824local gid := $(firstword \
    28202825        $($(target)_$(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
    28212826        $($(target)_$(srcsrc)_GID.$(bld_trg)) \
     
    28332838        $($(target)_GID.$(bld_trg)) \
    28342839        $($(target)_GID))
    2835 flags := \
     2840local flags := \
    28362841        $($(target)_IFFLAGS) \
    28372842        $($(target)_IFFLAGS.$(bld_trg)) \
     
    28532858# Adjust the source if we got a default PATH. (This must be done this late!)
    28542859ifdef $(target)_PATH
    2855  srcsrc := $(abspathex $(srcsrc),$($(target)_PATH))
     2860 local srcsrc := $(abspathex $(srcsrc),$($(target)_PATH))
    28562861endif
    28572862
    28582863# create the command
    28592864ifdef $(srcsrc)_INSTALLER
    2860  inscmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(insdst),$(target),$(flags))
     2865 local inscmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(insdst),$(target),$(flags))
    28612866else ifdef $(target)_INSTALLER
    2862  inscmd := $(call $(target)_INSTALLER,$(srcsrc),$(insdst),$(target),$(flags))
     2867 local inscmd := $(call $(target)_INSTALLER,$(srcsrc),$(insdst),$(target),$(flags))
    28632868else
    2864  inscmd := $$(INSTALL)\
     2869 local inscmd := $$(INSTALL)\
    28652870                $(if $(uid),-o $(uid))\
    28662871                $(if $(gid),-g $(gid))\
     
    28812886# the install rule
    28822887$(insdst) : | $(call DIRDEP,$(dir $(insdst)))
    2883         $$(call MSG_INST_SYM,$(insdst),$(symdst))
     2888        %$$(call MSG_INST_SYM,$(insdst),$(symdst))
    28842889        $$(QUIET)$$(RM) -f $$@
    28852890        $$(QUIET)$$(LN_SYMLINK) $(symdst) $(insdst)
     
    28902895
    28912896# deal with '=>' in the source file name.
    2892 symdst := $(subst =>, ,$(src))
    2893 symlnk := $(firstword $(symdst))
    2894 symdst := $(word $(words $(symdst)),$(symdst))
     2897local symdst := $(subst =>, ,$(src))
     2898local symlnk := $(firstword $(symdst))
     2899local symdst := $(word $(words $(symdst)),$(symdst))
    28952900
    28962901# _INSTFUN
    28972902ifdef $(symlnk)_INSTFUN
    2898  instfun := $(symlnk)_INSTFUN
     2903 local instfun := $(symlnk)_INSTFUN
    28992904else ifdef $(target)_INSTFUN
    2900  instfun := $(target)_INSTFUN
     2905 local instfun := $(target)_INSTFUN
    29012906else
    2902  instfun := _INSTALL_FILE
     2907 local instfun := _INSTALL_FILE
    29032908endif
    29042909
    29052910# _INST
    29062911ifdef $(symlnk)_INST
    2907  inst := $(patsubst %/,%,$($(symlnk)_INST))/$(dir $(symlnk))
     2912 local inst := $(patsubst %/,%,$($(symlnk)_INST))/$(dir $(symlnk))
    29082913else ifdef $(target)_INST
    2909  inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(symlnk))
     2914 local inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(symlnk))
    29102915else
    2911  inst := $(dir $(symlnk))
     2916 local inst := $(dir $(symlnk))
    29122917endif
    29132918
    29142919# calc target
    2915 insdst := $(call $(instfun),$(symlnk),$(target),$(inst),$(PATH_INS))
     2920local insdst := $(call $(instfun),$(symlnk),$(target),$(inst),$(PATH_INS))
    29162921#$(warning symlnk=$(symlnk) symdst=$(symdst) insdst=$(insdst) instfun=$(instfun) inst='$(inst)')
    29172922
     
    29272932# the install rule
    29282933$(insdst):
    2929         $$(call MSG_INST_DIR,$(insdst))
     2934        %$$(call MSG_INST_DIR,$(insdst))
    29302935        $$(QUIET)$$(INSTALL) -d \
    29312936                $(if $(uid),-o $(uid))\
     
    29442949# _INST
    29452950ifdef $(directory)_INST
    2946  inst := $(PATH_INS)/$(patsubst %/,%,$($(directory)_INST))
     2951 local inst := $(PATH_INS)/$(patsubst %/,%,$($(directory)_INST))
    29472952else ifdef $(target)_INST
    2948  inst := $(PATH_INS)/$(patsubst %/,%,$($(target)_INST))
     2953 local inst := $(PATH_INS)/$(patsubst %/,%,$($(target)_INST))
    29492954else
    2950  inst := $(PATH_INS)
    2951 endif
    2952 
    2953 mode := $(firstword \
     2955 local inst := $(PATH_INS)
     2956endif
     2957
     2958local mode := $(firstword \
    29542959        $($(target)_$(directory)_MODE.$(bld_trg).$(bld_trg_arch)) \
    29552960        $($(target)_$(directory)_MODE.$(bld_trg)) \
     
    29612966        $($(target)_MODE.$(bld_trg)) \
    29622967        $($(target)_MODE))
    2963 uid := $(firstword \
     2968local uid := $(firstword \
    29642969        $($(target)_$(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
    29652970        $($(target)_$(directory)_UID.$(bld_trg)) \
     
    29712976        $($(target)_UID.$(bld_trg)) \
    29722977        $($(target)_UID))
    2973 gid := $(firstword \
     2978local gid := $(firstword \
    29742979        $($(target)_$(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
    29752980        $($(target)_$(directory)_GID.$(bld_trg)) \
     
    29812986        $($(target)_GID.$(bld_trg)) \
    29822987        $($(target)_GID))
    2983 flags := \
     2988local flags := \
    29842989        $($(target)_IDFLAGS)\
    29852990        $($(target)_IDFLAGS.$(bld_trg)) \
     
    29922997        $($(target)_$(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch))
    29932998
    2994 insdst := $(inst)/$(directory)/
     2999local insdst := $(inst)/$(directory)/
    29953000#$(warning directory=$(directory) inst=$(inst) insdst=$(insdst) mode=$(mode) gid=$(gid) uid=$(uid))
    29963001
     
    30053010define def_install
    30063011# the basics.
    3007 bld_type  := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
    3008 bld_trg   := $(firstword $($(target)_BLD_TRG)      $(BUILD_TARGET))
    3009 bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
    3010 bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_TARGET_CPU))
     3012local bld_type  := $(firstword $($(target)_BLD_TYPE)     $(BUILD_TYPE))
     3013local bld_trg   := $(firstword $($(target)_BLD_TRG)      $(BUILD_TARGET))
     3014local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(BUILD_TARGET_ARCH))
     3015local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(BUILD_TARGET_CPU))
    30113016
    30123017INSTARGET_$(target) := $($(target)_GOALS)
     
    30143019
    30153020$(foreach directory,$($(target)_DIRS) $($(target)_DIRS.$(bld_trg)) $($(target)_DIRS.$(bld_trg).$(bld_trg_arch)) $($(target)_DIRS.$(bld_trg_arch)) $($(target)_DIRS.$(bld_trg_cpu)) $($(target)_DIRS.$(bld_type)), \
    3016         $(eval $(value def_install_directory)))
     3021        $(evalval def_install_directory))
    30173022
    30183023$(foreach src,$($(target)_SOURCES) $($(target)_SOURCES.$(bld_trg)) $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_arch)) $($(target)_SOURCES.$(bld_trg_cpu)) $($(target)_SOURCES.$(bld_type)), \
    3019         $(eval $(value def_install_src)))
     3024        $(evalval def_install_src))
    30203025
    30213026$(foreach src,$($(target)_SYMLINKS) $($(target)_SYMLINKS.$(bld_trg)) $($(target)_SYMLINKS.$(bld_trg).$(bld_trg_arch)) $($(target)_SYMLINKS.$(bld_trg_arch)) $($(target)_SYMLINKS.$(bld_trg_cpu)) $($(target)_SYMLINKS.$(bld_type)), \
    3022         $(eval $(value def_install_symlink)))
     3027        $(evalval def_install_symlink))
    30233028
    30243029# the collection target
     
    30383043## process all install targets
    30393044$(foreach target, $(INSTALLS) $(INSTALLS.$(BUILD_TARGET)) $(INSTALLS.$(BUILD_TARGET).$(BUILD_TARGET_ARCH)), \
    3040         $(eval $(value def_install)))
     3045        $(evalval def_install))
    30413046
    30423047ifdef KBUILD_PROFILE_SELF
     
    30683073define def_mkdir_rule
    30693074$(directory):
    3070         $$(call MSG_MKDIR,$$@)
     3075        %$$(call MSG_MKDIR,$$@)
    30713076        $$(QUIET)$$(MKDIR) -p $$@
    30723077endef
     
    30903095        @$(ECHO) 'stat: $(make-stats )'
    30913096endif
    3092         $(call MSG_NOTHING)
     3097        %$(call MSG_NOTHING)
    30933098
    30943099
     
    30973102#
    30983103do-clean:
    3099         $(call MSG_CLEAN)
     3104        %$(call MSG_CLEAN)
    31003105        $(QUIET)$(RM) -f $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_DEPFILES_INCLUDED) $(_CLEAN_FILES) $(OTHER_CLEAN)
    31013106        $(QUIET)$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist $(rsort $(dir $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_DEPFILES_INCLUDED) $(_CLEAN_FILES) $(OTHER_CLEAN)))
     
    32073212.PHONY: pass_$(pass)_order
    32083213pass_$(pass)_order: $(pass_prev)
    3209         $$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
     3214        %$$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
    32103215        + $$(QUIET)$$(MAKE) -f $$(MAKEFILE) pass_$(pass)
    32113216else
     
    32133218.PHONY:       pass_$(pass)_order pass_$(pass)_banner
    32143219pass_$(pass)_banner:
    3215         $$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
     3220        %$$(call MSG_PASS,$$(if $$(PASS_$(PASS)),$$(PASS_$(PASS)),$(pass)))
    32163221pass_$(pass)_order: \
    32173222                $(pass_prev) \
  • trunk/kBuild/header.kmk

    r1441 r1496  
    10521052  QUIET  := @
    10531053  QUIET2 := @
    1054   MSG_L1 ?= @$(ECHO) "kBuild: $1"
     1054  MSG_L1 ?= %@$(ECHO) "kBuild: $1"
    10551055  MSG_L2  =
    10561056 else ifeq ($(KBUILD_VERBOSE),1)
     
    10581058  QUIET  := @
    10591059  QUIET2 := @
    1060   MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
     1060  MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
    10611061  MSG_L2  =
    10621062 else ifeq ($(KBUILD_VERBOSE),2)
     
    10641064  QUIET  :=
    10651065  QUIET2 := @
    1066   MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
    1067   MSG_L2 ?= @$(ECHO) "kBuild: $1"
     1066  MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
     1067  MSG_L2 ?= %@$(ECHO) "kBuild: $1"
    10681068 else
    10691069  # maximal output.
    10701070  QUIET  :=
    10711071  QUIET2 :=
    1072   MSG_L1 ?= @$(ECHO) "kBuild: $1 $2"
    1073   MSG_L2 ?= @$(ECHO) "kBuild: $1"
     1072  MSG_L1 ?= %@$(ECHO) "kBuild: $1 $2"
     1073  MSG_L2 ?= %@$(ECHO) "kBuild: $1"
    10741074 endif
    10751075endif
Note: See TracChangeset for help on using the changeset viewer.