Index: trunk/kBuild/footer-pass2-compiling-targets.kmk
===================================================================
--- trunk/kBuild/footer-pass2-compiling-targets.kmk	(revision 2536)
+++ trunk/kBuild/footer-pass2-compiling-targets.kmk	(revision 2537)
@@ -286,103 +286,4 @@
 $(eval-opt-var def_target_sources)
 
-
-##
-# Function for getting the first defined propert value.
-#
-# @param   1            The property name.
-# @param   2            The default property name, empty if none.
-# @param   3            What to return if all variables are empty. (optional)
-# @note    Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
-# @returns Expanded property value.
-#
-define def_fn_prop_get_first_defined
-local .RETURN := $(firstdefined \
-    $(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type) \
-    $(target)_$(1).$(bld_trg).$(bld_trg_arch) \
-    $(target)_$(1).$(bld_trg).$(bld_type) \
-    $(target)_$(1).$(bld_trg_cpu) \
-    $(target)_$(1).$(bld_trg_arch) \
-    $(target)_$(1).$(bld_trg) \
-    $(target)_$(1).$(bld_type) \
-    $(target)_$(1) \
-)
-ifeq ($(.RETURN),)
- ifneq ($(2),)
-  local .RETURN := $(firstdefined \
-    $(2).$(bld_trg).$(bld_trg_arch).$(bld_type) \
-    $(2).$(bld_trg).$(bld_trg_arch) \
-    $(2).$(bld_trg).$(bld_type) \
-    $(2).$(bld_trg_cpu) \
-    $(2).$(bld_trg_arch) \
-    $(2).$(bld_trg) \
-    $(2).$(bld_type) \
-    $(2) \
-    3 \
-  )
- else
-  local .RETURN := $(firstdefined \
-    kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type) \
-    kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch) \
-    kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_type) \
-    kBuildGlobalDefaults_$(1).$(bld_trg_cpu) \
-    kBuildGlobalDefaults_$(1).$(bld_trg_arch) \
-    kBuildGlobalDefaults_$(1).$(bld_trg) \
-    kBuildGlobalDefaults_$(1).$(bld_type) \
-    kBuildGlobalDefaults_$(1) \
-    3 \
-  )
- endif
-endif
-local .RETURN := $(strip $($(.RETURN)))
-endef # def_fn_prop_get_first_defined
-
-##
-# Function for getting the first property value (ignoring empty defines).
-#
-# @param   1            The property name.
-# @param   2            The default property name, empty if none.
-# @param   3            What to return if all variables are empty. (optional)
-# @note    Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
-# @returns First word.
-#
-define def_fn_prop_get_first_word
-local .RETURN := $(firstword \
-    $($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
-    $($(target)_$(1).$(bld_trg).$(bld_trg_arch)) \
-    $($(target)_$(1).$(bld_trg).$(bld_type)) \
-    $($(target)_$(1).$(bld_trg_cpu)) \
-    $($(target)_$(1).$(bld_trg_arch)) \
-    $($(target)_$(1).$(bld_trg)) \
-    $($(target)_$(1).$(bld_type)) \
-    $($(target)_$(1)) \
-)
-ifeq ($(.RETURN),)
- ifneq ($(2),)
-  local .RETURN := $(firstword \
-    $($(2).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
-    $($(2).$(bld_trg).$(bld_trg_arch)) \
-    $($(2).$(bld_trg).$(bld_type)) \
-    $($(2).$(bld_trg_cpu)) \
-    $($(2).$(bld_trg_arch)) \
-    $($(2).$(bld_trg)) \
-    $($(2).$(bld_type)) \
-    $($(2)) \
-    $(3) \
-  )
- else
-  local .RETURN := $(firstword \
-    $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
-    $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch)) \
-    $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_type)) \
-    $(kBuildGlobalDefaults_$(1).$(bld_trg_cpu)) \
-    $(kBuildGlobalDefaults_$(1).$(bld_trg_arch)) \
-    $(kBuildGlobalDefaults_$(1).$(bld_trg)) \
-    $(kBuildGlobalDefaults_$(1).$(bld_type)) \
-    $(kBuildGlobalDefaults_$(1)) \
-    $(3) \
-  )
- endif
-endif
-endef # def_fn_prop_get_first_word
 
 ##
Index: trunk/kBuild/footer-pass2-installs.kmk
===================================================================
--- trunk/kBuild/footer-pass2-installs.kmk	(revision 2536)
+++ trunk/kBuild/footer-pass2-installs.kmk	(revision 2537)
@@ -45,5 +45,7 @@
 $(stagedst) : $(srcsrc) | $(dir $(stagedst))
 	%$$(call MSG_INST_FILE,$(srcsrc),$(stagedst))
+	$(top_pre_file_cmds)
 	$$(QUIET)$(stagecmd)
+	$(top_post_file_cmds)
 endef
 $(eval-opt-var def_install_src_rule_staging)
@@ -54,5 +56,7 @@
 $(instdst) : $(srcsrc) | $(dir $(instdst))
 	%$$(call MSG_INST_FILE,$(srcsrc),$(instdst))
+	$(top_pre_file_cmds)
 	$$(QUIET)$(instcmd)
+	$(top_post_file_cmds)
 endef
 $(eval-opt-var def_install_src_rule_installing)
@@ -245,5 +249,7 @@
 	%$$(call MSG_INST_SYM,$(stagedst),$(symdst))
 	$$(QUIET)$$(RM) -f -- $$@
+	$(top_pre_sym_cmds)
 	$$(QUIET)$$(LN_SYMLINK) $(symdst) $(stagedst)
+	$(top_post_sym_cmds)
 endef
 $(eval-opt-var def_install_symlink_rule_staging)
@@ -254,5 +260,7 @@
 	%$$(call MSG_INST_SYM,$(instdst),$(symdst))
 	$$(QUIET)$$(RM) -f -- $$@
+	$(top_pre_sym_cmds)
 	$$(QUIET)$$(LN_SYMLINK) $(symdst) $(instdst)
+	$(top_post_sym_cmds)
 endef
 $(eval-opt-var def_install_symlink_rule_installing)
@@ -331,4 +339,5 @@
 $(insdst):
 	%$$(call MSG_INST_DIR,$(insdst))
+	$(top_pre_dir_cmds)
 	$$(QUIET)$$(INSTALL) -d \
 		$(if $(uid),-o $(uid))\
@@ -337,4 +346,5 @@
 		$(flags) -- \
 		$(insdst)
+	$(top_post_dir_cmds)
 
 .NOTPARALLEL: $(insdst)
@@ -452,5 +462,5 @@
 
 ifneq ($(insttype),none)
- # cache top level target properties.
+ # Cache top level target properties.
  local top_mode := $(firstword \
  	$($(target)_MODE.$(bld_trg).$(bld_trg_arch)) \
@@ -482,4 +492,11 @@
    local top_instfun := _INSTALL_FILE
  endif
+ # The user have to use double expansion and can only use the above locals. Not 100% optimal...
+ local top_pre_file_cmds  := $(evalcall def_fn_prop_get_first_defined,PRE_XFILE_CMDS)
+ local top_post_file_cmds := $(evalcall def_fn_prop_get_first_defined,POST_XFILE_CMDS)
+ local top_pre_sym_cmds   := $(evalcall def_fn_prop_get_first_defined,PRE_SYMLINK_CMDS)
+ local top_post_sym_cmds  := $(evalcall def_fn_prop_get_first_defined,POST_SYMLINK_CMDS)
+ local top_pre_dir_cmds   := $(evalcall def_fn_prop_get_first_defined,PRE_DIRECTORY_CMDS)
+ local top_post_dir_cmds  := $(evalcall def_fn_prop_get_first_defined,POST_DIRECTORY_CMDS)
 
  $(foreach directory, \
Index: trunk/kBuild/footer.kmk
===================================================================
--- trunk/kBuild/footer.kmk	(revision 2536)
+++ trunk/kBuild/footer.kmk	(revision 2537)
@@ -209,5 +209,107 @@
 
 
-
+##
+# Function for getting the first defined propert value.
+#
+# @param   1            The property name.
+# @param   2            The default property name, empty if none.
+# @param   3            What to return if all variables are empty. (optional)
+# @note    Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
+# @returns Expanded property value.
+#
+define def_fn_prop_get_first_defined
+local .RETURN := $(firstdefined \
+    $(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type) \
+    $(target)_$(1).$(bld_trg).$(bld_trg_arch) \
+    $(target)_$(1).$(bld_trg).$(bld_type) \
+    $(target)_$(1).$(bld_trg_cpu) \
+    $(target)_$(1).$(bld_trg_arch) \
+    $(target)_$(1).$(bld_trg) \
+    $(target)_$(1).$(bld_type) \
+    $(target)_$(1) \
+)
+ifeq ($(.RETURN),)
+ ifneq ($(2),)
+  local .RETURN := $(firstdefined \
+    $(2).$(bld_trg).$(bld_trg_arch).$(bld_type) \
+    $(2).$(bld_trg).$(bld_trg_arch) \
+    $(2).$(bld_trg).$(bld_type) \
+    $(2).$(bld_trg_cpu) \
+    $(2).$(bld_trg_arch) \
+    $(2).$(bld_trg) \
+    $(2).$(bld_type) \
+    $(2) \
+    3 \
+  )
+ else
+  local .RETURN := $(firstdefined \
+    kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type) \
+    kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch) \
+    kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_type) \
+    kBuildGlobalDefaults_$(1).$(bld_trg_cpu) \
+    kBuildGlobalDefaults_$(1).$(bld_trg_arch) \
+    kBuildGlobalDefaults_$(1).$(bld_trg) \
+    kBuildGlobalDefaults_$(1).$(bld_type) \
+    kBuildGlobalDefaults_$(1) \
+    3 \
+  )
+ endif
+endif
+local .RETURN := $(strip $($(.RETURN)))
+endef # def_fn_prop_get_first_defined
+
+##
+# Function for getting the first property value (ignoring empty defines).
+#
+# @param   1            The property name.
+# @param   2            The default property name, empty if none.
+# @param   3            What to return if all variables are empty. (optional)
+# @note    Implicit parameters: target, bld_trg, bld_trg_arch, bld_trg_cpu, bld_type.
+# @returns First word.
+#
+define def_fn_prop_get_first_word
+local .RETURN := $(firstword \
+    $($(target)_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+    $($(target)_$(1).$(bld_trg).$(bld_trg_arch)) \
+    $($(target)_$(1).$(bld_trg).$(bld_type)) \
+    $($(target)_$(1).$(bld_trg_cpu)) \
+    $($(target)_$(1).$(bld_trg_arch)) \
+    $($(target)_$(1).$(bld_trg)) \
+    $($(target)_$(1).$(bld_type)) \
+    $($(target)_$(1)) \
+)
+ifeq ($(.RETURN),)
+ ifneq ($(2),)
+  local .RETURN := $(firstword \
+    $($(2).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+    $($(2).$(bld_trg).$(bld_trg_arch)) \
+    $($(2).$(bld_trg).$(bld_type)) \
+    $($(2).$(bld_trg_cpu)) \
+    $($(2).$(bld_trg_arch)) \
+    $($(2).$(bld_trg)) \
+    $($(2).$(bld_type)) \
+    $($(2)) \
+    $(3) \
+  )
+ else
+  local .RETURN := $(firstword \
+    $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch).$(bld_type)) \
+    $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_trg_arch)) \
+    $(kBuildGlobalDefaults_$(1).$(bld_trg).$(bld_type)) \
+    $(kBuildGlobalDefaults_$(1).$(bld_trg_cpu)) \
+    $(kBuildGlobalDefaults_$(1).$(bld_trg_arch)) \
+    $(kBuildGlobalDefaults_$(1).$(bld_trg)) \
+    $(kBuildGlobalDefaults_$(1).$(bld_type)) \
+    $(kBuildGlobalDefaults_$(1)) \
+    $(3) \
+  )
+ endif
+endif
+endef # def_fn_prop_get_first_word
+
+
+#
+# The main body.
+#
 include $(KBUILD_PATH)/footer-inherit-uses-tools.kmk
 include $(KBUILD_PATH)/footer-pass1.kmk
@@ -218,4 +320,5 @@
 include $(KBUILD_PATH)/footer-misc.kmk
 include $(KBUILD_PATH)/footer-passes.kmk
+
 
 #
Index: trunk/kBuild/header.kmk
===================================================================
--- trunk/kBuild/header.kmk	(revision 2536)
+++ trunk/kBuild/header.kmk	(revision 2537)
@@ -970,5 +970,7 @@
 # This list of non-accumulative target properties which are or may be
 # functions, and thus should not be expanded until the very last moment.
-PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS PRE_INST_CMDS POST_INST_CMDS NAME SONAME
+PROPS_DEFERRED := INSTFUN INSTALLER PRE_CMDS POST_CMDS PRE_INST_CMDS POST_INST_CMDS \
+	PRE_FILE_CMDS POST_FILE_CMDS PRE_SYMLINK_CMDS POST_SYMLINK_CMDS PRE_DIRECTORY_CMDS POST_DIRECTORY_CMDS \
+	NAME SONAME
 
 ## PROPS_ACCUMULATE_R
@@ -1065,5 +1067,6 @@
 ## @{
 PROPS_INSTALLS_SINGLE        := TOOL TEMPLATE INST NOINST BLD_TYPE BLD_TRG BLD_TRG_ARCH BLD_TRG_CPU MODE UID GID
-PROPS_INSTALLS_DEFERRED      := INSTFUN INSTALLER
+PROPS_INSTALLS_DEFERRED      := INSTFUN INSTALLER PRE_FILE_CMDS POST_FILE_CMDS PRE_SYMLINK_CMDS POST_SYMLINK_CMDS \
+	PRE_DIRECTORY_CMDS POST_DIRECTORY_CMDS
 PROPS_INSTALLS_ACCUMULATE_R  := DEPS ORDERDEPS GOALS INST_ONLY_GOALS STAGE_ONLY_GOALS IFFLAGS EXEC_IFFLAGS
 PROPS_INSTALLS_ACCUMULATE_L  := SOURCES EXEC_SOURCES DIRS CLEAN
