Index: /trunk/kBuild/footer.kmk
===================================================================
--- /trunk/kBuild/footer.kmk	(revision 2478)
+++ /trunk/kBuild/footer.kmk	(revision 2479)
@@ -130,4 +130,7 @@
 _DIRS     := $(PATH_TARGET)/ $(PATH_TARGET) $(BLDDIRS)
 _IMPORT_LIBS :=
+
+# Implicit targets added while processing other targets (usually by units).
+_ALL_INSTALLS_IMPLICIT :=
 
 # misc
@@ -2149,5 +2152,5 @@
 	$(pre_install_cmds)
 
-	$$(QUIET)$$(INSTALL) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $(out) $$@
+	$$(QUIET)$$(INSTALL_STAGING) $(if $(mode),-m $(mode)) $(if $(uid),-o $(uid)) $(if $(gid),-g $(gid)) -- $(out) $$@
 	$(post_install_cmds)
 
@@ -3023,11 +3026,13 @@
 local stagedst := $(call $(instfun),$(srcdst),$(target),$(stage),$(PATH_STAGE))
 
-local inst     := $(firstword $($(srcsrc)_INST) $($(target)_1_INST))
-ifneq ($(substr $(inst),-1),/)
- $(warning kBuild: File $(srcsrc) in install target $(target) has a INST property without a trailing slash.)
- local inst    := $(inst)/
-endif
-local inst     := $(inst)$(dir $(srcdstdir))
-local instdst  := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS))
+ifeq ($(insttype),both)
+ local inst     := $(firstword $($(srcsrc)_INST) $($(target)_1_INST))
+ ifneq ($(substr $(inst),-1),/)
+  $(warning kBuild: File $(srcsrc) in install target $(target) has a INST property without a trailing slash.)
+  local inst    := $(inst)/
+ endif
+ local inst     := $(inst)$(dir $(srcdstdir))
+ local instdst  := $(call $(instfun),$(srcdst),$(target),$(inst),$(PATH_INS))
+endif
 
 #$(warning instfun=$(instfun) srcdst=$(srcdst) target=$(target) inst=$(inst) => instdst=$(instdst); stage=$(stage) => stagedst=$(stagedst))
@@ -3117,13 +3122,11 @@
 endif
 
-# create the commands
+# Generate the staging rule (requires double evaluation).
 ifdef $(srcsrc)_INSTALLER
- local stagecmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(stagedst),$(target),$(flags))
- local instcmd  := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(instdst),$(target),$(flags))
+ local stagecmd := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(stagedst),$(target),$(flags),stage)
 else ifdef $(target)_INSTALLER
- local stagecmd := $(call $(target)_INSTALLER,$(srcsrc),$(stagedst),$(target),$(flags))
- local instcmd  := $(call $(target)_INSTALLER,$(srcsrc),$(instdst),$(target),$(flags))
+ local stagecmd := $(call $(target)_INSTALLER,$(srcsrc),$(stagedst),$(target),$(flags),stage)
 else
- local stagecmd := $$(INSTALL)\
+ local stagecmd := $$(INSTALL_STAGING)\
 		$(if $(uid),-o $(uid))\
 		$(if $(gid),-g $(gid))\
@@ -3131,13 +3134,5 @@
 		$(flags) -- \
 		$(srcsrc) $(stagedst)
- local instcmd := $$(INSTALL)\
-		$(if $(uid),-o $(uid))\
-		$(if $(gid),-g $(gid))\
-		$(if $(mode),-m $(mode))\
-		$(flags) -- \
-		$(srcsrc) $(instdst)
-endif
-
-# Generate the staging rule (requires double evaluation).
+endif
 $(eval $(def_install_src_rule_staging))
 $(target)_2_STAGE_TARGETS += $(stagedst)
@@ -3145,4 +3140,16 @@
 # Generate the install rule
 ifeq ($(insttype),both)
+ ifdef $(srcsrc)_INSTALLER
+  local instcmd  := $(call $(srcsrc)_INSTALLER,$(srcsrc),$(instdst),$(target),$(flags),install)
+ else ifdef $(target)_INSTALLER
+  local instcmd  := $(call $(target)_INSTALLER,$(srcsrc),$(instdst),$(target),$(flags),install)
+ else
+  local instcmd := $$(INSTALL)\
+  		$(if $(uid),-o $(uid))\
+  		$(if $(gid),-g $(gid))\
+  		$(if $(mode),-m $(mode))\
+  		$(flags) -- \
+  		$(srcsrc) $(instdst)
+ endif
  $(eval $(def_install_src_rule_installing))
  $(target)_2_INST_TARGETS += $(instdst)
@@ -3443,5 +3450,10 @@
 $(eval-opt-var def_install)
 
-## process all install targets
+## Do pass 1 on the implicit targets and add them to the list.
+$(foreach target, $(_ALL_INSTALLS_IMPLICIT), \
+	$(evalval def_pass1_install))
+_ALL_INSTALLS += $(_ALL_INSTALLS_IMPLICIT)
+
+## Do pass 2 on all install targets.
 $(foreach target, $(_ALL_INSTALLS), \
 	$(evalvalctx def_install))
Index: /trunk/kBuild/header.kmk
===================================================================
--- /trunk/kBuild/header.kmk	(revision 2478)
+++ /trunk/kBuild/header.kmk	(revision 2479)
@@ -391,4 +391,5 @@
 
 # Install directory layout.  Relative to PATH_INS.
+KBUILD_INST_PATHS   := BIN DLL SYS LIB DOC DEBUG SBIN LIBEXEC SHARE
 INST_BIN             = bin/
 if1of ($(KBUILD_TARGET), win)
@@ -419,4 +420,10 @@
 STAGE_LIBEXEC        = $(INST_LIBEXEC)
 STAGE_SHARE          = $(INST_SHARE)
+
+# Install and staging directory paths.
+$(foreach path, $(KBUILD_INST_PATHS), \
+	$(eval PATH_STAGE_$(path) = $$(patsubst %/,%,$$(PATH_STAGE)/$$(STAGE_$(path)))) \
+	$(eval PATH_INST_$(path) = $$(patsubst %/,%,$$(PATH_INS)/$$(INST_$(path)))) \
+)
 
 # Output directories.
@@ -689,4 +696,11 @@
 # Symlinking is problematic on some platforms...
 LN_SYMLINK  := $(LN) -s
+
+# When copying to the staging area, use hard links to save time and space.
+if1of ($(KMK_FEATURES), install-hard-linking)
+INSTALL_STAGING := $(INSTALL) --hard-link-files-when-possible
+else
+INSTALL_STAGING := $(INSTALL)
+endif
 
 
@@ -1246,6 +1260,12 @@
 endif
 $($(y)_$(x) := $(val)
+
+local val := $(strip $(PATH_$(y)_$(x)))
+ifeq ($(val),)
+ $(error kBuild: 'PATH_$(y)_$(x)' is set to an empty value.)
+endif
+PATH_$(y)_$(x) := $(val)
 endef
-$(foreach y, INST STAGE, $(foreach x, BIN DLL SYS LIB DOC SBIN LIBEXEC SHARE DEBUG, $(evalcall def_kbuild_finalize_inst)))
+$(foreach y, INST STAGE, $(foreach x, $(KBUILD_INST_PATHS), $(evalcall def_kbuild_finalize_inst)))
 
 
Index: /trunk/kBuild/units/qt3.kmk
===================================================================
--- /trunk/kBuild/units/qt3.kmk	(revision 2478)
+++ /trunk/kBuild/units/qt3.kmk	(revision 2479)
@@ -905,5 +905,5 @@
  	$($(target)_QT_TRANSLATIONS)
 ifneq ($(strip $(translations)),)
- local expr := _ALL_INSTALLS += $(target)-inst-nls
+ local expr := _ALL_INSTALLS_IMPLICIT += $(target)-inst-nls
  $(eval $(expr))
  ifdef $(target)_QT_TRANSLATIONS_TEMPLATE
Index: /trunk/kBuild/units/qt4.kmk
===================================================================
--- /trunk/kBuild/units/qt4.kmk	(revision 2478)
+++ /trunk/kBuild/units/qt4.kmk	(revision 2479)
@@ -1032,5 +1032,5 @@
  	$($(target)_QT_TRANSLATIONS)
 ifneq ($(strip $(translations)),)
- local expr := _ALL_INSTALLS += $(target)-inst-nls/
+ local expr := _ALL_INSTALLS_IMPLICIT += $(target)-inst-nls
  $(eval $(expr))
  ifdef $(target)_QT_TRANSLATIONS_TEMPLATE
