Ignore:
Timestamp:
Jul 16, 2011, 10:08:07 PM (14 years ago)
Author:
bird
Message:

kBuild/footer+header.kmk: Reworking installation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/kBuild/footer.kmk

    r2436 r2475  
    121121_SYSMODS  :=
    122122_MISCBINS :=
     123_STAGE_FILES :=
     124_STAGE_DIRS :=
    123125_INSTALLS :=
    124126_INSTALLS_FILES :=
     
    12811283local out := $(outbase)$(suff)
    12821284
    1283 # TARGET_*
     1285# Object directory target variable.
    12841286$(target)_1_TARGET := $(out)
    12851287$(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
    12861288
    1287 # INSTARGET_*
    1288 ifeq ($(strip $($(target)_NOINST) $($(target)_NOINST.$(bld_trg)) $($(target)_NOINST.$(bld_trg).$(bld_trg_arch)) $($(target)_NOINST.$(bld_trg).$(bld_trg_arch).$(bld_type))  $($(target)_NOINST.$(bld_trg_arch)) $($(target)_NOINST.$(bld_trg_cpu)) $($(target)_NOINST.$(bld_type))),)
    1289  ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type))),)
    1290   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type)))
    1291  else ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_trg_arch))),)
    1292   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_trg_arch)))
    1293  else ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_type))),)
    1294   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_type)))
    1295  else ifneq ($(strip $($(target)_INST.$(bld_trg_arch))),)
    1296   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg_arch)))
    1297  else ifneq ($(strip $($(target)_INST.$(bld_trg))),)
    1298   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg)))
    1299  else ifneq ($(strip $($(target)_INST.$(bld_type))),)
    1300   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_type)))
    1301  else ifneq ($(strip $($(target)_INST)),)
    1302   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST))
     1289# Staging and install directory target variables.
     1290local insttype := $(firstword \
     1291        $($(target)_INSTTYPE) \
     1292        $($(target)_INSTTYPE.$(bld_trg)) \
     1293        $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch)) \
     1294        $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     1295        $($(target)_INSTTYPE.$(bld_trg_arch)) \
     1296        $($(target)_INSTTYPE.$(bld_trg_cpu)) \
     1297        $($(target)_INSTTYPE.$(bld_type)) \
     1298        )
     1299ifeq ($(insttype),)
     1300 ifneq ($(firstword \
     1301        $($(target)_NOINST) \
     1302        $($(target)_NOINST.$(bld_trg)) \
     1303        $($(target)_NOINST.$(bld_trg).$(bld_trg_arch)) \
     1304        $($(target)_NOINST.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     1305        $($(target)_NOINST.$(bld_trg_arch)) \
     1306        $($(target)_NOINST.$(bld_trg_cpu)) \
     1307        $($(target)_NOINST.$(bld_type)) ),)
     1308   local insttype := none
    13031309 else
    1304   local inst := $(definst)/
    1305  endif
    1306  INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)),$(inst))
    1307 
    1308 else # NOINST
    1309  INSTARGET_$(target) :=
    1310 endif # NOINST
    1311 
    1312 endef
     1310   local insttype := both
     1311 endif
     1312endif
     1313ifn1of ($(insttype), none both stage)
     1314 $(error kBuild: Unknown value '$(insttype)' for '$(target)_INSTTYPE'. Valid values are 'none', 'both' and 'stage'.)
     1315endif
     1316$(target)_1_INSTTYPE := $(insttype)
     1317
     1318if1of ($(insttype), stage both)
     1319 local stage := $(strip $(firstword \
     1320        $($(target)_STAGE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     1321        $($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     1322        $($(target)_STAGE.$(bld_trg).$(bld_trg_arch)) \
     1323        $($(target)_INST.$(bld_trg).$(bld_trg_arch)) \
     1324        $($(target)_STAGE.$(bld_trg).$(bld_type)) \
     1325        $($(target)_INST.$(bld_trg).$(bld_type)) \
     1326        $($(target)_STAGE.$(bld_trg_arch)) \
     1327        $($(target)_INST.$(bld_trg_arch)) \
     1328        $($(target)_STAGE.$(bld_trg)) \
     1329        $($(target)_INST.$(bld_trg)) \
     1330        $($(target)_STAGE.$(bld_type)) \
     1331        $($(target)_INST.$(bld_type)) \
     1332        $($(target)_STAGE) \
     1333        $($(target)_INST) \
     1334        $(definst) ))
     1335 $(target)_1_STAGE := $(stage)
     1336 $(target)_1_STAGE_TARGET := $(PATH_STAGE)/$(stage)$(notdir $(out))
     1337else
     1338 $(target)_1_STAGE :=
     1339 $(target)_1_STAGE_TARGET :=
     1340endif
     1341INSTARGET_$(target) := $($(target)_1_STAGE_TARGET)
     1342
     1343if1of ($(insttype), both)
     1344 local inst := $(strip $(firstword \
     1345        $($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     1346        $($(target)_INST.$(bld_trg).$(bld_trg_arch)) \
     1347        $($(target)_INST.$(bld_trg).$(bld_type)) \
     1348        $($(target)_INST.$(bld_trg_arch)) \
     1349        $($(target)_INST.$(bld_trg)) \
     1350        $($(target)_INST.$(bld_type)) \
     1351        $($(target)_INST) \
     1352        $(definst) ))
     1353 $(target)_1_INST := $(inst)
     1354 $(target)_1_INST_TARGET := $(PATH_INS)/$(inst)$(notdir $(out))
     1355else
     1356 $(target)_1_INST :=
     1357 $(target)_1_INST_TARGET :=
     1358endif
     1359
     1360endef # def_pass1_link_common
    13131361$(eval-opt-var def_pass1_link_common)
    13141362
     
    13201368# set NOINST if not forced installation before doing the usual stuff.
    13211369ifndef $(target)_INST
    1322 $(target)_NOINST := 1
     1370$(target)_INSTTYPE := none
    13231371endif
    13241372$(evalval def_pass1_link_common)
     
    13271375EXT     := EXE
    13281376EXTPRE  := HOST
    1329 definst := $(PATH_BIN)
     1377definst := $(INST_BIN)
    13301378tool_prefix := LD
    13311379bld_trg_base_var := PLATFORM
     
    13391387EXT     := LIB
    13401388EXTPRE  :=
    1341 definst := $(PATH_LIB)
     1389definst := $(INST_LIB)
    13421390tool_prefix := AR
    13431391bld_trg_base_var := TARGET
     
    13511399EXT     := DLL
    13521400EXTPRE  :=
    1353 definst := $(PATH_DLL)
     1401definst := $(INST_DLL)
    13541402tool_prefix := LD
    13551403bld_trg_base_var := TARGET
     
    13671415 EXT     := LIB
    13681416 EXTPRE  :=
    1369  definst := $(PATH_LIB)
     1417 definst := $(INST_LIB)
    13701418 tool_prefix := AR
    13711419 bld_trg_base_var := TARGET
     
    13751423 EXT     := DLL
    13761424 EXTPRE  :=
    1377  definst := $(PATH_DLL)
     1425 definst := $(INST_DLL)
    13781426 tool_prefix := LD
    13791427 bld_trg_base_var := TARGET
     
    13881436EXT     := EXE
    13891437EXTPRE  :=
    1390 definst := $(PATH_BIN)
     1438definst := $(INST_BIN)
    13911439tool_prefix := LD
    13921440bld_trg_base_var := TARGET
     
    14001448EXT     := SYS
    14011449EXTPRE  :=
    1402 definst := $(PATH_SYS)
     1450definst := $(INST_SYS)
    14031451tool_prefix := LD
    14041452bld_trg_base_var := TARGET
     
    14121460EXT     := BIN
    14131461EXTPRE  :=
    1414 definst := $(PATH_BIN)
     1462definst := $(INST_BIN)
    14151463tool_prefix := LD
    14161464bld_trg_base_var := TARGET
     
    14281476local bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
    14291477local bld_trg_cpu  := $(firstword $($(target)_BLD_TRG_CPU)  $(KBUILD_TARGET_CPU))
    1430 # TARGET_*
     1478# _1_TARGET
    14311479$(target)_1_TARGET := $(PATH_TARGET)/$(target).ins
    14321480$(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
     1481
     1482# Determine and set 1_INSTTYPE.
     1483local insttype := $(firstword \
     1484        $($(target)_INSTTYPE) \
     1485        $($(target)_INSTTYPE.$(bld_trg)) \
     1486        $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch)) \
     1487        $($(target)_INSTTYPE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     1488        $($(target)_INSTTYPE.$(bld_trg_arch)) \
     1489        $($(target)_INSTTYPE.$(bld_trg_cpu)) \
     1490        $($(target)_INSTTYPE.$(bld_type)) \
     1491        )
     1492ifeq ($(insttype),)
     1493 ifneq ($(firstword \
     1494        $($(target)_NOINST) \
     1495        $($(target)_NOINST.$(bld_trg)) \
     1496        $($(target)_NOINST.$(bld_trg).$(bld_trg_arch)) \
     1497        $($(target)_NOINST.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     1498        $($(target)_NOINST.$(bld_trg_arch)) \
     1499        $($(target)_NOINST.$(bld_trg_cpu)) \
     1500        $($(target)_NOINST.$(bld_type)) ),)
     1501   local insttype := none
     1502 else
     1503   local insttype := both
     1504 endif
     1505endif
     1506ifn1of ($(insttype), none both stage)
     1507 $(error kBuild: Unknown value '$(insttype)' for '$(target)_INSTTYPE'. Valid values are 'none', 'both' and 'stage'.)
     1508endif
     1509$(target)_1_INSTTYPE    := $(insttype)
     1510
     1511# Determine the actual INST and STAGE sub-dirs to use for this target.
     1512if1of ($(insttype), stage both)
     1513 local stage := $(strip $(firstword \
     1514        $($(target)_STAGE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     1515        $($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     1516        $($(target)_STAGE.$(bld_trg).$(bld_trg_arch)) \
     1517        $($(target)_INST.$(bld_trg).$(bld_trg_arch)) \
     1518        $($(target)_STAGE.$(bld_trg).$(bld_type)) \
     1519        $($(target)_INST.$(bld_trg).$(bld_type)) \
     1520        $($(target)_STAGE.$(bld_trg_arch)) \
     1521        $($(target)_INST.$(bld_trg_arch)) \
     1522        $($(target)_STAGE.$(bld_trg)) \
     1523        $($(target)_INST.$(bld_trg)) \
     1524        $($(target)_STAGE.$(bld_type)) \
     1525        $($(target)_INST.$(bld_type)) \
     1526        $($(target)_STAGE) \
     1527        $($(target)_INST) \
     1528        $(definst) ))
     1529 $(target)_1_STAGE := $(stage)
     1530else
     1531 $(target)_1_STAGE = $(error _1_STAGE not used)
     1532endif
     1533
     1534if1of ($(insttype), both)
     1535 local inst := $(strip $(firstword \
     1536        $($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     1537        $($(target)_INST.$(bld_trg).$(bld_trg_arch)) \
     1538        $($(target)_INST.$(bld_trg).$(bld_type)) \
     1539        $($(target)_INST.$(bld_trg_arch)) \
     1540        $($(target)_INST.$(bld_trg)) \
     1541        $($(target)_INST.$(bld_type)) \
     1542        $($(target)_INST) \
     1543        $(definst) ))
     1544 $(target)_1_INST := $(inst)
     1545else
     1546 $(target)_1_INST = $(error _1_INST not used)
     1547endif
     1548
     1549# Block properties that we put off setting until pass 2 for INSTALLS.
     1550$(target)_1_STAGE_TARGET = $(error The '_1_STAGE_TARGET' property is not present on install targets.  Use '_2_STAGE_TARGETS' instead (set by pass 2!).)
     1551$(target)_1_INST_TARGET  = $(error The '_1_INST_TARGET' property is not present on install targets.  Use '_2_INST_TARGETS' instead (set by pass 2!).)
     1552INSTARGET_$(target)      = $(error The 'INSTARGET_' is deprecated and besides, it is being accessed to early.  Consider '_2_STAGE_TARGETS' or '_2_INST_TARGETS'.)
    14331553
    14341554# INSTARGET_ later.
     
    14391559endef # def_pass1_install
    14401560$(eval-opt-var def_pass1_install)
     1561
    14411562$(foreach target, $(_ALL_INSTALLS), \
    14421563        $(evalval def_pass1_install))
     
    15871708$(error kBuild: Bad or missing INST property for source '$(source)' in target '$(target)': $(inst))
    15881709endif
     1710## @todo Install-revamp: FIXME
    15891711INSTARGET_$(target)_$(srcname) := $(inst)
    15901712local fetchdir := $(firstword \
     
    17991921define def_fetch
    18001922# common
     1923## @todo Install-revamp: FIXME
    18011924INSTARGET_$(target) := $($(target)_INST)
    18021925ifneq ($(patsubst %/,ok,$(INSTARGET_$(target))),ok)
     
    20042127
    20052128## Generate the link & lib install rule
    2006 # @param    $(target)   Normalized target name.
    2007 # @param    $(out)      The build target.
    2008 # @param    $(INSTARGET_$(target))  The installation targets.
    2009 # @param    $(mode)     The file mode (optional)
     2129# Implicit parameters: target, out, $(target)_1_STAGE_TARGET, mode,
     2130#                      pre_install_cmds, post_install_cmds
    20102131define def_link_install_rule
    2011 $(INSTARGET_$(target)) : $(out) | $(call DIRDEP,$(dir $(INSTARGET_$(target))))
     2132$($(target)_1_INST_TARGET): $(out) | $(dir $($(target)_1_INST_TARGET))
    20122133        %$$(call MSG_INST_TRG,$(target),$(out),$$@)
     2134        $(pre_install_cmds)
     2135
    20132136        $$(QUIET)$$(INSTALL) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $(out) $$@
    2014 
    2015 ifdef KBUILD_DO_AUTO_INSTALL
    2016 $(basename $(notdir $(out))):: $(INSTARGET_$(target))
    2017 endif
    2018 endef # def_link_install_rule
     2137        $(post_install_cmds)
     2138
     2139
     2140endef
     2141
     2142
     2143## Generate the link & lib stage installation rule
     2144# Implicit parameters: target, out, $(target)_1_STAGE_TARGET, mode,
     2145#                      pre_install_cmds, post_install_cmds
     2146define def_link_stage_rule
     2147$($(target)_1_STAGE_TARGET): $(out) | $(dir $($(target)_1_STAGE_TARGET))
     2148        %$$(call MSG_INST_TRG,$(target),$(out),$$@)
     2149        $(pre_install_cmds)
     2150
     2151        $$(QUIET)$$(INSTALL) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $(out) $$@
     2152        $(post_install_cmds)
     2153
     2154
     2155$(basename $(notdir $(out))):: $($(target)_1_STAGE_TARGET)
     2156
     2157endef
    20192158
    20202159
     
    20722211 othersrc += $(source)
    20732212endif
    2074 endef
     2213endef # def_src_handler_one
    20752214
    20762215## Generic macro for processing all target sources.
     
    21062245
    21072246
    2108 
    2109 ## Generic macro for generating the install rule(s) for a target
    2110 # and update the globals with default out.
     2247##
     2248# Function for getting the first defined propert value.
     2249#
     2250# @param   1            The property name.
     2251# @note    Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
     2252# @returns Expanded property value.
     2253#
     2254## @todo bld_trg_cpu is missing here.
     2255define def_fn_prop_get_first_defined
     2256ifdef $(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)
     2257 local .RETURN := $($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type))
     2258else ifdef $(target)_$(1).$(bld_trg).$(bld_trg_arch)
     2259 local .RETURN := $($(target)_$(1).$(bld_trg).$(bld_trg_arch))
     2260else ifdef $(target)_$(1).$(bld_trg).$(bld_type)
     2261 local .RETURN := $($(target)_$(1).$(bld_trg).$(bld_type))
     2262else ifdef $(target)_$(1).$(bld_trg_arch)
     2263 local .RETURN := $($(target)_$(1).$(bld_trg_arch))
     2264else ifdef $(target)_$(1).$(bld_trg)
     2265 local .RETURN := $($(target)_$(1).$(bld_trg))
     2266else ifdef $(target)_$(1).$(bld_type)
     2267 local .RETURN := $($(target)_$(1).$(bld_type))
     2268else ifdef $(target)_$(1)
     2269 local .RETURN := $($(target)_$(1))
     2270else ifdef $(1).$(bld_trg).$(bld_trg_arch).$(bld_type)
     2271 local .RETURN := $($(1).$(bld_trg).$(bld_trg_arch).$(bld_type))
     2272else ifdef $(1).$(bld_trg).$(bld_trg_arch)
     2273 local .RETURN := $($(1).$(bld_trg).$(bld_trg_arch))
     2274else ifdef $(1).$(bld_trg).$(bld_type)
     2275 local .RETURN := $($(1).$(bld_trg).$(bld_type))
     2276else ifdef $(1).$(bld_trg_arch)
     2277 local .RETURN := $($(1).$(bld_trg_arch))
     2278else ifdef $(1).$(bld_trg)
     2279 local .RETURN := $($(1).$(bld_trg))
     2280else ifdef $(1).$(bld_type)
     2281 local .RETURN := $($(1).$(bld_type))
     2282else
     2283 local .RETURN := $($(1))
     2284endif
     2285endef # def_fn_prop_get_first_defined
     2286
     2287
     2288## Generic macro for generating the install rule(s) for a target.
    21112289#
    21122290# @param        $(target)   Normalized target name.
     
    21142292# @param        $(definst)  The default _INST value.
    21152293# @param        $(typevar)  The name of the variable with all the root targets of its type.
    2116 # @remark   Only library uses this now.
    2117 define def_target_install_pluss
    2118 ifeq ($(strip $($(target)_NOINST) $($(target)_NOINST.$(bld_trg)) $($(target)_NOINST.$(bld_trg).$(bld_trg_arch)) $($(target)_NOINST.$(bld_trg).$(bld_trg_arch).$(bld_type))  $($(target)_NOINST.$(bld_trg_arch)) $($(target)_NOINST.$(bld_trg_cpu)) $($(target)_NOINST.$(bld_type))),)
    2119  ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type))),)
    2120   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type)))
    2121  else ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_trg_arch))),)
    2122   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_trg_arch)))
    2123  else ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_type))),)
    2124   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_type)))
    2125  else ifneq ($(strip $($(target)_INST.$(bld_trg_arch))),)
    2126   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg_arch)))
    2127  else ifneq ($(strip $($(target)_INST.$(bld_trg))),)
    2128   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg)))
    2129  else ifneq ($(strip $($(target)_INST.$(bld_type))),)
    2130   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_type)))
    2131  else ifneq ($(strip $($(target)_INST)),)
    2132   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST))
    2133  else
    2134   local inst := $(definst)/
    2135  endif
    2136  INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)),$(inst))
     2294define def_target_install_only
     2295ifneq ($($(target)_1_INSTTYPE),none)
    21372296 local mode := $(firstword \
    21382297        $($(target)_MODE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
     
    21592318        $($(target)_GID.$(bld_type)) \
    21602319        $($(target)_GID) )
    2161 
    2162  # generate the install rule
     2320 local pre_install_cmds  := $(evalcall def_fn_prop_get_first_defined,PRE_INST_CMDS)
     2321 local post_install_cmds := $(evalcall def_fn_prop_get_first_defined,POST_INST_CMDS)
     2322
     2323 # Generate the rules
     2324 ifeq ($($(target)_1_INSTTYPE),both)
    21632325$(eval $(def_link_install_rule))
    2164 
    2165  _INSTALLS_FILES += $(INSTARGET_$(target))
    2166 
    2167  ifdef KBUILD_DO_AUTO_INSTALL
    2168   $(typevar) += $(INSTARGET_$(target))
    2169  else
    2170   $(typevar) += $(out)
    2171  endif
    2172 else # _NOINST
     2326  _INSTALLS_FILES += $($(target)_1_INST_TARGET)
     2327 endif
     2328$(eval $(def_link_stage_rule))
     2329 _STAGE_FILES += $($(target)_1_STAGE_TARGET)
     2330 $(typevar) += $($(target)_1_STAGE_TARGET)
     2331else  # INSTTYPE == none
    21732332 $(typevar) += $(out)
    2174 endif
    2175 
    2176 _OUT_FILES += $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $(out)
    2177 _CLEAN_FILES += $($(target)_CLEAN) $($(target)_CLEAN.$(bld_trg)) $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_cpu)) $($(target)_CLEAN.$(bld_type))
    2178 _DIRS += $($(target)_BLDDIRS) $($(target)_BLDDIRS.$(bld_trg)) $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_cpu)) $($(target)_BLDDIRS.$(bld_type))
    2179 _OBJS += $($(target)_2_OBJS)
    2180 
    2181 endef # def_target_install_pluss
     2333endif # INSTTYPE == none
     2334
     2335endef # def_target_install_only
    21822336
    21832337
     
    23112465
    23122466# Custom pre-link actions.
    2313 ## @todo bld_trg_cpu is missing here.
    2314 ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2315  local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    2316 else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch)
    2317  local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch))
    2318 else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_type)
    2319  local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_type))
    2320 else ifdef $(target)_PRE_CMDS.$(bld_trg_arch)
    2321  local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg_arch))
    2322 else ifdef $(target)_PRE_CMDS.$(bld_trg)
    2323  local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg))
    2324 else ifdef $(target)_PRE_CMDS.$(bld_type)
    2325  local pre_cmds := $($(target)_PRE_CMDS.$(bld_type))
    2326 else ifdef $(target)_PRE_CMDS
    2327  local pre_cmds := $($(target)_PRE_CMDS)
    2328 else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2329  local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    2330 else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch)
    2331  local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch))
    2332 else ifdef PRE_CMDS.$(bld_trg).$(bld_type)
    2333  local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_type))
    2334 else ifdef PRE_CMDS.$(bld_trg_arch)
    2335  local pre_cmds := $(PRE_CMDS.$(bld_trg_arch))
    2336 else ifdef PRE_CMDS.$(bld_trg)
    2337  local pre_cmds := $(PRE_CMDS.$(bld_trg))
    2338 else ifdef PRE_CMDS.$(bld_type)
    2339  local pre_cmds := $(PRE_CMDS.$(bld_type))
    2340 else
    2341  local pre_cmds := $(PRE_CMDS)
    2342 endif
    2343 
    2344 # Custom post-link actions.
    2345 ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2346  local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    2347 else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch)
    2348  local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch))
    2349 else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_type)
    2350  local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_type))
    2351 else ifdef $(target)_POST_CMDS.$(bld_trg_arch)
    2352  local post_cmds := $($(target)_POST_CMDS.$(bld_trg_arch))
    2353 else ifdef $(target)_POST_CMDS.$(bld_trg)
    2354  local post_cmds := $($(target)_POST_CMDS.$(bld_trg))
    2355 else ifdef $(target)_POST_CMDS.$(bld_type)
    2356  local post_cmds := $($(target)_POST_CMDS.$(bld_type))
    2357 else ifdef $(target)_POST_CMDS
    2358  local post_cmds := $($(target)_POST_CMDS)
    2359 else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2360  local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    2361 else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch)
    2362  local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch))
    2363 else ifdef POST_CMDS.$(bld_trg).$(bld_type)
    2364  local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_type))
    2365 else ifdef POST_CMDS.$(bld_trg_arch)
    2366  local post_cmds := $(POST_CMDS.$(bld_trg_arch))
    2367 else ifdef POST_CMDS.$(bld_trg)
    2368  local post_cmds := $(POST_CMDS.$(bld_trg))
    2369 else ifdef POST_CMDS.$(bld_type)
    2370  local post_cmds := $(POST_CMDS.$(bld_type))
    2371 else
    2372  local post_cmds := $(POST_CMDS)
    2373 endif
     2467local pre_cmds  := $(evalcall def_fn_prop_get_first_defined,PRE_CMDS)
     2468local post_cmds := $(evalcall def_fn_prop_get_first_defined,POST_CMDS)
    23742469
    23752470# eliminate this guy?
     
    24212516$(eval $(def_link_rule))
    24222517
    2423 # installing and globals
    2424 $(evalval def_target_install_pluss)
    2425 endef
     2518# installing and globals.
     2519$(evalval def_target_install_only)
     2520
     2521_OUT_FILES += $($(target)_2_OUTPUT) $($(target)_2_OUTPUT_MAYBE) $(out)
     2522_CLEAN_FILES += $($(target)_CLEAN) $($(target)_CLEAN.$(bld_trg)) $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_cpu)) $($(target)_CLEAN.$(bld_type))
     2523_DIRS += $($(target)_BLDDIRS) $($(target)_BLDDIRS.$(bld_trg)) $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_cpu)) $($(target)_BLDDIRS.$(bld_type))
     2524_OBJS += $($(target)_2_OBJS)
     2525
     2526endef # def_lib
    24262527$(eval-opt-var def_lib)
    24272528
    24282529# Process libraries
    2429 definst := $(PATH_LIB)
    24302530typevar := _LIBS
    24312531tool_do := LINK_LIBRARY
     
    24472547# @param    $(target)   Normalized target name.
    24482548# @param    $(EXT)      EXE,DLL,SYS.
    2449 # @param    $(definst)  The default _INST value.
    24502549# @param    $(typevar)  The name of the variable with all the root targets of its type.
    24512550define def_link_common
     
    26802779endif
    26812780
    2682 # Custom pre-link actions.
    2683 ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2684  local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    2685 else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch)
    2686  local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_trg_arch))
    2687 else ifdef $(target)_PRE_CMDS.$(bld_trg).$(bld_type)
    2688  local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg).$(bld_type))
    2689 else ifdef $(target)_PRE_CMDS.$(bld_trg_arch)
    2690  local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg_arch))
    2691 else ifdef $(target)_PRE_CMDS.$(bld_trg)
    2692  local pre_cmds := $($(target)_PRE_CMDS.$(bld_trg))
    2693 else ifdef $(target)_PRE_CMDS.$(bld_type)
    2694  local pre_cmds := $($(target)_PRE_CMDS.$(bld_type))
    2695 else ifdef $(target)_PRE_CMDS
    2696  local pre_cmds := $($(target)_PRE_CMDS)
    2697 else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2698  local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    2699 else ifdef PRE_CMDS.$(bld_trg).$(bld_trg_arch)
    2700  local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_trg_arch))
    2701 else ifdef PRE_CMDS.$(bld_trg).$(bld_type)
    2702  local pre_cmds := $(PRE_CMDS.$(bld_trg).$(bld_type))
    2703 else ifdef PRE_CMDS.$(bld_trg_arch)
    2704  local pre_cmds := $(PRE_CMDS.$(bld_trg_arch))
    2705 else ifdef PRE_CMDS.$(bld_trg)
    2706  local pre_cmds := $(PRE_CMDS.$(bld_trg))
    2707 else ifdef PRE_CMDS.$(bld_type)
    2708  local pre_cmds := $(PRE_CMDS.$(bld_type))
    2709 else
    2710  local pre_cmds := $(PRE_CMDS)
    2711 endif
    2712 
    2713 # Custom post-link actions.
    2714 ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2715  local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    2716 else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch)
    2717  local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_trg_arch))
    2718 else ifdef $(target)_POST_CMDS.$(bld_trg).$(bld_type)
    2719  local post_cmds := $($(target)_POST_CMDS.$(bld_trg).$(bld_type))
    2720 else ifdef $(target)_POST_CMDS.$(bld_trg_arch)
    2721  local post_cmds := $($(target)_POST_CMDS.$(bld_trg_arch))
    2722 else ifdef $(target)_POST_CMDS.$(bld_trg)
    2723  local post_cmds := $($(target)_POST_CMDS.$(bld_trg))
    2724 else ifdef $(target)_POST_CMDS.$(bld_type)
    2725  local post_cmds := $($(target)_POST_CMDS.$(bld_type))
    2726 else ifdef $(target)_POST_CMDS
    2727  local post_cmds := $($(target)_POST_CMDS)
    2728 else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type)
    2729  local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch).$(bld_type))
    2730 else ifdef POST_CMDS.$(bld_trg).$(bld_trg_arch)
    2731  local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_trg_arch))
    2732 else ifdef POST_CMDS.$(bld_trg).$(bld_type)
    2733  local post_cmds := $(POST_CMDS.$(bld_trg).$(bld_type))
    2734 else ifdef POST_CMDS.$(bld_trg_arch)
    2735  local post_cmds := $(POST_CMDS.$(bld_trg_arch))
    2736 else ifdef POST_CMDS.$(bld_trg)
    2737  local post_cmds := $(POST_CMDS.$(bld_trg))
    2738 else ifdef POST_CMDS.$(bld_type)
    2739  local post_cmds := $(POST_CMDS.$(bld_type))
    2740 else
    2741  local post_cmds := $(POST_CMDS)
    2742 endif
     2781# Custom pre/post-link actions.
     2782local pre_cmds  := $(evalcall def_fn_prop_get_first_defined,PRE_CMDS)
     2783local post_cmds := $(evalcall def_fn_prop_get_first_defined,POST_CMDS)
    27432784
    27442785# eliminate this guy?
     
    27462787
    27472788# installation targets
    2748 ifeq ($(strip $($(target)_NOINST) $($(target)_NOINST.$(bld_trg)) $($(target)_NOINST.$(bld_trg).$(bld_trg_arch)) $($(target)_NOINST.$(bld_trg).$(bld_trg_arch).$(bld_type))  $($(target)_NOINST.$(bld_trg_arch)) $($(target)_NOINST.$(bld_trg_cpu)) $($(target)_NOINST.$(bld_type))),)
    2749  ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type))),)
    2750   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_trg_arch).$(bld_type)))
    2751  else ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_trg_arch))),)
    2752   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_trg_arch)))
    2753  else ifneq ($(strip $($(target)_INST.$(bld_trg).$(bld_type))),)
    2754   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg).$(bld_type)))
    2755  else ifneq ($(strip $($(target)_INST.$(bld_trg_arch))),)
    2756   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg_arch)))
    2757  else ifneq ($(strip $($(target)_INST.$(bld_trg))),)
    2758   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_trg)))
    2759  else ifneq ($(strip $($(target)_INST.$(bld_type))),)
    2760   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST.$(bld_type)))
    2761  else ifneq ($(strip $($(target)_INST)),)
    2762   local inst := $(addprefix $(PATH_INS)/,$($(target)_INST))
    2763  else
    2764   local inst := $(definst)/
    2765  endif
    2766  INSTARGET_$(target) := $(patsubst %/,%/$(notdir $(out)),$(inst))
    2767  ifdef KBUILD_DO_AUTO_INSTALL
    2768   $(typevar)  += $(INSTARGET_$(target))
    2769  else
    2770   $(typevar)  += $(out)
    2771  endif
    2772  local mode := $(firstword \
    2773         $($(target)_MODE.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
    2774         $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
    2775         $($(target)_MODE.$(bld_trg).$(bld_type)) \
    2776         $($(target)_MODE.$(bld_trg_arch)) \
    2777         $($(target)_MODE.$(bld_trg)) \
    2778         $($(target)_MODE.$(bld_type)) \
    2779         $($(target)_MODE) )
    2780  local uid := $(firstword \
    2781         $($(target)_UID.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
    2782         $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
    2783         $($(target)_UID.$(bld_trg).$(bld_type)) \
    2784         $($(target)_UID.$(bld_trg_arch)) \
    2785         $($(target)_UID.$(bld_trg)) \
    2786         $($(target)_UID.$(bld_type)) \
    2787         $($(target)_UID) )
    2788  local gid := $(firstword \
    2789         $($(target)_GID.$(bld_trg).$(bld_trg_arch).$(bld_type)) \
    2790         $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
    2791         $($(target)_GID.$(bld_trg).$(bld_type)) \
    2792         $($(target)_GID.$(bld_trg_arch)) \
    2793         $($(target)_GID.$(bld_trg)) \
    2794         $($(target)_GID.$(bld_type)) \
    2795         $($(target)_GID) )
    2796 
    2797  # generate the install rule
    2798 $(eval $(def_link_install_rule))
    2799 
    2800 else # NOINST
    2801  INSTARGET_$(target) :=
    2802  $(typevar)  += $(out)
    2803 endif # NOINST
     2789$(evalval def_target_install_only)
    28042790
    28052791# dependency file
     
    28642850#
    28652851
    2866 ## Build program (one).
    2867 # @param    $(target)   Normalized target (program) name.
    2868 define def_bldprog
    2869 
    2870 # set NOINST if not forced installation.
    2871 ifndef $(target)_INST
    2872 $(target)_NOINST := 1
    2873 endif
    2874 
    2875 # do the usual stuff.
    2876 $(evalval def_link_common)
    2877 
    2878 endef
    2879 
    28802852# Process build programs.
    28812853EXT     := EXE
    28822854EXTPRE  := HOST
    28832855tool_do := LINK_PROGRAM
    2884 definst := $(PATH_BIN)
    28852856typevar := _BLDPROGS
    28862857mode    := 0755
    28872858bld_trg_base_var := PLATFORM
    2888 $(foreach target, $(_ALL_BLDPROGS), $(evalval def_bldprog))
     2859$(foreach target, $(_ALL_BLDPROGS), $(evalval def_link_common))
    28892860
    28902861ifdef KBUILD_PROFILE_SELF
     
    29012872EXTPRE  :=
    29022873tool_do := LINK_DLL
    2903 definst := $(PATH_DLL)
    29042874typevar := _DLLS
    29052875mode    := 0644
     
    29252895 EXT     := LIB
    29262896 tool_do := LINK_LIBRARY
    2927  definst := $(PATH_LIB)
    29282897 $(foreach target, $(_ALL_IMPORT_LIBS), $(evalval def_lib))
    29292898else
    29302899 EXT     := DLL
    29312900 tool_do := LINK_DLL
    2932  definst := $(PATH_DLL)
    29332901 $(foreach target, $(_ALL_IMPORT_LIBS), $(evalval def_link_common))
    29342902endif
     
    29472915EXTPRE  :=
    29482916tool_do := LINK_PROGRAM
    2949 definst := $(PATH_BIN)
    29502917typevar := _PROGRAMS
    29512918mode    := 0755
     
    29662933EXTPRE  :=
    29672934tool_do := LINK_SYSMOD
    2968 definst := $(PATH_SYS)
    29692935typevar := _SYSMODS
    29702936mode    := 0644
     
    29852951EXTPRE  :=
    29862952tool_do := LINK_MISCBIN
    2987 definst := $(PATH_BIN)
    29882953typevar := _MISCBINS
    29892954mode    := 0644
     
    30062971#
    30072972
    3008 ## generate the install rule
    3009 define def_install_src_rule
    3010 # the install rule
    3011 $(insdst) : $(srcsrc) | $(call DIRDEP,$(dir $(insdst)))
    3012         %$$(call MSG_INST_FILE,$(srcsrc),$(insdst))
    3013         $$(QUIET)$(inscmd)
    3014 endef
    3015 $(eval-opt-var def_install_src_rule)
    3016 
    3017 ## install one file
     2973##
     2974# Generate the staging rules.
     2975#
     2976define def_install_src_rule_staging
     2977$(stagedst) : $(srcsrc) | $(dir $(stagedst))
     2978        %$$(call MSG_INST_FILE,$(srcsrc),$(stagedst))
     2979        $$(QUIET)$(stagecmd)
     2980endef
     2981$(eval-opt-var def_install_src_rule_staging)
     2982
     2983define def_install_src_rule_installing
     2984$(instdst) : $(srcsrc) | $(dir $(instdst))
     2985        %$$(call MSG_INST_FILE,$(srcsrc),$(instdst))
     2986        $$(QUIET)$(instcmd)
     2987endef
     2988$(eval-opt-var def_install_src_rule_installing)
     2989
     2990##
     2991# Install one file.
     2992#
    30182993define def_install_src
    30192994
     
    30283003 $(warning kBuild: Install target '$(target)' has a bad source specifier: $(src))
    30293004endif
    3030 local srcdst := $(subst =>, ,$(src))
    3031 local srcsrc := $(firstword $(srcdst))
     3005local srcdst    := $(subst =>, ,$(src))
     3006local srcsrc    := $(firstword $(srcdst))
    30323007local srcdstdir := $(dir $(word 2,$(srcdst)))
    3033 local srcdst := $(word $(words $(srcdst)),$(srcdst))
    3034 
    3035 # _INSTFUN
     3008local srcdst    := $(word $(words $(srcdst)),$(srcdst))
     3009
     3010# Calc destinations.
    30363011ifdef $(srcsrc)_INSTFUN
    30373012 local instfun := $(srcsrc)_INSTFUN
    3038 else ifdef $(target)_INSTFUN
    3039  local instfun := $(target)_INSTFUN
    30403013else
    3041  local instfun := _INSTALL_FILE
    3042 endif
    3043 
    3044 # _INST
    3045 ifdef $(srcsrc)_INST
    3046  local inst := $(patsubst %/,%,$($(srcsrc)_INST))/$(dir $(srcdstdir))
    3047 else ifdef $(target)_INST
    3048  local inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(srcdstdir))
    3049 else
    3050  local inst := $(dir $(srcdstdir))
    3051 endif
    3052 
    3053 # calc target
    3054 local insdst := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS))
    3055 #$(warning instfun=$(instfun) srcdst=$(srcdst) target=$(target) inst=$(inst) => insdst=$(insdst))
     3014 local instfun := $(top_instfun)
     3015endif
     3016
     3017local stage    := $(firstword $($(srcsrc)_STAGE) $($(target)_1_STAGE))
     3018ifneq ($(substr $(stage),-1),/)
     3019 $(warning kBuild: File $(srcsrc) in install target $(target) has a STAGE property without a trailing slash.)
     3020 local stage   := $(stage)/
     3021endif
     3022local stage    := $(stage)/$(dir $(srcdstdir))
     3023local stagedst := $(call $(instfun),$(srcdst),$(target),$(stage),$(PATH_STAGE))
     3024
     3025local inst     := $(firstword $($(srcsrc)_STAGE) $($(target)_1_STAGE))
     3026ifneq ($(substr $(inst),-1),/)
     3027 $(warning kBuild: File $(srcsrc) in install target $(target) has a INST property without a trailing slash.)
     3028 local inst    := $(inst)/
     3029endif
     3030local inst     := $(inst)/$(dir $(srcdstdir))
     3031local instdst  := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS))
     3032
     3033#$(warning instfun=$(instfun) srcdst=$(srcdst) target=$(target) inst=$(inst) => instdst=$(instdst); stage=$(stage) => stagedst=$(stagedst))
    30563034
    30573035# mode, uid and gid
     
    30693047        $($(srcdst)_MODE.$(bld_trg)) \
    30703048        $($(srcdst)_MODE) \
    3071         $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
    3072         $($(target)_MODE.$(bld_trg)) \
    3073         $($(target)_MODE))
     3049        $(top_mode))
    30743050local uid := $(firstword \
    30753051        $($(target)_$(srcsrc)_UID.$(bld_trg).$(bld_trg_arch)) \
     
    30853061        $($(srcdst)_UID.$(bld_trg)) \
    30863062        $($(srcdst)_UID) \
    3087         $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
    3088         $($(target)_UID.$(bld_trg)) \
    3089         $($(target)_UID))
     3063        $(top_uid))
    30903064local gid := $(firstword \
    30913065        $($(target)_$(srcsrc)_GID.$(bld_trg).$(bld_trg_arch)) \
     
    31013075        $($(srcdst)_GID.$(bld_trg)) \
    31023076        $($(srcdst)_GID) \
    3103         $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
    3104         $($(target)_GID.$(bld_trg)) \
    3105         $($(target)_GID))
     3077        $(top_gid))
    31063078local flags := \
    3107         $($(target)_IFFLAGS) \
    3108         $($(target)_IFFLAGS.$(bld_trg)) \
    3109         $($(target)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
     3079        $(top_ifflags) \
    31103080        $($(srcdst)_IFFLAGS) \
    31113081        $($(srcdst)_IFFLAGS.$(bld_trg)) \
     
    31363106
    31373107# Adjust the source if we got a default PATH. (This must be done this late!)
    3138 local defpath     := $($(target)_DEFPATH)
    3139 ifeq ($(defpath),)
    3140  local defpath    := $($(target)_PATH)
    3141 endif
     3108local defpath := $(firstword $($(target)_DEFPATH) $($(target)_PATH))
    31423109ifneq ($(defpath),)
    31433110 local srcsrc := $(abspathex $(srcsrc),$(defpath))
    31443111endif
    31453112
    3146 # create the command
     3113# create the commands
    31473114ifdef $(srcsrc)_INSTALLER
    3148  local inscmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(insdst),$(target),$(flags))
     3115 local stagecmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(stagedst),$(target),$(flags))
     3116 local instcmd  := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(instdst),$(target),$(flags))
    31493117else ifdef $(target)_INSTALLER
    3150  local inscmd := $(call $(target)_INSTALLER,$(srcsrc),$(insdst),$(target),$(flags))
     3118 local stagecmd := $(call $(target)_INSTALLER,$(srcsrc),$(stagedst),$(target),$(flags))
     3119 local instcmd  := $(call $(target)_INSTALLER,$(srcsrc),$(instdst),$(target),$(flags))
    31513120else
    3152  local inscmd := $$(INSTALL)\
     3121 local stagecmd := $$(INSTALL)\
    31533122                $(if $(uid),-o $(uid))\
    31543123                $(if $(gid),-g $(gid))\
    31553124                $(if $(mode),-m $(mode))\
    31563125                $(flags) -- \
    3157                 $(srcsrc) $(insdst)
    3158 endif
    3159 
    3160 # generate the rule (need double evaluation here)
    3161 $(eval $(def_install_src_rule))
    3162 
    3163 INSTARGET_$(target) += $(insdst)
     3126                $(srcsrc) $(stagedst)
     3127 local instcmd := $$(INSTALL)\
     3128                $(if $(uid),-o $(uid))\
     3129                $(if $(gid),-g $(gid))\
     3130                $(if $(mode),-m $(mode))\
     3131                $(flags) -- \
     3132                $(srcsrc) $(instdst)
     3133endif
     3134
     3135# Generate the staging rule (requires double evaluation).
     3136$(eval $(def_install_src_rule_staging))
     3137$(target)_2_STAGE_TARGETS += $(stagedst)
     3138
     3139# Generate the install rule
     3140ifeq ($(insttype),both)
     3141 $(eval $(def_install_src_rule_installing))
     3142 $(target)_2_INST_TARGETS += $(instdst)
     3143endif
     3144
    31643145endef # def_install_src
    31653146$(eval-opt-var def_install_src)
    31663147
    31673148
    3168 ## generate the symlink rule
    3169 define def_install_symlink_rule
    3170 # the install rule
    3171 $(insdst) : | $(call DIRDEP,$(dir $(insdst)))
    3172         %$$(call MSG_INST_SYM,$(insdst),$(symdst))
     3149##
     3150# Generate the symlink rules.
     3151#
     3152define def_install_symlink_rule_staging
     3153$(stagedst) : | $(dir $(stagedst))
     3154        %$$(call MSG_INST_SYM,$(stagedst),$(symdst))
    31733155        $$(QUIET)$$(RM) -f -- $$@
    3174         $$(QUIET)$$(LN_SYMLINK) $(symdst) $(insdst)
    3175 endef # def_install_symlink_rule
    3176 $(eval-opt-var def_install_symlink_rule)
    3177 
    3178 ## create one symlink
     3156        $$(QUIET)$$(LN_SYMLINK) $(symdst) $(stagedst)
     3157endef
     3158$(eval-opt-var def_install_symlink_rule_staging)
     3159
     3160define def_install_symlink_rule_installing
     3161$(instdst) : | $(dir $(instdst))
     3162        %$$(call MSG_INST_SYM,$(instdst),$(symdst))
     3163        $$(QUIET)$$(RM) -f -- $$@
     3164        $$(QUIET)$$(LN_SYMLINK) $(symdst) $(instdst)
     3165endef
     3166$(eval-opt-var def_install_symlink_rule_installing)
     3167
     3168
     3169##
     3170# Create one symlink.
     3171#
    31793172define def_install_symlink
    31803173
     
    31843177local symdst := $(word $(words $(symdst)),$(symdst))
    31853178
    3186 # _INSTFUN
     3179# Calc destinations
    31873180ifdef $(symlnk)_INSTFUN
    31883181 local instfun := $(symlnk)_INSTFUN
    3189 else ifdef $(target)_INSTFUN
    3190  local instfun := $(target)_INSTFUN
    31913182else
    3192  local instfun := _INSTALL_FILE
    3193 endif
    3194 
    3195 # _INST
    3196 ifdef $(symlnk)_INST
    3197  local inst := $(patsubst %/,%,$($(symlnk)_INST))/$(dir $(symlnk))
    3198 else ifdef $(target)_INST
    3199  local inst := $(patsubst %/,%,$($(target)_INST))/$(dir $(symlnk))
    3200 else
    3201  local inst := $(dir $(symlnk))
    3202 endif
    3203 
    3204 # calc target
    3205 local insdst := $(call $(instfun),$(symlnk),$(target),$(inst),$(PATH_INS))
    3206 #$(warning symlnk=$(symlnk) symdst=$(symdst) insdst=$(insdst) instfun=$(instfun) inst='$(inst)')
    3207 
    3208 # generate the rule (need double evaluation here)
    3209 $(eval $(def_install_symlink_rule))
    3210 
    3211 INSTARGET_$(target) += $(insdst)
     3183 local instfun := $(top_instfun)
     3184endif
     3185
     3186local stage    := $(firstword $($(symlnk)_STAGE) $($(target)_1_STAGE))
     3187ifneq ($(substr $(stage),-1),/)
     3188 $(warning kBuild: Symlink $(symlnk) in install target $(target) has a STAGE property without a trailing slash.)
     3189 local stage   := $(stage)/
     3190endif
     3191local stage    := $(stage)/$(dir $(srcdstdir))
     3192local stagedst := $(call $(instfun),$(symlnk),$(target),$(stage),$(PATH_STAGE))
     3193
     3194local inst     := $(firstword $($(symlnk)_STAGE) $($(target)_1_STAGE))
     3195ifneq ($(substr $(inst),-1),/)
     3196 $(warning kBuild: Symlnk $(symlnk) in install target $(target) has a INST property without a trailing slash.)
     3197 local inst    := $(inst)/
     3198endif
     3199local inst     := $(inst)/$(dir $(srcdstdir))
     3200local instdst  := $(call $(instfun),$(symlnk),$(target),$(inst),$(PATH_INS))
     3201#$(warning symlnk=$(symlnk) symdst=$(symdst) instdst=$(instdst) stagedst=$(stagedst) instfun=$(instfun) inst=$(inst) stage='$(stage)')
     3202
     3203# Generate the staging rule (requires double evaluation).
     3204$(eval $(def_install_symlink_rule_staging))
     3205$(target)_2_STAGE_TARGETS += $(stagedst)
     3206
     3207# Generate the install rule.
     3208ifeq ($(instmode),both)
     3209 $(eval $(def_install_symlink_rule_installing))
     3210 $(target)_2_INST_TARGETS += $(instdst)
     3211endif
     3212
    32123213endef # def_install_symlink
    32133214$(optmize def_install_symlink)
    32143215
    32153216
    3216 ## generate the install rule
     3217##
     3218# Generate an directory installtion rule.
     3219# Note. Used both for staging and real install rules.
     3220#
    32173221define def_install_directory_rule
    32183222# the install rule
     
    32303234$(eval-opt-var def_install_directory_rule)
    32313235
    3232 
    3233 ## create one directory
     3236##
     3237# Create one directory.
     3238#
    32343239define def_install_directory
    32353240
    3236 # _INST
     3241# gather common properties.
    32373242ifdef $(directory)_INST
    3238  local inst := $(PATH_INS)/$(patsubst %/,%,$($(directory)_INST))
    3239 else ifdef $(target)_INST
    3240  local inst := $(PATH_INS)/$(patsubst %/,%,$($(target)_INST))
     3243 local inst := $($(directory)_INST)
    32413244else
    3242  local inst := $(PATH_INS)
     3245 local inst := $($(target)_1_INST)
     3246endif
     3247ifneq ($(substr $(inst),-1),/)
     3248 $(warning kBuild: Directory $(directory) in install target $(target) has a INST property without a trailing slash.)
     3249 local inst := $(inst)/
     3250endif
     3251ifdef $(directory)_STAGE
     3252 local stage := $($(directory)_STAGE)
     3253else
     3254 local stage := $($(target)_1_STAGE)
     3255endif
     3256ifneq ($(substr $(stage),-1),/)
     3257 $(warning kBuild: Directory $(directory) in install target $(target) has a INST property without a trailing slash.)
     3258 local stage := $(stage)/
    32433259endif
    32443260
     
    32503266        $($(directory)_MODE.$(bld_trg)) \
    32513267        $($(directory)_MODE) \
    3252         $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
    3253         $($(target)_MODE.$(bld_trg)) \
    3254         $($(target)_MODE))
     3268        $(top_mode) )
    32553269local uid := $(firstword \
    32563270        $($(target)_$(directory)_UID.$(bld_trg).$(bld_trg_arch)) \
     
    32603274        $($(directory)_UID.$(bld_trg)) \
    32613275        $($(directory)_UID) \
    3262         $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
    3263         $($(target)_UID.$(bld_trg)) \
    3264         $($(target)_UID))
     3276        $(top_uid) )
    32653277local gid := $(firstword \
    32663278        $($(target)_$(directory)_GID.$(bld_trg).$(bld_trg_arch)) \
     
    32703282        $($(directory)_GID.$(bld_trg)) \
    32713283        $($(directory)_GID) \
    3272         $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
    3273         $($(target)_GID.$(bld_trg)) \
    3274         $($(target)_GID))
     3284        $(top_gid) )
    32753285local flags := \
    3276         $($(target)_IDFLAGS)\
    3277         $($(target)_IDFLAGS.$(bld_trg)) \
    3278         $($(target)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
     3286        $(top_idflags) \
    32793287        $($(directory)_IDFLAGS) \
    32803288        $($(directory)_IDFLAGS.$(bld_trg)) \
     
    32823290        $($(target)_$(directory)_IDFLAGS) \
    32833291        $($(target)_$(directory)_IDFLAGS.$(bld_trg)) \
    3284         $($(target)_$(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch))
    3285 
    3286 local insdst := $(inst)/$(directory)/
    3287 #$(warning directory=$(directory) inst=$(inst) insdst=$(insdst) mode=$(mode) gid=$(gid) uid=$(uid))
    3288 
    3289 # generate the rule (need double evaluation here)
     3292        $($(target)_$(directory)_IDFLAGS.$(bld_trg).$(bld_trg_arch)) \
     3293 #$(warning directory=$(directory) inst=$(inst) stage=$(stage) mode=$(mode) gid=$(gid) uid=$(uid))
     3294
     3295# The staging rule (requires double evaluation).
     3296local insdst := $(PATH_STAGE)$(stage)$(directory)/
     3297$(target)_2_STAGE_DIR_TARGETS += $(insdst)
    32903298$(eval $(def_install_directory_rule))
    32913299
    3292 INSTARGET_DIRS_$(target) += $(insdst)
     3300# The install rule.
     3301ifeq ($(insttype),both)
     3302 local insdst := $(PATH_INS)$(inst)$(directory)/
     3303 $(target)_2_INST_DIR_TARGETS += $(insdst)
     3304 $(eval $(def_install_directory_rule))
     3305endif
     3306
    32933307endef # def_install_directory
    32943308$(eval-opt-var def_install_directory)
    32953309
    32963310
    3297 ## process one install target.
     3311##
     3312# Process one install target.
     3313#
    32983314define def_install
    32993315# the basics.
    3300 local bld_type  := $(firstword $($(target)_BLD_TYPE)     $(KBUILD_TYPE))
    3301 local bld_trg   := $(firstword $($(target)_BLD_TRG)      $(KBUILD_TARGET))
    3302 local bld_trg_arch:= $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
    3303 local bld_trg_cpu := $(firstword $($(target)_BLD_TRG_CPU)  $(KBUILD_TARGET_CPU))
    3304 
    3305 INSTARGET_$(target) := $($(target)_GOALS)
    3306 INSTARGET_DIRS_$(target) :=
    3307 local outbase := $(call TARGET_BASE,$(target),$(target))
     3316local bld_type     := $(firstword $($(target)_BLD_TYPE)     $(KBUILD_TYPE))
     3317local bld_trg      := $(firstword $($(target)_BLD_TRG)      $(KBUILD_TARGET))
     3318local bld_trg_arch := $(firstword $($(target)_BLD_TRG_ARCH) $(KBUILD_TARGET_ARCH))
     3319local bld_trg_cpu  := $(firstword $($(target)_BLD_TRG_CPU)  $(KBUILD_TARGET_CPU))
     3320local insttype     := $($(target)_1_INSTTYPE)
     3321
     3322ifneq ($(insttype),none)
     3323 $(target)_2_STAGE_TARGETS    := $($(target)_GOALS) $($(target)_STAGE_ONLY_GOALS)
     3324else
     3325 $(target)_2_STAGE_TARGETS    :=
     3326endif
     3327$(target)_2_STAGE_DIR_TARGETS :=
     3328
     3329ifeq ($(insttype),both)
     3330 $(target)_2_INST_TARGETS     := $($(target)_GOALS) $($(target)_INST_ONLY_GOALS)
     3331else
     3332 $(target)_2_INST_TARGETS     :=
     3333endif
     3334$(target)_2_INST_DIR_TARGETS  :=
     3335
     3336
     3337local outbase      := $(call TARGET_BASE,$(target),$(target))
    33083338$(target)_0_OUTDIR := $(patsubst %/,%,$(dir $(outbase)))
    33093339$(call KB_FN_ASSIGN_DEPRECATED,PATH_$(target),$($(target)_0_OUTDIR), $(target)_0_OUTDIR)
    33103340
    3311 local clean_files := $($(target)_CLEAN) $($(target)_CLEAN.$(bld_trg)) $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_arch)) $($(target)_CLEAN.$(bld_trg_cpu)) $($(target)_CLEAN.$(bld_type))
    3312 
    3313 $(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)), \
    3314         $(evalval def_install_directory))
    3315 
    3316 $(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)), \
    3317         $(evalval def_install_src))
    3318 
    3319 $(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)), \
    3320         $(evalval def_install_symlink))
    3321 
    3322 # the collection target
    3323 local clean_files  += $(PATH_TARGET)/$(target).ins
    3324 $(target)_1_TARGET := $(PATH_TARGET)/$(target).ins
    3325 $(call KB_FN_ASSIGN_DEPRECATED,TARGET_$(target),$($(target)_1_TARGET), $(target)_1_TARGET)
    3326 $($(target)_1_TARGET): $$(INSTARGET_$(target)) | $$(INSTARGET_DIRS_$(target)) $(call DIRDEP,$(PATH_TARGET))
     3341ifneq ($(insttype),none)
     3342 # cache top level target properties.
     3343 local top_mode := $(firstword \
     3344        $($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
     3345        $($(target)_MODE.$(bld_trg)) \
     3346        $($(target)_MODE) )
     3347 local top_uid := $(firstword \
     3348        $($(target)_UID.$(bld_trg).$(bld_trg_arch)) \
     3349        $($(target)_UID.$(bld_trg)) \
     3350        $($(target)_UID) )
     3351 local top_gid := $(firstword \
     3352        $($(target)_GID.$(bld_trg).$(bld_trg_arch)) \
     3353        $($(target)_GID.$(bld_trg)) \
     3354        $($(target)_GID) )
     3355 local top_ifflags := \
     3356        $($(target)_IFFLAGS) \
     3357        $($(target)_IFFLAGS.$(bld_trg)) \
     3358        $($(target)_IFFLAGS.$(bld_trg).$(bld_trg_arch)) \
     3359 local top_idflags := \
     3360        $($(target)_IDFLAGS) \
     3361        $($(target)_IDFLAGS.$(bld_trg)) \
     3362        $($(target)_IDFLAGS.$(bld_trg).$(bld_trg_arch))
     3363 ifdef $(target)_INSTFUN
     3364   local top_instfun := $(target)_INSTFUN
     3365 else
     3366   local top_instfun := _INSTALL_FILE
     3367 endif
     3368
     3369 $(foreach directory, \
     3370        $($(target)_DIRS) \
     3371        $($(target)_DIRS.$(bld_trg)) \
     3372        $($(target)_DIRS.$(bld_trg).$(bld_trg_arch)) \
     3373        $($(target)_DIRS.$(bld_trg_arch)) \
     3374        $($(target)_DIRS.$(bld_trg_cpu)) \
     3375        $($(target)_DIRS.$(bld_type)), \
     3376        $(evalval def_install_directory))
     3377
     3378 local clean_files  := \
     3379        $($(target)_CLEAN) \
     3380        $($(target)_CLEAN.$(bld_trg)) \
     3381        $($(target)_CLEAN.$(bld_trg).$(bld_trg_arch)) \
     3382        $($(target)_CLEAN.$(bld_trg_arch)) \
     3383        $($(target)_CLEAN.$(bld_trg_cpu)) \
     3384        $($(target)_CLEAN.$(bld_type))
     3385
     3386 $(foreach src,\
     3387        $($(target)_SOURCES) \
     3388        $($(target)_SOURCES.$(bld_trg)) \
     3389        $($(target)_SOURCES.$(bld_trg).$(bld_trg_arch)) \
     3390        $($(target)_SOURCES.$(bld_trg_arch)) \
     3391        $($(target)_SOURCES.$(bld_trg_cpu)) \
     3392        $($(target)_SOURCES.$(bld_type)), \
     3393        $(evalval def_install_src))
     3394
     3395 $(foreach src,\
     3396        $($(target)_SYMLINKS) \
     3397        $($(target)_SYMLINKS.$(bld_trg)) \
     3398        $($(target)_SYMLINKS.$(bld_trg).$(bld_trg_arch)) \
     3399        $($(target)_SYMLINKS.$(bld_trg_arch)) \
     3400        $($(target)_SYMLINKS.$(bld_trg_cpu)) \
     3401        $($(target)_SYMLINKS.$(bld_type)), \
     3402        $(evalval def_install_symlink))
     3403else # none
     3404 local clean_files  :=
     3405endif
     3406
     3407# The collection targets (staging only).
     3408local clean_files  += $($(target)_1_TARGET)
     3409$($(target)_1_TARGET): $$($(target)_2_STAGE_TARGETS) | $$($(target)_2_STAGE_DIR_TARGETS) $$(dir $$@)
    33273410        @$(QUIET2)$(APPEND) $@
    33283411
    33293412$(target): $$($(target)_1_TARGET)
    33303413
    3331 _INSTALLS += $($(target)_1_TARGET)
    3332 _INSTALLS_FILES += $(INSTARGET_$(target))
    3333 _INSTALLS_DIRS += $(INSTARGET_DIRS_$(target))
    3334 _CLEAN_FILES += $(clean_files)
    3335 _DIRS += $($(target)_0_OUTDIR) $($(target)_BLDDIRS) $($(target)_BLDDIRS.$(bld_trg)) $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_arch)) $($(target)_BLDDIRS.$(bld_trg_cpu)) $($(target)_BLDDIRS.$(bld_type))
     3414# Update Global lists.
     3415_INSTALLS       += $($(target)_1_TARGET)
     3416_STAGE_FILES    += $($(target)_2_STAGE_TARGETS)
     3417_STAGE_DIRS     += $($(target)_2_STAGE_DIR_TARGETS)
     3418_INSTALLS_FILES += $($(target)_2_INST_TARGETS)
     3419_INSTALLS_DIRS  += $($(target)_2_INST_DIR_TARGETS)
     3420_CLEAN_FILES    += $(clean_files)
     3421_DIRS           += \
     3422        $($(target)_0_OUTDIR) \
     3423        $($(target)_BLDDIRS) \
     3424        $($(target)_BLDDIRS.$(bld_trg)) \
     3425        $($(target)_BLDDIRS.$(bld_trg).$(bld_trg_arch)) \
     3426        $($(target)_BLDDIRS.$(bld_trg_arch)) \
     3427        $($(target)_BLDDIRS.$(bld_trg_cpu)) \
     3428        $($(target)_BLDDIRS.$(bld_type))
     3429
     3430# Deprecated properties.
     3431INSTARGET_$(target)      := $($(target)_2_STAGE_TARGETS)
     3432INSTARGET_DIRS_$(target) := $($(target)_2_STAGE_DIR_TARGETS)
     3433
    33363434endef # def_install
    33373435$(eval-opt-var def_install)
     
    33453443endif
    33463444
     3445#
    33473446# Some introspection targets that can be useful for package maintainers.
     3447#
    33483448.PHONY: kbuild-show-install-files kbuild-show-install-dirs
    33493449kbuild-show-install-files::
     
    33533453        $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_INS)/,,$(_INSTALLS_DIRS)))
    33543454
     3455kbuild-show-stage-files::
     3456        $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_STAGE)/,,$(_STAGE_FILES)))
     3457
     3458kbuild-show-stage-dirs::
     3459        $(addprefix $(NL)$(TAB)$(QUIET)$(ECHO) , $(subst $(PATH_STAGE)/,,$(_STAGE_DIRS)))
     3460
    33553461
    33563462#
    33573463# TESTING
    33583464#
    3359 _TESTING += $(TESTING) $(TESTING.$(KBUILD_TARGET)) $(TESTING.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(TESTING.$(KBUILD_TARGET_ARCH)) $(TESTING.$(KBUILD_TARGET_CPU))
     3465_TESTING += $(TESTING) \
     3466        $(TESTING.$(KBUILD_TARGET)) \
     3467        $(TESTING.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
     3468        $(TESTING.$(KBUILD_TARGET_ARCH)) \
     3469        $(TESTING.$(KBUILD_TARGET_CPU))
    33603470
    33613471
     
    33633473# PACKING
    33643474#
    3365 _PACKING += $(PACKING) $(PACKING.$(KBUILD_TARGET)) $(PACKING.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) $(PACKING.$(KBUILD_TARGET_ARCH)) $(PACKING.$(KBUILD_TARGET_CPU))
     3475_PACKING += $(PACKING) \
     3476        $(PACKING.$(KBUILD_TARGET)) \
     3477        $(PACKING.$(KBUILD_TARGET).$(KBUILD_TARGET_ARCH)) \
     3478        $(PACKING.$(KBUILD_TARGET_ARCH)) \
     3479        $(PACKING.$(KBUILD_TARGET_CPU))
    33663480
    33673481
     
    33743488# DIRECTORIES
    33753489#
    3376 _DIR_ALL := $(sort $(addsuffix /,$(patsubst %/,%,$(_DIRS))) $(dir $(_OUT_FILES) $(_OBJS) $(_INSTALLS_FILES)))
    3377 $(foreach directory,$(_INSTALLS_DIRS), $(eval _DIR_ALL := $(filter-out $(directory),$(_DIR_ALL))))
     3490_DIR_ALL := $(sort $(addsuffix /,$(patsubst %/,%,$(_DIRS))) $(dir $(_OUT_FILES) $(_OBJS) $(_INSTALLS_FILES) $(_STAGE_FILES)))
     3491$(foreach directory,$(_INSTALLS_DIRS) $(_STAGE_DIRS), $(eval _DIR_ALL := $(filter-out $(directory),$(_DIR_ALL))))
    33783492
    33793493
     
    34093523do-clean:
    34103524        %$(call MSG_CLEAN)
    3411         $(QUIET)$(RM) -f -- $(_OUT_FILES) $(_OBJS) $(_DEPFILES) $(_DEPFILES_INCLUDED) $(_CLEAN_FILES) $(OTHER_CLEAN)
    3412         $(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)))
     3525        $(QUIET)$(RM) -f -- \
     3526                $(_OUT_FILES) \
     3527                $(_OBJS) \
     3528                $(_DEPFILES) \
     3529                $(_DEPFILES_INCLUDED) \
     3530                $(_CLEAN_FILES) \
     3531                $(OTHER_CLEAN) \
     3532                $(_STAGE_FILES)
     3533        $(QUIET)$(RMDIR) -p --ignore-fail-on-non-empty --ignore-fail-on-not-exist -- \
     3534                $(rsort $(dir   $(_OUT_FILES) \
     3535                                $(_OBJS) \
     3536                                $(_DEPFILES) \
     3537                                $(_DEPFILES_INCLUDED) \
     3538                                $(_CLEAN_FILES) \
     3539                                $(OTHER_CLEAN))\
     3540                        $(_STAGE_DIRS) )
    34133541
    34143542
     
    36203748nothing: pass_nothing
    36213749
     3750.PHONY:  staging
     3751staging: pass_staging
     3752
    36223753.PHONY:  packing
    36233754packing: pass_packing
     
    36573788miscbins:  $$(_MISCBINS)
    36583789others:    $$(_OTHERS)
    3659 installs:  $$(_INSTALLS) $$(_INSTALLS_DIRS) $$(_INSTALLS_FILES)
     3790stagings:  $$(_INSTALLS) $$(_STAGE_DIRS) $$(_STAGE_FILES)
     3791installs:  $$(_INSTALLS_DIRS) $$(_INSTALLS_FILES)
    36603792
    36613793
     
    37173849# end-of-file-content
    37183850__footer_kmk__ := target
    3719 endif # __footer_kmk__
    3720 
     3851endif # !defined(__footer_kmk__)
     3852
Note: See TracChangeset for help on using the changeset viewer.