Index: /trunk/kBuild/footer-pass2-compiling-targets.kmk
===================================================================
--- /trunk/kBuild/footer-pass2-compiling-targets.kmk	(revision 3159)
+++ /trunk/kBuild/footer-pass2-compiling-targets.kmk	(revision 3160)
@@ -47,10 +47,4 @@
 else
  _DEP_COMPILE_CMDS =
-endif
-
-
-## Temporary for the compile rule below.
-if "$(KBUILD_KMK_REVISION)" >= 3134
- KBUILD_HAVE_OPTIMIZED_APPEND := 1
 endif
 
Index: /trunk/kBuild/header.kmk
===================================================================
--- /trunk/kBuild/header.kmk	(revision 3159)
+++ /trunk/kBuild/header.kmk	(revision 3160)
@@ -971,4 +971,9 @@
 #
 
+## Temporary for the compile rule below.
+if "$(KBUILD_KMK_REVISION)" >= 3134
+ KBUILD_HAVE_OPTIMIZED_APPEND := 1
+endif
+
 ##
 # Advanced version of KB_FN_AUTO_CMD_DEPS_COMMANDS_EX where you set
@@ -978,10 +983,19 @@
 #
 # @param 1    dep file.
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+define KB_FN_AUTO_CMD_DEPS_COMMANDS_EX
+	%$(QUIET2)$(APPEND) -tin "$1" \
+		'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS' \
+       	'--insert-command=$@' \
+       	'endef'
+endef
+else
 define KB_FN_AUTO_CMD_DEPS_COMMANDS_EX
 	%$(QUIET2)$(RM) -f -- "$1"
-       %$(QUIET2)$(APPEND) "$1" 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS'
-       %$(QUIET2)$(APPEND) -c "$1"  '$@'
-       %$(QUIET2)$(APPEND) "$1" 'endef'
+	%$(QUIET2)$(APPEND) "$1" 'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS'
+	%$(QUIET2)$(APPEND) -c "$1"  '$@'
+	%$(QUIET2)$(APPEND) "$1" 'endef'
 endef
+endif
 
 ##
@@ -996,4 +1010,12 @@
 # automatically generate command dependencies.
 # After or before the recipe do $(call KB_FN_AUTO_CMD_DEPS,<recipe-target>).
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+define KB_FN_AUTO_CMD_DEPS_COMMANDS
+	%$(QUIET2)$(APPEND) -tni "$@.auto-dep" \
+		'define AUTO_CMD_DEP_$(translate $@,:,_)_PREV_CMDS' \
+		'--insert-command="$@" \
+		'endef'
+endef
+else
 define KB_FN_AUTO_CMD_DEPS_COMMANDS
 	%$(QUIET2)$(RM) -f -- "$@.auto-dep"
@@ -1002,4 +1024,5 @@
        %$(QUIET2)$(APPEND) "$@.auto-dep" 'endef'
 endef
+endif
 
 ##
Index: /trunk/kBuild/units/dtrace.kmk
===================================================================
--- /trunk/kBuild/units/dtrace.kmk	(revision 3159)
+++ /trunk/kBuild/units/dtrace.kmk	(revision 3160)
@@ -76,8 +76,15 @@
 
 ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+	%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+		'define $(target)_$(subst :,_,$(source))_DTRACE_HDR_CMDS_PREV_' \
+		'--insert-command=$(out)' \
+		'endef'
+else
 	%$$(QUIET2)$$(APPEND) '$(dep)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_DTRACE_HDR_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
 endif
 
@@ -110,8 +117,15 @@
 
 ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+	%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+		'define $(target)_$(subst :,_,$(source))_DTRACE_OBJ_CMDS_PREV_' \
+		'--insert-command=$(out)' \
+		'endef'
+else
 	%$$(QUIET2)$$(APPEND) '$(dep)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_DTRACE_OBJ_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
 endif
 
Index: /trunk/kBuild/units/lex.kmk
===================================================================
--- /trunk/kBuild/units/lex.kmk	(revision 3159)
+++ /trunk/kBuild/units/lex.kmk	(revision 3160)
@@ -72,8 +72,15 @@
 
 ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+	%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+		'define $(target)_$(subst :,_,$(source))_LEX_CMDS_PREV_' \
+		'--insert-command=$(out)' \
+		'endef'
+else
 	%$$(QUIET2)$$(APPEND) '$(dep)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_LEX_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
 endif
 
Index: /trunk/kBuild/units/qt5.kmk
===================================================================
--- /trunk/kBuild/units/qt5.kmk	(revision 3159)
+++ /trunk/kBuild/units/qt5.kmk	(revision 3160)
@@ -455,7 +455,7 @@
 		-o $(out)\
 		$(source)
-	$(QUIET2)$(APPEND) $(dep) '\'
-	$(QUIET2)$(APPEND) $(dep) '$(out): \'
-	$(QUIET2)$(APPEND) $(dep) '$(source) \'
+	$(QUIET2)$(APPEND) -n $(dep) '\' \
+		'$(out): \' \
+		'$(source) \'
 	$(QUIET2)$(SED) \
 		-e '/^[[:blank:]]*<file[[:blank:]][^>]*>/!d' \
@@ -533,8 +533,15 @@
 
 ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+	%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+		'define $(target)_$(subst :,_,$(source))_QT5_LRC_CMDS_PREV_' \
+		'--insert-command=$(out)' \
+		'endef'
+else
 	%$$(QUIET2)$$(APPEND) '$(dep)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_LRC_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
 endif
 
@@ -621,8 +628,15 @@
 	$(QUIET)$(CP) --changed -f $(out) $(realout)
 ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+	%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+		'define $(target)_$(subst :,_,$(source))_QT5_RCC_CMDS_PREV_' \
+		'--insert-command=$(out)' \
+		'endef'
+else
 	%$$(QUIET2)$$(APPEND) '$(dep)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_RCC_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
 endif
 
@@ -708,8 +722,15 @@
 	$(QUIET)$(CP) --changed -f $(out) $(realout)
 ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+	%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+		'define $(target)_$(subst :,_,$(source))_QT5_UIC_CMDS_PREV_' \
+		'--insert-command=$(out)' \
+		'endef'
+else
 	%$$(QUIET2)$$(APPEND) '$(dep)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_UIC_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
 endif
 
@@ -794,8 +815,15 @@
 	$(QUIET)$(CP) --changed -f $(out) $(realout)
 ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+	%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+		'define $(target)_$(subst :,_,$(source))_QT5_MOC_HPP_CMDS_PREV_' \
+		'--insert-command=$(out)' \
+		'endef'
+else
 	%$$(QUIET2)$$(APPEND) '$(dep)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_MOC_HPP_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
 endif
 
@@ -887,8 +915,15 @@
 	$(QUIET)$(CP) --changed -f $(out) $(realout)
 ifndef NO_COMPILE_CMDS_DEPS
+ifdef KBUILD_HAVE_OPTIMIZED_APPEND
+	%$$(QUIET2)$$(APPEND) -ni '$(dep)' \
+		'define $(target)_$(subst :,_,$(source))_QT5_MOC_CPP_CMDS_PREV_' \
+		'--insert-command=$(out)' \
+		'endef'
+else
 	%$$(QUIET2)$$(APPEND) '$(dep)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_MOC_CPP_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
+endif
 endif
 
