[Pkg-virtualbox-commits] [kbuild] 02/05: Imported Upstream version 0.1.9998svn2813+dfsg

Gianfranco Costamagna locutusofborg-guest at moszumanska.debian.org
Mon Mar 14 08:44:08 UTC 2016


This is an automated email from the git hooks/post-receive script.

locutusofborg-guest pushed a commit to branch master
in repository kbuild.

commit d98a48f487fca4063df108dbc78ce28b819ffad9
Author: Gianfranco Costamagna <costamagnagianfranco at yahoo.it>
Date:   Mon Mar 14 09:33:00 2016 +0100

    Imported Upstream version 0.1.9998svn2813+dfsg
---
 kBuild/header.kmk                 |   6 +-
 kBuild/tools/NASM.kmk             |  12 +-
 kBuild/units/qt3.kmk              |   8 +-
 kBuild/units/qt4.kmk              |   8 +-
 kBuild/units/{qt4.kmk => qt5.kmk} | 604 +++++++++++++++++++-------------------
 src/kash/shinstance.c             |   6 +-
 src/kmk/kmk_cc_exec.c             | 386 ++++++++++++++++++------
 src/kmk/kmkbuiltin/kDepObj.c      |   3 +-
 src/kmk/kmkbuiltin/redirect.c     | 110 +++++--
 9 files changed, 710 insertions(+), 433 deletions(-)

diff --git a/kBuild/header.kmk b/kBuild/header.kmk
index ecf0a9f..44ce7c2 100644
--- a/kBuild/header.kmk
+++ b/kBuild/header.kmk
@@ -1,4 +1,4 @@
-# $Id: header.kmk 2796 2015-09-15 23:36:00Z bird $
+# $Id: header.kmk 2813 2016-03-13 12:56:18Z bird $
 ## @file
 # kBuild - File included at top of a makefile.
 #
@@ -79,7 +79,7 @@ endif
 # The revision in which this file was last modified.
 # This can be useful when using development versions of kBuild.
 #
-KMK_REVISION := $(patsubst %:,,  $Rev: 2796 $  )
+KMK_REVISION := $(patsubst %:,,  $Rev: 2813 $  )
 
 
 #
@@ -189,7 +189,7 @@ KBUILD_BLD_TYPES := release profile debug
 # build types. (PORTME)
 #
 KBUILD_OSES      := darwin dos dragonfly freebsd haiku l4 linux netbsd nt openbsd os2 solaris win os-agnostic
-KBUILD_ARCHES    := x86 amd64 sparc32 sparc64 s390 s390x ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha
+KBUILD_ARCHES    := x86 amd64 sparc32 sparc64 s390 s390x ppc32 ppc64 mips32 mips64 ia64 hppa32 hppa64 arm alpha noarch
 KBUILD_ARCHES_64 := amd64 sparc64 s390x ppc64 mips64 ia64 hppa64 alpha
 KBUILD_ARCHES_32 := x86 sparc32 s390 ppc32 mips32 hppa32 arm
 
diff --git a/kBuild/tools/NASM.kmk b/kBuild/tools/NASM.kmk
index 41e4512..5dcda22 100644
--- a/kBuild/tools/NASM.kmk
+++ b/kBuild/tools/NASM.kmk
@@ -1,4 +1,4 @@
-# $Id: NASM.kmk 2750 2015-01-23 12:24:02Z bird $
+# $Id: NASM.kmk 2808 2016-01-30 15:13:32Z bird $
 ## @file
 # kBuild Tool Config - Netwide Assembler v0.98+.
 #
@@ -35,9 +35,9 @@ TOOL_NASM := Netwide Assembler v0.98+
 
 # Tool Specific Properties
 ifndef PATH_TOOL_NASM
- PATH_TOOL_NASM := $(sort $(wildcard $(KBUILD_DEVTOOLS_HST)/nasm/v*.*))
- ifneq ($(PATH_TOOL_NASM),)
-  PATH_TOOL_NASM := $(call lastword,$(PATH_TOOL_NASM))
+ PATH_TOOL_NASM := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/nasm/v*.*)))
+ if "$(PATH_TOOL_NASM)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
+  PATH_TOOL_NASM := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/nasm/v*.*)))
  endif
 else
  # Resolve any fancy stuff once and for all.
@@ -76,11 +76,11 @@ define TOOL_NASM_COMPILE_AS_CMDS
 		-l $(outbase).lst\
 		-o $(obj)\
 		$(abspath $(source))
-	$(QUIET)$(REDIRECT) -wo $(dep) -- $(TOOL_NASM_AS)\
+	$(QUIET)$(REDIRECT) -C $(PATH_OUT_BASE) -wo $(dep) -- $(TOOL_NASM_AS) -DKBUILD_GENERATING_MAKEFILE_DEPENDENCIES\
 		$(flags) $(addsuffix /,$(addprefix -i, $(incs))) $(addprefix -D, $(defs))\
 		-l $(outbase).lst\
 		-o $(obj)\
 		$(abspath $(source)) \
-		-M
+		-M -MP
 endef
 
diff --git a/kBuild/units/qt3.kmk b/kBuild/units/qt3.kmk
index 6e790e8..df70205 100644
--- a/kBuild/units/qt3.kmk
+++ b/kBuild/units/qt3.kmk
@@ -1,10 +1,10 @@
-# $Id: qt3.kmk 2726 2014-02-26 23:23:54Z bird $
+# $Id: qt3.kmk 2805 2016-01-28 11:08:44Z bird $
 ## @file
 # Qt 3.3.x unit.
 #
 
 #
-# Copyright (c) 2008-2014 knut st. osmundsen <bird-kBuild-spam-xiv at anduin.net>
+# Copyright (c) 2008-2016 knut st. osmundsen <bird-kBuild-spam-xiv at anduin.net>
 #
 # This file is part of kBuild.
 #
@@ -38,8 +38,8 @@ endif
 UNIT_qt3 = qt3
 
 
-ifndef UNIT_qt4
- # Add our target properties (same as qt4).
+if !defined(UNIT_qt4) && !defined(UNIT_qt5)
+ # Add our target properties (same as qt4 & qt5).
  PROPS_SINGLE += QTTOOL MOCTOOL UICTOOL LRCTOOL QT_TRANSLATIONS_INST QT_TRANSLATIONS_TEMPLATE QT_PREFIX
  PROPS_ACCUMULATE_R += MOCDEFS MOCFLAGS UICFLAGS LRCFLAGS QT_TRANSLATIONS QT_MOCSRCS QT_MOCHDRS
 endif
diff --git a/kBuild/units/qt4.kmk b/kBuild/units/qt4.kmk
index b812984..dde5991 100644
--- a/kBuild/units/qt4.kmk
+++ b/kBuild/units/qt4.kmk
@@ -1,10 +1,10 @@
-# $Id: qt4.kmk 2787 2015-08-13 09:16:00Z bird $
+# $Id: qt4.kmk 2805 2016-01-28 11:08:44Z bird $
 ## @file
 # Qt 4 unit.
 #
 
 #
-# Copyright (c) 2008-2014 knut st. osmundsen <bird-kBuild-spam-xiv at anduin.net>
+# Copyright (c) 2008-2016 knut st. osmundsen <bird-kBuild-spam-xiv at anduin.net>
 #
 # This file is part of kBuild.
 #
@@ -38,8 +38,8 @@ endif
 UNIT_qt4 = qt4
 
 
-ifndef UNIT_qt3
- # Add our target properties (same as qt3).
+if !defined(UNIT_qt3) && !defined(UNIT_qt5)
+ # Add our target properties (same as qt3 & qt5).
  PROPS_SINGLE += QTTOOL MOCTOOL UICTOOL LRCTOOL QT_TRANSLATIONS_INST QT_TRANSLATIONS_TEMPLATE QT_PREFIX
  PROPS_ACCUMULATE_R += MOCDEFS MOCFLAGS UICFLAGS LRCFLAGS QT_TRANSLATIONS QT_MOCSRCS QT_MOCHDRS
 endif
diff --git a/kBuild/units/qt4.kmk b/kBuild/units/qt5.kmk
similarity index 64%
copy from kBuild/units/qt4.kmk
copy to kBuild/units/qt5.kmk
index b812984..5334910 100644
--- a/kBuild/units/qt4.kmk
+++ b/kBuild/units/qt5.kmk
@@ -1,10 +1,10 @@
-# $Id: qt4.kmk 2787 2015-08-13 09:16:00Z bird $
+# $Id: qt5.kmk 2807 2016-01-28 13:21:41Z bird $
 ## @file
-# Qt 4 unit.
+# Qt 5 unit.
 #
 
 #
-# Copyright (c) 2008-2014 knut st. osmundsen <bird-kBuild-spam-xiv at anduin.net>
+# Copyright (c) 2008-2016 knut st. osmundsen <bird-kBuild-spam-xiv at anduin.net>
 #
 # This file is part of kBuild.
 #
@@ -32,14 +32,14 @@
 #
 
 
-ifdef UNIT_qt4
- $(error kBuild: The qt4 unit was included twice!)
+ifdef UNIT_qt5
+ $(error kBuild: The qt5 unit was included twice!)
 endif
-UNIT_qt4 = qt4
+UNIT_qt5 = qt5
 
 
-ifndef UNIT_qt3
- # Add our target properties (same as qt3).
+if !defined(UNIT_qt3) && !defined(UNIT_qt4)
+ # Add our target properties (same as qt3 & qt4).
  PROPS_SINGLE += QTTOOL MOCTOOL UICTOOL LRCTOOL QT_TRANSLATIONS_INST QT_TRANSLATIONS_TEMPLATE QT_PREFIX
  PROPS_ACCUMULATE_R += MOCDEFS MOCFLAGS UICFLAGS LRCFLAGS QT_TRANSLATIONS QT_MOCSRCS QT_MOCHDRS
 endif
@@ -50,137 +50,137 @@ PROPS_ACCUMULATE_R += RCCFLAGS QT_MODULES
 ## @todo use pkg-config?
 
 #
-# The QT4 SDK.
+# The QT5 SDK.
 #
-# This is implemented here rather than in sdks/QT4.kmk to enforce the global USES.
+# This is implemented here rather than in sdks/QT5.kmk to enforce the global USES.
 # It also makes things easier to develop, with fewer files I mean.
 #
 ## @todo the SDK might actually not be necessary as it turns out... For now it servers
 # a purpose if the host differs from the target, in theory at least.
-SDK_QT4 = Qt4
+SDK_QT5 = Qt5
 
 # SDK Specific Properties
-#       PATH_SDK_QT4	       - The general Qt4 root directory.
-#       PATH_SDK_QT4_INC       - The include directory.
-#       PATH_SDK_QT4_LIB.amd64 - The lib directory for AMD64.
-#       PATH_SDK_QT4_LIB.x86   - The lib directory for X86.
-#       PATH_SDK_QT4_LIB       - The lib directory for KBUILD_TARGET.
-ifndef PATH_SDK_QT4
- PATH_SDK_QT4 := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v4*)))
- ifeq ($(PATH_SDK_QT4),)
+#       PATH_SDK_QT5	       - The general Qt5 root directory.
+#       PATH_SDK_QT5_INC       - The include directory.
+#       PATH_SDK_QT5_LIB.amd64 - The lib directory for AMD64.
+#       PATH_SDK_QT5_LIB.x86   - The lib directory for X86.
+#       PATH_SDK_QT5_LIB       - The lib directory for KBUILD_TARGET.
+ifndef PATH_SDK_QT5
+ PATH_SDK_QT5 := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_TRG)/qt/v5*)))
+ ifeq ($(PATH_SDK_QT5),)
   # If target == host, try look for Qt in the various platform specific places.
   ifeq ($(KBUILD_TARGET),$(KBUILD_HOST))
    ifeq ($(KBUILD_TARGET),darwin)
-    PATH_SDK_QT4 := $(patsubst %/Frameworks/QtCore.framework/Versions/4,%,$(firstword $(wildcard /Library/Frameworks/QtCore.framework/Versions/4)))
+    PATH_SDK_QT5 := $(patsubst %/Frameworks/QtCore.framework/Versions/5,%,$(firstword $(wildcard /Library/Frameworks/QtCore.framework/Versions/5)))
    else ifeq ($(KBUILD_TARGET),win)
     # No idea here yet...
    else ifeq ($(KBUILD_TARGET),ose)
     # No port...
    else
-    # The Unices. Includes and esp. libs are tricky, so override the PATH_SDK_QT4_LIB* stuff if it doesn't work.
-    # Try find the general root of thing by looking for the qt3to4 program, if not found, then look for rcc.
-    PATH_SDK_QT4 := $(patsubst %/bin/qt3to4-qt4,%,$(firstword $(wildcard \
-    	/usr/bin/qt3to4-qt4 \
-    	/usr/local/bin/qt3to4-qt4 \
-    	/usr/qt/4/bin/qt3to4-qt4 \
-    	/usr/share/qt4/bin/qt3to4-qt4 \
+    # The Unices. Includes and esp. libs are tricky, so override the PATH_SDK_QT5_LIB* stuff if it doesn't work.
+    # Try find the general root of thing by looking for the qt4to5 program, if not found, then look for rcc.
+    PATH_SDK_QT5 := $(patsubst %/bin/qt4to5-qt5,%,$(firstword $(wildcard \
+    	/usr/bin/qt4to5-qt5 \
+    	/usr/local/bin/qt4to5-qt5 \
+    	/usr/qt/5/bin/qt4to5-qt5 \
+    	/usr/share/qt5/bin/qt4to5-qt5 \
     	)))
-    ifeq ($(PATH_SDK_QT4),)
-     PATH_SDK_QT4 := $(patsubst %/bin/qt3to4,%,$(firstword $(wildcard \
-     	/usr/bin/qt3to4 \
-     	/usr/local/bin/qt3to4 \
-     	/usr/qt/4/bin/qt3to4 \
-     	/usr/share/qt4/bin/qt3to4 \
+    ifeq ($(PATH_SDK_QT5),)
+     PATH_SDK_QT5 := $(patsubst %/bin/qt4to5,%,$(firstword $(wildcard \
+     	/usr/bin/qt4to5 \
+     	/usr/local/bin/qt4to5 \
+     	/usr/qt/5/bin/qt4to5 \
+     	/usr/share/qt5/bin/qt4to5 \
        	)))
     endif
-    ifeq ($(PATH_SDK_QT4),)
-     PATH_SDK_QT4 := $(patsubst %/bin/rcc-qt4,%,$(firstword $(wildcard \
-     	/usr/bin/rcc-qt4 \
-     	/usr/local/bin/rcc-qt4 \
-     	/usr/qt/4/bin/rcc-qt4 \
-     	/usr/share/qt4/bin/rcc-qt4 \
+    ifeq ($(PATH_SDK_QT5),)
+     PATH_SDK_QT5 := $(patsubst %/bin/rcc-qt5,%,$(firstword $(wildcard \
+     	/usr/bin/rcc-qt5 \
+     	/usr/local/bin/rcc-qt5 \
+     	/usr/qt/5/bin/rcc-qt5 \
+     	/usr/share/qt5/bin/rcc-qt5 \
      	)))
     endif
-    ifeq ($(PATH_SDK_QT4),)
-     PATH_SDK_QT4 := $(patsubst %/bin/rcc,%,$(firstword $(wildcard \
+    ifeq ($(PATH_SDK_QT5),)
+     PATH_SDK_QT5 := $(patsubst %/bin/rcc,%,$(firstword $(wildcard \
      	/usr/bin/rcc \
      	/usr/local/bin/rcc \
-     	/usr/qt/4/bin/rcc \
-     	/usr/share/qt4/bin/rcc \
+     	/usr/qt/5/bin/rcc \
+     	/usr/share/qt5/bin/rcc \
      	)))
     endif
-    ifneq ($(PATH_SDK_QT4),)
-     export PATH_SDK_QT4
+    ifneq ($(PATH_SDK_QT5),)
+     export PATH_SDK_QT5
 
      # Locate the include files.
-     ifeq ($(PATH_SDK_QT4_INC),)
-      PATH_SDK_QT4_INC := $(patsubst %/QtCore/qglobal.h,%,$(firstword $(wildcard \
-	$(PATH_SDK_QT4)/include/QtCore/qglobal.h \
-	$(PATH_SDK_QT4)/include/qt4/QtCore/qglobal.h \
-	/usr/include/qt4/QtCore/qtglobal.h \
-	/usr/local/include/qt4/QtCore/qtglobal.h \
+     ifeq ($(PATH_SDK_QT5_INC),)
+      PATH_SDK_QT5_INC := $(patsubst %/QtCore/qglobal.h,%,$(firstword $(wildcard \
+	$(PATH_SDK_QT5)/include/QtCore/qglobal.h \
+	$(PATH_SDK_QT5)/include/qt5/QtCore/qglobal.h \
+	/usr/include/qt5/QtCore/qtglobal.h \
+	/usr/local/include/qt5/QtCore/qtglobal.h \
 	)))
-      ifneq ($(PATH_SDK_QT4_INC),)
-       export PATH_SDK_QT4_INC
+      ifneq ($(PATH_SDK_QT5_INC),)
+       export PATH_SDK_QT5_INC
       endif
      endif
 
      # Now for the libraries (mostly for helping out finding the KBUILD_TARGET libs).
-     ifeq ($(PATH_SDK_QT4_LIB.x86),)
-      PATH_SDK_QT4_LIB.x86   := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
-	$(PATH_SDK_QT4)/lib32/libQtCore$(SUFF_DLL) \
-	$(PATH_SDK_QT4)/lib32/qt4/libQtCore$(SUFF_DLL) \
-	/usr/lib32/libQtCore$(SUFF_DLL) \
-	/usr/lib32/qt4/libQtCore$(SUFF_DLL) \
-	/usr/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \
-	/usr/local/lib32/libQtCore$(SUFF_DLL) \
-	/usr/local/lib32/qt4/libQtCore$(SUFF_DLL) \
-	/usr/local/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \
-	$(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \
-	$(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \
-	$(PATH_SDK_QT4)/lib/i386-linux-gnu/libQtCore$(SUFF_DLL) \
+     ifeq ($(PATH_SDK_QT5_LIB.x86),)
+      PATH_SDK_QT5_LIB.x86   := $(patsubst %/libQt5Core$(SUFF_DLL),%,$(firstword $(wildcard \
+	$(PATH_SDK_QT5)/lib32/libQt5Core$(SUFF_DLL) \
+	$(PATH_SDK_QT5)/lib32/qt5/libQt5Core$(SUFF_DLL) \
+	/usr/lib32/libQt5Core$(SUFF_DLL) \
+	/usr/lib32/qt5/libQt5Core$(SUFF_DLL) \
+	/usr/lib/i386-linux-gnu/libQt5Core$(SUFF_DLL) \
+	/usr/local/lib32/libQt5Core$(SUFF_DLL) \
+	/usr/local/lib32/qt5/libQt5Core$(SUFF_DLL) \
+	/usr/local/lib/i386-linux-gnu/libQt5Core$(SUFF_DLL) \
+	$(PATH_SDK_QT5)/lib/libQt5Core$(SUFF_DLL) \
+	$(PATH_SDK_QT5)/lib/qt5/libQt5Core$(SUFF_DLL) \
+	$(PATH_SDK_QT5)/lib/i386-linux-gnu/libQt5Core$(SUFF_DLL) \
 	)))
-      ifneq ($(PATH_SDK_QT4_LIB.x86),)
-       export PATH_SDK_QT4_LIB.x86
+      ifneq ($(PATH_SDK_QT5_LIB.x86),)
+       export PATH_SDK_QT5_LIB.x86
       endif
      endif
-     ifeq ($(PATH_SDK_QT4_LIB.amd64),)
-      PATH_SDK_QT4_LIB.amd64 := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
-	$(PATH_SDK_QT4)/lib64/libQtCore$(SUFF_DLL) \
-	$(PATH_SDK_QT4)/lib64/qt4/libQtCore$(SUFF_DLL) \
-	$(PATH_SDK_QT4)/lib/amd64/libQtCore$(SUFF_DLL) \
-	/usr/lib64/libQtCore$(SUFF_DLL) \
-	/usr/lib64/qt4/libQtCore$(SUFF_DLL) \
-	/usr/lib/amd64/libQtCore$(SUFF_DLL) \
-	/usr/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \
-	/usr/local/lib64/libQtCore$(SUFF_DLL) \
-	/usr/local/lib64/qt4/libQtCore$(SUFF_DLL) \
-	/usr/local/lib/amd64/libQtCore$(SUFF_DLL) \
-	/usr/local/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \
-	$(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \
-	$(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \
-	$(PATH_SDK_QT4)/lib/x86_64-linux-gnu/libQtCore$(SUFF_DLL) \
+     ifeq ($(PATH_SDK_QT5_LIB.amd64),)
+      PATH_SDK_QT5_LIB.amd64 := $(patsubst %/libQt5Core$(SUFF_DLL),%,$(firstword $(wildcard \
+	$(PATH_SDK_QT5)/lib64/libQt5Core$(SUFF_DLL) \
+	$(PATH_SDK_QT5)/lib64/qt5/libQt5Core$(SUFF_DLL) \
+	$(PATH_SDK_QT5)/lib/amd64/libQt5Core$(SUFF_DLL) \
+	/usr/lib64/libQt5Core$(SUFF_DLL) \
+	/usr/lib64/qt5/libQt5Core$(SUFF_DLL) \
+	/usr/lib/amd64/libQt5Core$(SUFF_DLL) \
+	/usr/lib/x86_64-linux-gnu/libQt5Core$(SUFF_DLL) \
+	/usr/local/lib64/libQt5Core$(SUFF_DLL) \
+	/usr/local/lib64/qt5/libQt5Core$(SUFF_DLL) \
+	/usr/local/lib/amd64/libQt5Core$(SUFF_DLL) \
+	/usr/local/lib/x86_64-linux-gnu/libQt5Core$(SUFF_DLL) \
+	$(PATH_SDK_QT5)/lib/libQt5Core$(SUFF_DLL) \
+	$(PATH_SDK_QT5)/lib/qt5/libQt5Core$(SUFF_DLL) \
+	$(PATH_SDK_QT5)/lib/x86_64-linux-gnu/libQt5Core$(SUFF_DLL) \
 	)))
-      ifneq ($(PATH_SDK_QT4_LIB.amd64),)
-       export PATH_SDK_QT4_LIB.amd64
+      ifneq ($(PATH_SDK_QT5_LIB.amd64),)
+       export PATH_SDK_QT5_LIB.amd64
       endif
      endif
 
      # And finally, the library path for KBUILD_TARGET.
-     ifeq ($(PATH_SDK_QT4_LIB),)
-      PATH_SDK_QT4_LIB := $(PATH_SDK_QT4_LIB.$(KBUILD_TARGET_ARCH))
-      ifeq ($(PATH_SDK_QT4_LIB),)
-       PATH_SDK_QT4_LIB := $(patsubst %/libQtCore$(SUFF_DLL),%,$(firstword $(wildcard \
-       	$(PATH_SDK_QT4)/lib/libQtCore$(SUFF_DLL) \
-       	$(PATH_SDK_QT4)/lib/qt4/libQtCore$(SUFF_DLL) \
-       	/usr/lib/libQtCore$(SUFF_DLL) \
-       	/usr/lib/qt4/libQtCore$(SUFF_DLL) \
-       	/usr/local/lib/libQtCore$(SUFF_DLL) \
-       	/usr/local/lib/qt4/libQtCore$(SUFF_DLL) \
+     ifeq ($(PATH_SDK_QT5_LIB),)
+      PATH_SDK_QT5_LIB := $(PATH_SDK_QT5_LIB.$(KBUILD_TARGET_ARCH))
+      ifeq ($(PATH_SDK_QT5_LIB),)
+       PATH_SDK_QT5_LIB := $(patsubst %/libQt5Core$(SUFF_DLL),%,$(firstword $(wildcard \
+       	$(PATH_SDK_QT5)/lib/libQt5Core$(SUFF_DLL) \
+       	$(PATH_SDK_QT5)/lib/qt5/libQt5Core$(SUFF_DLL) \
+       	/usr/lib/libQt5Core$(SUFF_DLL) \
+       	/usr/lib/qt5/libQt5Core$(SUFF_DLL) \
+       	/usr/local/lib/libQt5Core$(SUFF_DLL) \
+       	/usr/local/lib/qt5/libQt5Core$(SUFF_DLL) \
        	)))
       endif
-      ifneq ($(PATH_SDK_QT4_LIB),)
-       export PATH_SDK_QT4_LIB
+      ifneq ($(PATH_SDK_QT5_LIB),)
+       export PATH_SDK_QT5_LIB
       endif
      endif
 
@@ -188,29 +188,29 @@ ifndef PATH_SDK_QT4
    endif # Unices
   endif
   # Found it?
-  ifeq ($(PATH_SDK_QT4),)
-   $(warning kBuild: Couldn't find the Qt4 headers and libaries...)
-   PATH_SDK_QT4 := $(KBUILD_DEVTOOLS_TRG)/qt/not-found
+  ifeq ($(PATH_SDK_QT5),)
+   $(warning kBuild: Couldn't find the Qt5 headers and libaries...)
+   PATH_SDK_QT5 := $(KBUILD_DEVTOOLS_TRG)/qt/not-found
   endif
  endif
 else
  # Resolve any fancy stuff once and for all.
- PATH_SDK_QT4 := $(PATH_SDK_QT4)
+ PATH_SDK_QT5 := $(PATH_SDK_QT5)
 endif
 
 # Libraries can be in either Frameworks or lib depending on how you
 # build it on the mac. The .dmg installs into Frameworks but builds into lib.
 ifeq ($(KBUILD_TARGET),darwin)
- ifndef PATH_SDK_QT4_LIB
-  ifneq ($(wildcard $(PATH_SDK_QT4)/Frameworks),)
-   PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/Frameworks
+ ifndef PATH_SDK_QT5_LIB
+  ifneq ($(wildcard $(PATH_SDK_QT5)/Frameworks),)
+   PATH_SDK_QT5_LIB ?= $(PATH_SDK_QT5)/Frameworks
   else
-   PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
+   PATH_SDK_QT5_LIB ?= $(PATH_SDK_QT5)/lib
   endif
  endif
 else
- PATH_SDK_QT4_LIB ?= $(PATH_SDK_QT4)/lib
- PATH_SDK_QT4_INC ?= $(PATH_SDK_QT4)/include
+ PATH_SDK_QT5_LIB ?= $(PATH_SDK_QT5)/lib
+ PATH_SDK_QT5_INC ?= $(PATH_SDK_QT5)/include
 endif
 
 # The bits that kBuild picks up.
@@ -218,122 +218,122 @@ endif
 
 
 #
-# The QT4 tool.
+# The QT5 tool.
 #
-# This is implemented here rather than in tools/QT4.kmk to enforce the global USES.
+# This is implemented here rather than in tools/QT5.kmk to enforce the global USES.
 # It also makes things easier to develop, with fewer files I mean.
 #
-TOOL_QT4 = Qt4
+TOOL_QT5 = Qt5
 
 # Tool Specific Properties
-#       PATH_TOOL_QT4     - Obsolete.
-#       PATH_TOOL_QT4_BIN - The
-#       TOOL_QT4_BIN_SUFF -
-if !defined(PATH_TOOL_QT4_BIN) && defined(PATH_TOOL_QT4)
- PATH_TOOL_QT4_BIN := $(PATH_TOOL_QT4)/bin
+#       PATH_TOOL_QT5     - Obsolete.
+#       PATH_TOOL_QT5_BIN - The
+#       TOOL_QT5_BIN_SUFF -
+if !defined(PATH_TOOL_QT5_BIN) && defined(PATH_TOOL_QT5)
+ PATH_TOOL_QT5_BIN := $(PATH_TOOL_QT5)/bin
 endif
-ifndef PATH_TOOL_QT4_BIN
- PATH_TOOL_QT4_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/qt/v4*/bin)))
- if "$(PATH_TOOL_QT4_BIN)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
-  PATH_TOOL_QT4_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/qt/v4*/bin)))
+ifndef PATH_TOOL_QT5_BIN
+ PATH_TOOL_QT5_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST)/qt/v5*/bin)))
+ if "$(PATH_TOOL_QT5_BIN)" == "" && "$(KBUILD_DEVTOOLS_HST_ALT)" != ""
+  PATH_TOOL_QT5_BIN := $(firstword $(rsort $(wildcard $(KBUILD_DEVTOOLS_HST_ALT)/qt/v5*/bin)))
  endif
- ifeq ($(PATH_TOOL_QT4_BIN),)
-  ifdef TOOL_QT4_BIN_SUFF
-   TOOL_QT4_BIN_SUFF := $(TOOL_QT4_BIN_SUFF)
+ ifeq ($(PATH_TOOL_QT5_BIN),)
+  ifdef TOOL_QT5_BIN_SUFF
+   TOOL_QT5_BIN_SUFF := $(TOOL_QT5_BIN_SUFF)
   endif
-  # Try looking for moc-qt4 / moc-$(suffix) first.
-  ifneq ($(TOOL_QT4_BIN_SUFF),)
-   PATH_TOOL_QT4_BIN := $(patsubst %/moc$(TOOL_QT4_BIN_SUFF),%,$(firstword $(wildcard \
-	 /usr/lib/qt4/bin/moc$(TOOL_QT4_BIN_SUFF) \
-	 /usr/qt/4/bin/moc$(TOOL_QT4_BIN_SUFF) \
-	 /usr/share/qt4/bin/moc$(TOOL_QT4_BIN_SUFF) \
-	 /usr/local/bin/moc$(TOOL_QT4_BIN_SUFF) \
-	 /usr/bin/moc$(TOOL_QT4_BIN_SUFF) \
+  # Try looking for moc-qt5 / moc-$(suffix) first.
+  ifneq ($(TOOL_QT5_BIN_SUFF),)
+   PATH_TOOL_QT5_BIN := $(patsubst %/moc$(TOOL_QT5_BIN_SUFF),%,$(firstword $(wildcard \
+	 /usr/lib/qt5/bin/moc$(TOOL_QT5_BIN_SUFF) \
+	 /usr/qt/5/bin/moc$(TOOL_QT5_BIN_SUFF) \
+	 /usr/share/qt5/bin/moc$(TOOL_QT5_BIN_SUFF) \
+	 /usr/local/bin/moc$(TOOL_QT5_BIN_SUFF) \
+	 /usr/bin/moc$(TOOL_QT5_BIN_SUFF) \
 	 )))
   else
-   PATH_TOOL_QT4_BIN := $(patsubst %/moc-qt4,%,$(firstword $(wildcard \
-	/usr/lib/qt4/bin/moc-qt4 \
-	/usr/qt/4/bin/moc-qt4 \
-	/usr/share/qt4/bin/moc-qt4 \
-	/usr/local/bin/moc-qt4 \
-	/usr/bin/moc-qt4 \
+   PATH_TOOL_QT5_BIN := $(patsubst %/moc-qt5,%,$(firstword $(wildcard \
+	/usr/lib/qt5/bin/moc-qt5 \
+	/usr/qt/5/bin/moc-qt5 \
+	/usr/share/qt5/bin/moc-qt5 \
+	/usr/local/bin/moc-qt5 \
+	/usr/bin/moc-qt5 \
 	)))
-   ifneq ($(PATH_TOOL_QT4_BIN),)
-    TOOL_QT4_BIN_SUFF := -qt4
+   ifneq ($(PATH_TOOL_QT5_BIN),)
+    TOOL_QT5_BIN_SUFF := -qt5
    else
-    # If no luck, try looking for moc in the qt4 specific locations.
-    PATH_TOOL_QT4_BIN := $(patsubst %/moc,%,$(firstword $(wildcard \
-	/usr/lib/qt4/bin/moc \
-	/usr/qt/4/bin/moc \
-	/usr/share/qt4/bin/moc \
+    # If no luck, try looking for moc in the qt5 specific locations.
+    PATH_TOOL_QT5_BIN := $(patsubst %/moc,%,$(firstword $(wildcard \
+	/usr/lib/qt5/bin/moc \
+	/usr/qt/5/bin/moc \
+	/usr/share/qt5/bin/moc \
 	)))
    endif
   endif
-  # If still no go, try looking for qt3to4 and rcc.
-  ifeq ($(PATH_TOOL_QT4_BIN),)
-   PATH_TOOL_QT4_BIN := $(patsubst %/qt3to4,%,$(firstword $(wildcard \
-	/usr/lib/qt4/bin/qt3to4 \
-	/usr/qt/4/bin/qt3to4 \
-	/usr/share/qt4/bin/qt3to4 \
-	/usr/local/bin/qt3to4 \
-	/usr/bin/qt3to4 \
+  # If still no go, try looking for qt4to5 and rcc.
+  ifeq ($(PATH_TOOL_QT5_BIN),)
+   PATH_TOOL_QT5_BIN := $(patsubst %/qt4to5,%,$(firstword $(wildcard \
+	/usr/lib/qt5/bin/qt4to5 \
+	/usr/qt/5/bin/qt4to5 \
+	/usr/share/qt5/bin/qt4to5 \
+	/usr/local/bin/qt4to5 \
+	/usr/bin/qt4to5 \
 	)))
   endif
-  ifeq ($(PATH_TOOL_QT4_BIN),)
-   PATH_TOOL_QT4_BIN := $(patsubst %/rcc$(TOOL_QT4_BIN_SUFF),%,$(firstword $(wildcard \
-	/usr/lib/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
-	/usr/qt/4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
-	/usr/share/qt4/bin/rcc$(TOOL_QT4_BIN_SUFF) \
-	/usr/local/bin/rcc$(TOOL_QT4_BIN_SUFF) \
-	/usr/bin/rcc$(TOOL_QT4_BIN_SUFF) \
+  ifeq ($(PATH_TOOL_QT5_BIN),)
+   PATH_TOOL_QT5_BIN := $(patsubst %/rcc$(TOOL_QT5_BIN_SUFF),%,$(firstword $(wildcard \
+	/usr/lib/qt5/bin/rcc$(TOOL_QT5_BIN_SUFF) \
+	/usr/qt/5/bin/rcc$(TOOL_QT5_BIN_SUFF) \
+	/usr/share/qt5/bin/rcc$(TOOL_QT5_BIN_SUFF) \
+	/usr/local/bin/rcc$(TOOL_QT5_BIN_SUFF) \
+	/usr/bin/rcc$(TOOL_QT5_BIN_SUFF) \
 	)))
   endif
-  if "$(PATH_TOOL_QT4_BIN)" == "" && "$(TOOL_QT4_BIN_SUFF)" != ""
-   PATH_TOOL_QT4_BIN := $(patsubst %/rcc,%,$(firstword $(wildcard \
-	/usr/lib/qt4/bin/rcc \
-	/usr/qt/4/bin/rcc \
-	/usr/share/qt4/bin/rcc \
+  if "$(PATH_TOOL_QT5_BIN)" == "" && "$(TOOL_QT5_BIN_SUFF)" != ""
+   PATH_TOOL_QT5_BIN := $(patsubst %/rcc,%,$(firstword $(wildcard \
+	/usr/lib/qt5/bin/rcc \
+	/usr/qt/5/bin/rcc \
+	/usr/share/qt5/bin/rcc \
 	/usr/local/bin/rcc \
 	/usr/bin/rcc \
 	)))
   endif
-  ifneq ($(PATH_TOOL_QT4_BIN),)
-   export PATH_TOOL_QT4_BIN
+  ifneq ($(PATH_TOOL_QT5_BIN),)
+   export PATH_TOOL_QT5_BIN
   endif
  endif
  # If not found, we'll enter the 'pathless' mode.
 else
  # Resolve any fancy stuff once and for all.
- PATH_TOOL_QT4_BIN := $(PATH_TOOL_QT4_BIN)
+ PATH_TOOL_QT5_BIN := $(PATH_TOOL_QT5_BIN)
 endif
-ifneq ($(PATH_TOOL_QT4_BIN),)
- TOOL_QT4_MOC       ?= $(PATH_TOOL_QT4_BIN)/moc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
- TOOL_QT4_UIC       ?= $(PATH_TOOL_QT4_BIN)/uic$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
- ifndef TOOL_QT4_RCC
-  TOOL_QT4_RCC      := $(PATH_TOOL_QT4_BIN)/rcc$(HOST_SUFF_EXE)
-  ifeq ($(wildcard $(TOOL_QT4_RCC)),)
-   TOOL_QT4_RCC     := $(PATH_TOOL_QT4_BIN)/rcc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+ifneq ($(PATH_TOOL_QT5_BIN),)
+ TOOL_QT5_MOC       ?= $(PATH_TOOL_QT5_BIN)/moc$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT5_UIC       ?= $(PATH_TOOL_QT5_BIN)/uic$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
+ ifndef TOOL_QT5_RCC
+  TOOL_QT5_RCC      := $(PATH_TOOL_QT5_BIN)/rcc$(HOST_SUFF_EXE)
+  ifeq ($(wildcard $(TOOL_QT5_RCC)),)
+   TOOL_QT5_RCC     := $(PATH_TOOL_QT5_BIN)/rcc$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
   endif
  endif
- TOOL_QT4_LRC       ?= $(PATH_TOOL_QT4_BIN)/lrelease$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
- TOOL_QT4_LUPDATE   ?= $(PATH_TOOL_QT4_BIN)/lupdate$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT5_LRC       ?= $(PATH_TOOL_QT5_BIN)/lrelease$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT5_LUPDATE   ?= $(PATH_TOOL_QT5_BIN)/lupdate$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
 else
  # Pathless, relies on the environment.
- TOOL_QT4_MOC       ?= moc$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
- TOOL_QT4_UIC       ?= uic$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
- TOOL_QT4_RCC       ?= rcc$(HOST_SUFF_EXE)
- TOOL_QT4_LRC       ?= lrelease$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
- TOOL_QT4_LUPDATE   ?= lupdate$(TOOL_QT4_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT5_MOC       ?= moc$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT5_UIC       ?= uic$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT5_RCC       ?= rcc$(HOST_SUFF_EXE)
+ TOOL_QT5_LRC       ?= lrelease$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
+ TOOL_QT5_LUPDATE   ?= lupdate$(TOOL_QT5_BIN_SUFF)$(HOST_SUFF_EXE)
 endif
 
 # General Properties used by kBuild and/or units/qt.kmk
-TOOL_QT4_MOCFLAGS           ?=
-TOOL_QT4_MOCINCS            ?=
-TOOL_QT4_MOCDEFS            ?=
-TOOL_QT4_MOCDEFS.darwin     ?= __APPLE__ __GNUC__
-TOOL_QT4_MOCDEFS.solaris    ?= __sun
-TOOL_QT4_MOCDEFS.win.amd64  ?= WIN64
-TOOL_QT4_MOCDEFS.win.x86    ?= WIN32
+TOOL_QT5_MOCFLAGS           ?=
+TOOL_QT5_MOCINCS            ?=
+TOOL_QT5_MOCDEFS            ?=
+TOOL_QT5_MOCDEFS.darwin     ?= __APPLE__ __GNUC__
+TOOL_QT5_MOCDEFS.solaris    ?= __sun
+TOOL_QT5_MOCDEFS.win.amd64  ?= WIN64
+TOOL_QT5_MOCDEFS.win.x86    ?= WIN32
 
 
 ## MOC a C++ source file.
@@ -346,12 +346,12 @@ TOOL_QT4_MOCDEFS.win.x86    ?= WIN32
 # @param    $(incs)     Includes.
 # @param    $(outbase)  Output basename (full). Use this for list files and such.
 #
-TOOL_QT4_MOC_CPP_DEPEND =
-TOOL_QT4_MOC_CPP_DEPORD =
-TOOL_QT4_MOC_CPP_OUTPUT =
-TOOL_QT4_MOC_CPP_OUTPUT_MAYBE =
-define TOOL_QT4_MOC_CPP_CMDS
-	$(QUIET)$(TOOL_QT4_MOC)\
+TOOL_QT5_MOC_CPP_DEPEND =
+TOOL_QT5_MOC_CPP_DEPORD =
+TOOL_QT5_MOC_CPP_OUTPUT =
+TOOL_QT5_MOC_CPP_OUTPUT_MAYBE =
+define TOOL_QT5_MOC_CPP_CMDS
+	$(QUIET)$(TOOL_QT5_MOC)\
 		$(flags)\
 		$(addprefix -I, $(incs))\
 		$(addprefix -D, $(defs))\
@@ -369,12 +369,12 @@ endef
 # @param    $(incs)     Includes.
 # @param    $(outbase)  Output basename (full). Use this for list files and such.
 #
-TOOL_QT4_MOC_HPP_DEPEND =
-TOOL_QT4_MOC_HPP_DEPORD =
-TOOL_QT4_MOC_HPP_OUTPUT =
-TOOL_QT4_MOC_HPP_OUTPUT_MAYBE =
-define TOOL_QT4_MOC_HPP_CMDS
-	$(QUIET)$(TOOL_QT4_MOC)\
+TOOL_QT5_MOC_HPP_DEPEND =
+TOOL_QT5_MOC_HPP_DEPORD =
+TOOL_QT5_MOC_HPP_OUTPUT =
+TOOL_QT5_MOC_HPP_OUTPUT_MAYBE =
+define TOOL_QT5_MOC_HPP_CMDS
+	$(QUIET)$(TOOL_QT5_MOC)\
 		$(flags)\
 		$(addprefix -I, $(incs))\
 		$(addprefix -D, $(defs))\
@@ -392,12 +392,12 @@ endef
 # @param    $(incs)     Includes.
 # @param    $(outbase)  Output basename (full). Use this for list files and such.
 #
-TOOL_QT4_UIC_UI_DEPEND =
-TOOL_QT4_UIC_UI_DEPORD =
-TOOL_QT4_UIC_UI_OUTPUT =
-TOOL_QT4_UIC_UI_OUTPUT_MAYBE =
-define TOOL_QT4_UIC_UI_CMDS
-	$(QUIET)$(TOOL_QT4_UIC)\
+TOOL_QT5_UIC_UI_DEPEND =
+TOOL_QT5_UIC_UI_DEPORD =
+TOOL_QT5_UIC_UI_OUTPUT =
+TOOL_QT5_UIC_UI_OUTPUT_MAYBE =
+define TOOL_QT5_UIC_UI_CMDS
+	$(QUIET)$(TOOL_QT5_UIC)\
 		$(flags)\
 		-o $(out)\
 		$(source)
@@ -414,12 +414,12 @@ endef
 # @param    $(outbase)  Output basename (full). Use this for list files and such.
 #
 # @remarks  The sed script generating the dependency file is a bit naive.
-TOOL_QT4_RCC_QRC_DEPEND =
-TOOL_QT4_RCC_QRC_DEPORD =
-TOOL_QT4_RCC_QRC_OUTPUT =
-TOOL_QT4_RCC_QRC_OUTPUT_MAYBE =
-define TOOL_QT4_RCC_QRC_CMDS
-	$(QUIET)$(TOOL_QT4_RCC)\
+TOOL_QT5_RCC_QRC_DEPEND =
+TOOL_QT5_RCC_QRC_DEPORD =
+TOOL_QT5_RCC_QRC_OUTPUT =
+TOOL_QT5_RCC_QRC_OUTPUT_MAYBE =
+define TOOL_QT5_RCC_QRC_CMDS
+	$(QUIET)$(TOOL_QT5_RCC)\
 		$(flags)\
 		-o $(out)\
 		$(source)
@@ -454,12 +454,12 @@ endef
 # @param    $(incs)     Includes.
 # @param    $(outbase)  Output basename (full). Use this for list files and such.
 #
-TOOL_QT4_LRC_TS_DEPEND =
-TOOL_QT4_LRC_TS_DEPORD =
-TOOL_QT4_LRC_TS_OUTPUT =
-TOOL_QT4_LRC_TS_OUTPUT_MAYBE =
-define TOOL_QT4_LRC_TS_CMDS
-	$(QUIET)$(TOOL_QT4_LRC)\
+TOOL_QT5_LRC_TS_DEPEND =
+TOOL_QT5_LRC_TS_DEPORD =
+TOOL_QT5_LRC_TS_OUTPUT =
+TOOL_QT5_LRC_TS_OUTPUT_MAYBE =
+define TOOL_QT5_LRC_TS_CMDS
+	$(QUIET)$(TOOL_QT5_LRC)\
 		$(flags)\
 		$(source)\
 		-qm $(out)
@@ -469,30 +469,30 @@ endef
 
 #
 #
-# Back to the Qt4 unit.
+# Back to the Qt5 unit.
 #
 #
 
 
 ## wrapper for the lrelease (LRC) command dependencies.
 ifndef NO_COMPILE_CMDS_DEPS
- _UNIT_QT4_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
+ _UNIT_QT5_LRC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_LRC_CMDS_PREV_),$$(commands $(out)),FORCE)
 else
- _UNIT_QT4_LRC_CMDS_DEP =
+ _UNIT_QT5_LRC_CMDS_DEP =
 endif
 
 ##
-# def_unit_qt4_target_pre_handle_translation helper that is expanded before evaluation.
+# def_unit_qt5_target_pre_handle_translation helper that is expanded before evaluation.
 #
 # This is necessary to resolve reference to local variables before doing
 # assignments and setting up commands. They would otherwise be resolved
 # later in a different context and the result would be completely wrong.
 #
-define def_unit_qt4_target_pre_handle_translation_dx
+define def_unit_qt5_target_pre_handle_translation_dx
 
 $(out) + $(more_output) +| $(maybe_output): \
 		$(deps) \
-		$(value _UNIT_QT4_LRC_CMDS_DEP) \
+		$(value _UNIT_QT5_LRC_CMDS_DEP) \
 		| \
 		$(orderdeps)
 	%$$(call MSG_TOOL,lrelease,$(target),$(source),$$@)
@@ -502,7 +502,7 @@ $(cmds)
 
 ifndef NO_COMPILE_CMDS_DEPS
 	%$$(QUIET2)$$(APPEND) '$(dep)'
-	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_LRC_CMDS_PREV_'
+	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_LRC_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
 endif
@@ -510,7 +510,7 @@ endif
 $(target)_CLEAN += $(out) $(more_output) $(maybe_output) $(dep)
 $(target)-inst-nls_SOURCES += $(out)
 
-endef # def_unit_qt4_target_pre_handle_translation_dx
+endef # def_unit_qt5_target_pre_handle_translation_dx
 
 ##
 # Handle a source file listed in QT_TRANSLATIONS.
@@ -519,7 +519,7 @@ endef # def_unit_qt4_target_pre_handle_translation_dx
 # to be translated into .qm files that are loadble by Qt.
 #
 # @remarks Invoked via $(evalvalctx ).
-define def_unit_qt4_target_pre_handle_translation
+define def_unit_qt5_target_pre_handle_translation
 local type      := LRC
 
 # fetch the properties.
@@ -555,31 +555,31 @@ local orderdeps    += $(TOOL_$(tool)_LRC_TS_DEPORD)
 ifndef NO_COMPILE_CMDS_DEPS
  $(eval includedep $(dep))
 endif
-$(eval $(def_unit_qt4_target_pre_handle_translation_dx))
+$(eval $(def_unit_qt5_target_pre_handle_translation_dx))
 
-endef # def_unit_qt4_target_pre_handle_translation
+endef # def_unit_qt5_target_pre_handle_translation
 
 
 
 ## wrapper for the UIC command dependencies.
 ifndef NO_COMPILE_CMDS_DEPS
- _UNIT_QT4_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
+ _UNIT_QT5_RCC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_RCC_CMDS_PREV_),$$(commands $(out)),FORCE)
 else
- _UNIT_QT4_RCC_CMDS_DEP =
+ _UNIT_QT5_RCC_CMDS_DEP =
 endif
 
 ##
-# def_unit_qt4_target_pre_handle_qrc helper that is expanded before evaluation.
+# def_unit_qt5_target_pre_handle_qrc helper that is expanded before evaluation.
 #
 # This is necessary to resolve reference to local variables before doing
 # assignments and setting up commands. They would otherwise be resolved
 # later in a different context and the result would be completely wrong.
 #
-define def_unit_qt4_target_pre_handle_rcc_dx
+define def_unit_qt5_target_pre_handle_rcc_dx
 
 $(out) +| $(realout) $(more_output) $(maybe_output): \
 		$(deps) \
-		$(value _UNIT_QT4_RCC_CMDS_DEP) \
+		$(value _UNIT_QT5_RCC_CMDS_DEP) \
 		| \
 		$(orderdeps)
 	%$$(call MSG_TOOL,rcc,$(target),$(source),$$@)
@@ -590,7 +590,7 @@ $(cmds)
 	$(QUIET)$(CP) --changed -f $(out) $(realout)
 ifndef NO_COMPILE_CMDS_DEPS
 	%$$(QUIET2)$$(APPEND) '$(dep)'
-	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_RCC_CMDS_PREV_'
+	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_RCC_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
 endif
@@ -599,13 +599,13 @@ $(target)_INTERMEDIATES += $(realout)
 $(target)_GEN_SOURCES_ += $(realout)
 $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
 
-endef # def_unit_qt4_target_pre_handle_rcc_dx
+endef # def_unit_qt5_target_pre_handle_rcc_dx
 
 ##
 # Source handler for .qrc sources (Qt resource files).
 #
 # @remarks $(evalvalctx me).
-define def_unit_qt4_src_handler_qrc
+define def_unit_qt5_src_handler_qrc
 local type      := RCC
 
 # fetch the properties.
@@ -642,31 +642,31 @@ local orderdeps    += $(TOOL_$(tool)_RCC_QRC_DEPORD)
 ifndef NO_COMPILE_CMDS_DEPS
  $(eval includedep $(dep))
 endif
-$(eval $(def_unit_qt4_target_pre_handle_rcc_dx))
+$(eval $(def_unit_qt5_target_pre_handle_rcc_dx))
 
-endef # def_unit_qt4_src_handler_qrc
+endef # def_unit_qt5_src_handler_qrc
 
 
 
 ## wrapper for the UIC command dependencies.
 ifndef NO_COMPILE_CMDS_DEPS
- _UNIT_QT4_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
+ _UNIT_QT5_UIC_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_UIC_CMDS_PREV_),$$(commands $(out)),FORCE)
 else
- _UNIT_QT4_UIC_CMDS_DEP =
+ _UNIT_QT5_UIC_CMDS_DEP =
 endif
 
 ##
-# def_unit_qt4_src_handler_ui helper that is expanded before evaluation.
+# def_unit_qt5_src_handler_ui helper that is expanded before evaluation.
 #
 # This is necessary to resolve reference to local variables before doing
 # assignments and setting up commands. They would otherwise be resolved
 # later in a different context and the result would be completely wrong.
 #
-define def_unit_qt4_target_pre_handle_ui_dx
+define def_unit_qt5_target_pre_handle_ui_dx
 
 $(out) +| $(realout) $(more_output) $(maybe_output): \
 		$(deps) \
-		$(value _UNIT_QT4_UIC_CMDS_DEP) \
+		$(value _UNIT_QT5_UIC_CMDS_DEP) \
 		| \
 		$(orderdeps)
 	%$$(call MSG_TOOL,uic,$(target),$(source),$$@)
@@ -677,7 +677,7 @@ $(cmds)
 	$(QUIET)$(CP) --changed -f $(out) $(realout)
 ifndef NO_COMPILE_CMDS_DEPS
 	%$$(QUIET2)$$(APPEND) '$(dep)'
-	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_UIC_CMDS_PREV_'
+	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_UIC_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
 endif
@@ -685,13 +685,13 @@ endif
 $(target)_INTERMEDIATES += $(realout)
 $(target)_CLEAN += $(out) $(realout) $(more_output) $(maybe_output) $(dep)
 
-endef # def_unit_qt4_target_pre_handle_ui_dx
+endef # def_unit_qt5_target_pre_handle_ui_dx
 
 ##
 # Source handler for .ui sources.
 #
 # @remarks $(evalvalctx me).
-define def_unit_qt4_src_handler_ui
+define def_unit_qt5_src_handler_ui
 local type      := UIC
 
 # fetch the properties.
@@ -728,31 +728,31 @@ local orderdeps    += $(TOOL_$(tool)_UIC_UI_DEPORD)
 ifndef NO_COMPILE_CMDS_DEPS
  $(eval includedep $(dep))
 endif
-$(eval $(def_unit_qt4_target_pre_handle_ui_dx))
+$(eval $(def_unit_qt5_target_pre_handle_ui_dx))
 
-endef # def_unit_qt4_src_handler_ui
+endef # def_unit_qt5_src_handler_ui
 
 
 
 ## wrapper for the MOC command dependencies.
 ifndef NO_COMPILE_CMDS_DEPS
- _UNIT_QT4_MOC_HPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_MOC_HPP_CMDS_PREV_),$$(commands $(out)),FORCE)
+ _UNIT_QT5_MOC_HPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_MOC_HPP_CMDS_PREV_),$$(commands $(out)),FORCE)
 else
- _UNIT_QT4_MOC_HPP_CMDS_DEP =
+ _UNIT_QT5_MOC_HPP_CMDS_DEP =
 endif
 
 ##
-# def_unit_qt4_target_pre_handle_moc_hdr helper that is expanded before evaluation.
+# def_unit_qt5_target_pre_handle_moc_hdr helper that is expanded before evaluation.
 #
 # This is necessary to resolve reference to local variables before doing
 # assignments and setting up commands. They would otherwise be resolved
 # later in a different context and the result would be completely wrong.
 #
-define def_unit_qt4_target_pre_handle_moc_hdr_dx
+define def_unit_qt5_target_pre_handle_moc_hdr_dx
 
 $(out) +| $(realout) $(more_output) $(maybe_output): \
 		$(deps) \
-		$(value _UNIT_QT4_MOC_HPP_CMDS_DEP) \
+		$(value _UNIT_QT5_MOC_HPP_CMDS_DEP) \
 		| \
 		$(orderdeps)
 	%$$(call MSG_TOOL,moc,$(target),$(source),$$@)
@@ -763,7 +763,7 @@ $(cmds)
 	$(QUIET)$(CP) --changed -f $(out) $(realout)
 ifndef NO_COMPILE_CMDS_DEPS
 	%$$(QUIET2)$$(APPEND) '$(dep)'
-	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_MOC_HPP_CMDS_PREV_'
+	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_MOC_HPP_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
 endif
@@ -784,7 +784,7 @@ endef
 # supported by this unit.)
 #
 # @remarks Invoked via $(evalvalctx ).
-define def_unit_qt4_target_pre_handle_moc_hdr
+define def_unit_qt5_target_pre_handle_moc_hdr
 local type      := MOC
 
 # fetch the properties.
@@ -822,30 +822,30 @@ local orderdeps    += $(TOOL_$(tool)_MOC_HPP_DEPORD)
 ifndef NO_COMPILE_CMDS_DEPS
  $(eval includedep $(dep))
 endif
-$(eval $(def_unit_qt4_target_pre_handle_moc_hdr_dx))
+$(eval $(def_unit_qt5_target_pre_handle_moc_hdr_dx))
 
-endef # def_unit_qt4_target_pre_handle_moc_hdr
+endef # def_unit_qt5_target_pre_handle_moc_hdr
 
 
 ## wrapper for the MOC command dependencies.
 ifndef NO_COMPILE_CMDS_DEPS
- _UNIT_QT4_MOC_CPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT4_MOC_CPP_CMDS_PREV_),$$(commands $(out)),FORCE)
+ _UNIT_QT5_MOC_CPP_CMDS_DEP = $$(comp-cmds-ex $$($(target)_$(subst :,_,$(source))_QT5_MOC_CPP_CMDS_PREV_),$$(commands $(out)),FORCE)
 else
- _UNIT_QT4_MOC_CPP_CMDS_DEP =
+ _UNIT_QT5_MOC_CPP_CMDS_DEP =
 endif
 
 ##
-# def_unit_qt4_target_pre_handle_moc_src helper that is expanded before evaluation.
+# def_unit_qt5_target_pre_handle_moc_src helper that is expanded before evaluation.
 #
 # This is necessary to resolve reference to local variables before doing
 # assignments and setting up commands. They would otherwise be resolved
 # later in a different context and the result would be completely wrong.
 #
-define def_unit_qt4_target_pre_handle_moc_src_dx
+define def_unit_qt5_target_pre_handle_moc_src_dx
 
 $(out) +| $(realout) $(more_output) $(maybe_output): \
 		$(deps) \
-		$(value _UNIT_QT4_MOC_CPP_CMDS_DEP) \
+		$(value _UNIT_QT5_MOC_CPP_CMDS_DEP) \
 		| \
 		$(orderdeps)
 	%$$(call MSG_TOOL,moc,$(target),$(source),$$@)
@@ -856,7 +856,7 @@ $(cmds)
 	$(QUIET)$(CP) --changed -f $(out) $(realout)
 ifndef NO_COMPILE_CMDS_DEPS
 	%$$(QUIET2)$$(APPEND) '$(dep)'
-	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT4_MOC_CPP_CMDS_PREV_'
+	%$$(QUIET2)$$(APPEND) '$(dep)' 'define $(target)_$(subst :,_,$(source))_QT5_MOC_CPP_CMDS_PREV_'
 	%$$(QUIET2)$$(APPEND) -c '$(dep)' '$(out)'
 	%$$(QUIET2)$$(APPEND) '$(dep)' 'endef'
 endif
@@ -873,7 +873,7 @@ endef
 # a .moc file that we're expected to generate here.
 #
 # @remarks Invoked via $(evalvalctx ).
-define def_unit_qt4_target_pre_handle_moc_src
+define def_unit_qt5_target_pre_handle_moc_src
 local type      := MOC
 
 # fetch the properties.
@@ -911,20 +911,20 @@ local orderdeps    += $(TOOL_$(tool)_MOC_CPP_DEPORD)
 ifndef NO_COMPILE_CMDS_DEPS
  $(eval includedep $(dep))
 endif
-$(eval $(def_unit_qt4_target_pre_handle_moc_src_dx))
+$(eval $(def_unit_qt5_target_pre_handle_moc_src_dx))
 
-endef # def_unit_qt4_target_pre_handle_moc_src
+endef # def_unit_qt5_target_pre_handle_moc_src
 
 
 ##
 # Adds sources containing Q_OBJECT to QT_MOCSRCS.
-define def_unit_qt4_target_pre_cpp_source
+define def_unit_qt5_target_pre_cpp_source
 ifneq ($(file-size $(source)),-1)
  ifneq ($(strip $(shell $(SED) -f $(KBUILD_PATH)/units/qt-Q_OBJECT.sed $(source))),)
   $(eval $(target)_QT_MOCSRCS += $(source))
  endif
 endif
-endef # def_unit_qt4_target_pre_cpp_source
+endef # def_unit_qt5_target_pre_cpp_source
 
 ##
 # Invoked early in the processing of a target that uses	the Qt unit.
@@ -935,7 +935,7 @@ endef # def_unit_qt4_target_pre_cpp_source
 # It will then check all the C++ sources and check which needs
 # a .moc files and generate rules and dependencies fofor these
 #
-define def_unit_qt4_target_pre
+define def_unit_qt5_target_pre
 
 # Make QTTOOL the default for the specific Qt tools instead of TOOL.
 ifneq ($($(target)_QTTOOL),)
@@ -977,20 +977,20 @@ local qt_infix := $(firstword \
  	$($(target)_QT_INFIX))
 ifeq ($(bld_trg),darwin)
  # Adding -F to CXXFLAGS is necessary to make #include <QtCore/qstring.h> stuff work...
- $(eval $(target)_CXXFLAGS += -F$(PATH_SDK_QT4_LIB) )
- $(eval $(target)_OBJCXXFLAGS += -F$(PATH_SDK_QT4_LIB) )
- $(eval $(target)_LDFLAGS  += -F$(PATH_SDK_QT4_LIB) $(foreach module,$(qt_modules), -framework $(qt_prefix)Qt$(module)$(qt_infix)) )
- $(eval $(target)_INCS     += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix).framework/Versions/4/Headers) )
+ $(eval $(target)_CXXFLAGS += -F$(PATH_SDK_QT5_LIB) )
+ $(eval $(target)_OBJCXXFLAGS += -F$(PATH_SDK_QT5_LIB) )
+ $(eval $(target)_LDFLAGS  += -F$(PATH_SDK_QT5_LIB) $(foreach module,$(qt_modules), -framework $(qt_prefix)Qt$(module)$(qt_infix)) )
+ $(eval $(target)_INCS     += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/$(qt_prefix)Qt$(module)$(qt_infix).framework/Versions/5/Headers) )
 else
  ifeq ($(bld_trg),win)
-  $(eval $(target)_LIBS    += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/$(qt_prefix)Qt$(module)$(qt_infix)4$(SUFF_LIB)) )
+  $(eval $(target)_LIBS    += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/$(qt_prefix)Qt5$(module)$(qt_infix)$(SUFF_LIB)) )
   ifeq ($(tool_do),LINK_PROGRAM)
-   $(eval $(target)_LIBS   += $(PATH_SDK_QT4_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) )
+   $(eval $(target)_LIBS   += $(PATH_SDK_QT5_LIB)/$(qt_prefix)qtmain$(qt_infix)$(SUFF_LIB) )
   endif
  else
-  $(eval $(target)_LIBS    += $(foreach module,$(qt_modules), $(PATH_SDK_QT4_LIB)/lib$(qt_prefix)Qt$(module)$(qt_infix)$(SUFF_DLL)) )
+  $(eval $(target)_LIBS    += $(foreach module,$(qt_modules), $(PATH_SDK_QT5_LIB)/lib$(qt_prefix)Qt5$(module)$(qt_infix)$(SUFF_DLL)) )
  endif
- $(eval $(target)_INCS     += $(addprefix $(PATH_SDK_QT4_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT4_INC) )
+ $(eval $(target)_INCS     += $(addprefix $(PATH_SDK_QT5_INC)/Qt,$(qt_modules)) $(PATH_SDK_QT5_INC) )
 endif
 $(eval $(target)_DEFS      += $(foreach module,$(toupper $(qt_modules)), QT_$(module)_LIB) )
 
@@ -1005,15 +1005,15 @@ ifndef $(target)_QT_MOCSRCS
  	$($(target)_SOURCES.$(bld_trg_cpu)) \
  	$($(target)_SOURCES.$(bld_type)) \
  	$($(target)_SOURCES) \
- 	), $(evalval def_unit_qt4_target_pre_cpp_source))
+ 	), $(evalval def_unit_qt5_target_pre_cpp_source))
 endif
 
 # Install source handlers for .ui files.
 $(target)_SRC_HANDLERS += \
-	 .ui:def_unit_qt4_src_handler_ui \
-	 .UI:def_unit_qt4_src_handler_ui \
-	.qrc:def_unit_qt4_src_handler_qrc \
-	.qrc:def_unit_qt4_src_handler_qrc
+	 .ui:def_unit_qt5_src_handler_ui \
+	 .UI:def_unit_qt5_src_handler_ui \
+	.qrc:def_unit_qt5_src_handler_qrc \
+	.qrc:def_unit_qt5_src_handler_qrc
 
 # Calc the MOC and UI output directories and add them to BLDDIRS and INCS.
 local qtmocdir := $($(target)_0_OUTDIR)/qtmoc
@@ -1031,7 +1031,7 @@ $(foreach source, \
  	$($(target)_QT_MOCSRCS.$(bld_trg_cpu)) \
  	$($(target)_QT_MOCSRCS.$(bld_type)) \
  	$($(target)_QT_MOCSRCS) \
-	, $(evalvalctx def_unit_qt4_target_pre_handle_moc_src))
+	, $(evalvalctx def_unit_qt5_target_pre_handle_moc_src))
 
 # Deal with QT_MOCHDRS.
 $(foreach source, \
@@ -1041,7 +1041,7 @@ $(foreach source, \
  	$($(target)_QT_MOCHDRS.$(bld_trg_cpu)) \
  	$($(target)_QT_MOCHDRS.$(bld_type)) \
  	$($(target)_QT_MOCHDRS) \
-	, $(evalvalctx def_unit_qt4_target_pre_handle_moc_hdr))
+	, $(evalvalctx def_unit_qt5_target_pre_handle_moc_hdr))
 
 # Deal with QT_TRANSLATIONS.
 # ASSUMES (_ALL_)INSTALLS is processed after the targets using this unit.
@@ -1065,28 +1065,28 @@ ifneq ($(strip $(translations)),)
  endif
  $(target)-inst-nls_SOURCES :=
  $(foreach source, $(translations)\
-	, $(evalvalctx def_unit_qt4_target_pre_handle_translation))
+	, $(evalvalctx def_unit_qt5_target_pre_handle_translation))
 endif
 
-endef # def_unit_qt4_target_pre
+endef # def_unit_qt5_target_pre
 
 
 #
 # Rule for debugging.
 #
-unit-qt4-show-vars:
-	@$(ECHO) 'The Qt4 SDK variables:'
-	@$(ECHO) '  PATH_SDK_QT4           = "$(PATH_SDK_QT4)"'
-	@$(ECHO) '  PATH_SDK_QT4_INC       = "$(PATH_SDK_QT4_INC)"'
-	@$(ECHO) '  PATH_SDK_QT4_LIB       = "$(PATH_SDK_QT4_LIB)"'
-	@$(ECHO) '  PATH_SDK_QT4_LIB.amd64 = "$(PATH_SDK_QT4_LIB.amd64)"'
-	@$(ECHO) '  PATH_SDK_QT4_LIB.x86   = "$(PATH_SDK_QT4_LIB.x86)"'
-	@$(ECHO) 'The Qt4 TOOL variables:'
-	@$(ECHO) '  PATH_TOOL_QT4_BIN      = "$(PATH_TOOL_QT4_BIN)"'
-	@$(ECHO) '  TOOL_QT4_BIN_SUFF      = "$(TOOL_QT4_BIN_SUFF)"'
-	@$(ECHO) '  TOOL_QT4_MOC           = "$(TOOL_QT4_MOC)"'
-	@$(ECHO) '  TOOL_QT4_UIC           = "$(TOOL_QT4_UIC)"'
-	@$(ECHO) '  TOOL_QT4_RCC           = "$(TOOL_QT4_RCC)"'
-	@$(ECHO) '  TOOL_QT4_LRC           = "$(TOOL_QT4_LRC)"'
-	@$(ECHO) '  TOOL_QT4_LUPDATE       = "$(TOOL_QT4_LUPDATE)"'
+unit-qt5-show-vars:
+	@$(ECHO) 'The Qt5 SDK variables:'
+	@$(ECHO) '  PATH_SDK_QT5           = "$(PATH_SDK_QT5)"'
+	@$(ECHO) '  PATH_SDK_QT5_INC       = "$(PATH_SDK_QT5_INC)"'
+	@$(ECHO) '  PATH_SDK_QT5_LIB       = "$(PATH_SDK_QT5_LIB)"'
+	@$(ECHO) '  PATH_SDK_QT5_LIB.amd64 = "$(PATH_SDK_QT5_LIB.amd64)"'
+	@$(ECHO) '  PATH_SDK_QT5_LIB.x86   = "$(PATH_SDK_QT5_LIB.x86)"'
+	@$(ECHO) 'The Qt5 TOOL variables:'
+	@$(ECHO) '  PATH_TOOL_QT5_BIN      = "$(PATH_TOOL_QT5_BIN)"'
+	@$(ECHO) '  TOOL_QT5_BIN_SUFF      = "$(TOOL_QT5_BIN_SUFF)"'
+	@$(ECHO) '  TOOL_QT5_MOC           = "$(TOOL_QT5_MOC)"'
+	@$(ECHO) '  TOOL_QT5_UIC           = "$(TOOL_QT5_UIC)"'
+	@$(ECHO) '  TOOL_QT5_RCC           = "$(TOOL_QT5_RCC)"'
+	@$(ECHO) '  TOOL_QT5_LRC           = "$(TOOL_QT5_LRC)"'
+	@$(ECHO) '  TOOL_QT5_LUPDATE       = "$(TOOL_QT5_LUPDATE)"'
 
diff --git a/src/kash/shinstance.c b/src/kash/shinstance.c
index 0cc7da8..3ec1910 100644
--- a/src/kash/shinstance.c
+++ b/src/kash/shinstance.c
@@ -1,4 +1,4 @@
-/* $Id: shinstance.c 2784 2015-05-24 17:29:04Z bird $ */
+/* $Id: shinstance.c 2809 2016-02-05 09:13:42Z bird $ */
 /** @file
  * The shell instance methods.
  */
@@ -181,7 +181,7 @@ static void sh_destroy(shinstance *psh)
 }
 
 /**
- * Clones a string vector like enviorn or argv.
+ * Clones a string vector like environ or argv.
  *
  * @returns 0 on success, -1 and errno on failure.
  * @param   psh     The shell to associate the allocations with.
@@ -199,7 +199,7 @@ static int sh_clone_string_vector(shinstance *psh, char ***dstp, char **src)
        items++;
 
    /* alloc clone array. */
-   *dstp = dst = sh_malloc(psh, sizeof(*dst) * items + 1);
+   *dstp = dst = sh_malloc(psh, sizeof(*dst) * (items + 1));
    if (!dst)
        return -1;
 
diff --git a/src/kmk/kmk_cc_exec.c b/src/kmk/kmk_cc_exec.c
index 9a0438a..82e2875 100644
--- a/src/kmk/kmk_cc_exec.c
+++ b/src/kmk/kmk_cc_exec.c
@@ -1,5 +1,5 @@
 #ifdef CONFIG_WITH_COMPILER
-/* $Id: kmk_cc_exec.c 2801 2015-09-20 19:13:24Z bird $ */
+/* $Id: kmk_cc_exec.c 2811 2016-03-12 13:26:33Z bird $ */
 /** @file
  * kmk_cc - Make "Compiler".
  */
@@ -126,7 +126,7 @@ extern int KMK_CC_STATIC_ASSERT_EX_VAR[1];
 /** How to declare a no-return function.
  * Place between scope (if any) and return type.  */
 #ifdef _MSC_VER
-# define KMK_CC_FN_NO_RETURN                        declspec(noreturn)
+# define KMK_CC_FN_NO_RETURN                        __declspec(noreturn)
 #elif defined(__GNUC__)
 # define KMK_CC_FN_NO_RETURN                        __attribute__((__noreturn__))
 #endif
@@ -555,14 +555,17 @@ typedef enum KMKCCEVALINSTR
     /** [local|override|export] define variable ... endef - KMKCCEVALASSIGNDEF. */
     kKmkCcEvalInstr_assign_define,
 
-    /** export variable1 [variable2...] - KMKCCEVALEXPORT. */
+    /** export variable1 [variable2...] - KMKCCEVALVARIABLES. */
     kKmkCcEvalInstr_export,
-    /** unexport variable1 [variable2...] - KMKCCEVALEXPORT. */
+    /** unexport variable1 [variable2...] - KMKCCEVALVARIABLES. */
     kKmkCcEvalInstr_unexport,
     /** export - KMKCCEVALCORE. */
     kKmkCcEvalInstr_export_all,
     /** unexport - KMKCCEVALCORE. */
     kKmkCcEvalInstr_unexport_all,
+    /** [local|override] undefine - KMKCCEVALVARIABLES. */
+    kKmkCcEvalInstr_undefine,
+
 
     /** [else] ifdef variable - KMKCCEVALIFDEFPLAIN. */
     kKmkCcEvalInstr_ifdef_plain,
@@ -687,24 +690,27 @@ typedef struct kmk_cc_eval_assign_define
 typedef KMKCCEVALASSIGNDEF *PKMKCCEVALASSIGNDEF;
 
 /**
- * Instruction format for kKmkCcEvalInstr_export and kKmkCcEvalInstr_unexport.
+ * Instruction format for kKmkCcEvalInstr_export, kKmkCcEvalInstr_unexport and
+ * kKmkCcEvalInstr_undefine.
  */
-typedef struct kmk_cc_eval_export
+typedef struct kmk_cc_eval_variables
 {
     /** The core instruction. */
     KMKCCEVALCORE           Core;
     /** The number of variables named in aVars. */
     uint32_t                cVars;
+    /** Whether the 'local' qualifier was used (undefine only). */
+    uint8_t                 fLocal;
     /** Pointer to the next instruction. */
     PKMKCCEVALCORE          pNext;
     /** The variable names.
      * Expressions will be expanded and split on space.
      * @remarks Plain text names are in variable_strcache. */
     KMKCCEXPSUBPROGORPLAIN  aVars[1];
-} KMKCCEVALEXPORT;
-typedef KMKCCEVALEXPORT *PKMKCCEVALEXPORT;
-/** Calculates the size of an KMKCCEVALEXPORT structure for @a a_cVars. */
-#define KMKCCEVALEXPORT_SIZE(a_cVars) KMK_CC_SIZEOF_VAR_STRUCT(KMKCCEVALVPATH, aVars, a_cVars)
+} KMKCCEVALVARIABLES;
+typedef KMKCCEVALVARIABLES *PKMKCCEVALVARIABLES;
+/** Calculates the size of an KMKCCEVALVARIABLES structure for @a a_cVars. */
+#define KMKCCEVALVARIABLES_SIZE(a_cVars) KMK_CC_SIZEOF_VAR_STRUCT(KMKCCEVALVARIABLES, aVars, a_cVars)
 
 /**
  * Core structure for all conditionals (kKmkCcEvalInstr_if*).
@@ -1039,6 +1045,7 @@ static const char * const g_apszEvalInstrNms[] =
     "unexport",
     "export_all",
     "unexport_all",
+    "undefine",
     "ifdef_plain",
     "ifndef_plain",
     "ifdef_dynamic",
@@ -1114,7 +1121,7 @@ void kmk_cc_init(void)
     KMK_CC_EVAL_BM_OR(g_abEvalCcChars, 'l', KMK_CC_EVAL_CH_1ST_IN_VARIABLE_KEYWORD); /* local */
     KMK_CC_EVAL_BM_OR(g_abEvalCcChars, 'o', KMK_CC_EVAL_CH_1ST_IN_VARIABLE_KEYWORD); /* override */
     KMK_CC_EVAL_BM_OR(g_abEvalCcChars, 'p', KMK_CC_EVAL_CH_1ST_IN_VARIABLE_KEYWORD); /* private */
-    KMK_CC_EVAL_BM_OR(g_abEvalCcChars, 'u', KMK_CC_EVAL_CH_1ST_IN_VARIABLE_KEYWORD); /* undefine */
+    KMK_CC_EVAL_BM_OR(g_abEvalCcChars, 'u', KMK_CC_EVAL_CH_1ST_IN_VARIABLE_KEYWORD); /* undefine, unexport */
 
     /* Assignment punctuation and recipe stuff. */
     KMK_CC_EVAL_BM_OR(g_abEvalCcChars, '=', KMK_CC_EVAL_CH_SPACE_VAR_OR_RECIPE);
@@ -3390,14 +3397,20 @@ static void kmk_cc_eval_init_spp_array_from_duplicated_words(PKMKCCEVALCOMPILER
          && (a_pchLine)[14] == (a_pszWord)[14] \
          && (a_pchLine)[15] == (a_pszWord)[15])
 #endif
+
+/** See if the given string match a constant string. */
+#define KMK_CC_STRCMP_CONST(a_pchLeft, a_cchLeft, a_pszConst, a_cchConst) \
+    (   (a_cchLeft) == (a_cchConst) \
+     && KMK_CC_WORD_COMP_CONST_##a_cchConst(a_pchLeft, a_pszConst) )
+
 /** See if a starting of a given length starts with a constant word. */
-#define KMK_CC_WORD_COMP_IS_EOL(a_pCompiler, a_pchLine, a_cchLine) \
+#define KMK_CC_EVAL_WORD_COMP_IS_EOL(a_pCompiler, a_pchLine, a_cchLine) \
     (   (a_cchLine) == 0 \
      || KMK_CC_EVAL_IS_SPACE((a_pchLine)[0]) \
      || ((a_pchLine)[0] == '\\' && (a_pchLine)[1] == (a_pCompiler)->chFirstEol) ) \
 
 /** See if a starting of a given length starts with a constant word. */
-#define KMK_CC_WORD_COMP_CONST(a_pCompiler, a_pchLine, a_cchLine, a_pszWord, a_cchWord) \
+#define KMK_CC_EVAL_WORD_COMP_CONST(a_pCompiler, a_pchLine, a_cchLine, a_pszWord, a_cchWord) \
     (    (a_cchLine) >= (a_cchWord) \
       && (   (a_cchLine) == (a_cchWord) \
           || KMK_CC_EVAL_IS_SPACE((a_pchLine)[a_cchWord]) \
@@ -5186,25 +5199,25 @@ static int kmk_cc_eval_do_else(PKMKCCEVALCOMPILER pCompiler, const char *pchWord
             pchWord += 2;
             cchLeft -= 2;
 
-            if (KMK_CC_WORD_COMP_IS_EOL(pCompiler, pchWord, cchLeft))
+            if (KMK_CC_EVAL_WORD_COMP_IS_EOL(pCompiler, pchWord, cchLeft))
                 return kmk_cc_eval_do_if(pCompiler, pchWord, cchLeft, 1 /* in else */);
 
-            if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "eq", 2))
+            if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "eq", 2))
                 return kmk_cc_eval_do_ifeq( pCompiler, pchWord + 2, cchLeft - 2, 1 /* in else */, 1 /* positive */);
 
-            if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "def", 3))
+            if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "def", 3))
                 return kmk_cc_eval_do_ifdef(pCompiler, pchWord + 3, cchLeft - 3, 1 /* in else */, 1 /* positive */);
 
-            if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "neq", 3))
+            if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "neq", 3))
                 return kmk_cc_eval_do_ifeq( pCompiler, pchWord + 3, cchLeft - 3, 1 /* in else */, 0 /* positive */);
 
-            if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "1of", 3))
+            if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "1of", 3))
                 return kmk_cc_eval_do_if1of(pCompiler, pchWord + 3, cchLeft - 3, 1 /* in else */, 1 /* positive */);
 
-            if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "ndef", 4))
+            if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "ndef", 4))
                 return kmk_cc_eval_do_ifdef(pCompiler, pchWord + 4, cchLeft - 4, 1 /* in else */, 0 /* positive */);
 
-            if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "n1of", 4))
+            if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "n1of", 4))
                 return kmk_cc_eval_do_if1of(pCompiler, pchWord + 4, cchLeft - 4, 1 /* in else */, 0 /* positive */);
 
             pchWord -= 2;
@@ -5299,7 +5312,7 @@ static int kmk_cc_eval_do_include(PKMKCCEVALCOMPILER pCompiler, const char *pchW
             PKMKCCEVALINCLUDE pInstr = (PKMKCCEVALINCLUDE)kmk_cc_block_alloc_eval(pCompiler->ppBlockTail,
                                                                                   KMKCCEVALINCLUDE_SIZE(cWords));
             pInstr->Core.enmOpcode = enmOpcode;
-            pInstr->Core.iLine     = 0;
+            pInstr->Core.iLine     = pCompiler->iLine;
             pInstr->cFiles         = cWords;
             kmk_cc_eval_init_spp_array_from_duplicated_words(pCompiler, cWords, pCompiler->paWords, pInstr->aFiles);
             kmk_cc_block_realign(pCompiler->ppBlockTail);
@@ -5329,7 +5342,7 @@ static void kmk_cc_eval_handle_command(PKMKCCEVALCOMPILER pCompiler, const char
 static int kmk_cc_eval_handle_recipe_cont_colon(PKMKCCEVALCOMPILER pCompiler, const char *pchWord0, size_t cchWord0,
                                                 const char *pchColon, size_t cchLeft, unsigned fQualifiers)
 {
-    kmk_cc_eval_fatal(pCompiler, pchWord0, "recipe handling not implemented yet");
+    kmk_cc_eval_fatal(pCompiler, pchWord0, "recipe handling not implemented yet (#1)");
     return 1;
 }
 
@@ -5337,14 +5350,14 @@ static int kmk_cc_eval_handle_recipe_cont_colon(PKMKCCEVALCOMPILER pCompiler, co
 static int kmk_cc_eval_handle_recipe_cont_2nd_word(PKMKCCEVALCOMPILER pCompiler, const char *pchWord0, size_t cchWord0,
                                                    const char *pchWord, size_t cchLeft, unsigned fQualifiers)
 {
-    kmk_cc_eval_fatal(pCompiler, pchWord, "recipe handling not implemented yet");
+    kmk_cc_eval_fatal(pCompiler, pchWord, "recipe handling not implemented yet (#2)");
     return 1;
 }
 
 
 static void kmk_cc_eval_handle_recipe(PKMKCCEVALCOMPILER pCompiler, const char *pszEqual, const char *pchWord, size_t cchLeft)
 {
-    kmk_cc_eval_fatal(pCompiler, pchWord, "recipe handling not implemented yet");
+    kmk_cc_eval_fatal(pCompiler, pchWord, "recipe handling not implemented yet (#3)");
 }
 
 static void kmk_cc_eval_end_of_recipe(PKMKCCEVALCOMPILER pCompiler)
@@ -5357,7 +5370,48 @@ static void kmk_cc_eval_end_of_recipe(PKMKCCEVALCOMPILER pCompiler)
 
 
 /**
- * Parses a 'undefine variable [..]' expression.
+ * Common worker for handling export (non-assign), undefine and unexport.
+ *
+ * For instructions using the KMKCCEVALVARIABLES structure.
+ *
+ * @returns 1 to indicate we've handled a keyword (see
+ *          kmk_cc_eval_try_handle_keyword).
+ * @param   pCompiler   The compiler state.
+ * @param   pchWord     First non-space chare after the keyword.
+ * @param   cchLeft     The number of chars left to parse on this line.
+ * @param   fQualifiers The qualifiers.
+ */
+static int kmk_cc_eval_do_with_variable_list(PKMKCCEVALCOMPILER pCompiler, const char *pchWord, size_t cchLeft,
+                                             KMKCCEVALINSTR enmOpcode, unsigned fQualifiers)
+{
+    if (cchLeft)
+    {
+        /*
+         * Parse the variable name list.  GNU make is using normal word
+         * handling here, so we can share code with the include directives.
+         */
+        unsigned cWords = kmk_cc_eval_parse_words(pCompiler, pchWord, cchLeft);
+        KMK_CC_EVAL_DPRINTF(("%s: cWords=%d\n", g_apszEvalInstrNms[enmOpcode], cWords));
+        if (cWords)
+        {
+            PKMKCCEVALVARIABLES pInstr = (PKMKCCEVALVARIABLES)kmk_cc_block_alloc_eval(pCompiler->ppBlockTail,
+                                                                                      KMKCCEVALVARIABLES_SIZE(cWords));
+            pInstr->Core.enmOpcode = enmOpcode;
+            pInstr->Core.iLine     = pCompiler->iLine;
+            pInstr->cVars         = cWords;
+            kmk_cc_eval_init_spp_array_from_duplicated_words(pCompiler, cWords, pCompiler->paWords, pInstr->aVars);
+            kmk_cc_block_realign(pCompiler->ppBlockTail);
+        }
+        else
+            KMK_CC_ASSERT(0);
+    }
+    /* else: NOP */
+    return 1;
+}
+
+
+/**
+ * Parses a '[qualifiers] undefine variable [..]' expression.
  *
  * A 'undefine' directive is final, any qualifiers must preceed it.  So, we just
  * have to extract the variable names now.
@@ -5371,7 +5425,47 @@ static void kmk_cc_eval_end_of_recipe(PKMKCCEVALCOMPILER pCompiler)
  */
 static int kmk_cc_eval_do_var_undefine(PKMKCCEVALCOMPILER pCompiler, const char *pchWord, size_t cchLeft, unsigned fQualifiers)
 {
-    kmk_cc_eval_fatal(pCompiler, pchWord, "undefine handling not implemented yet");
+    KMK_CC_EVAL_SKIP_SPACES_AFTER_WORD(pCompiler, pchWord, cchLeft);
+    if (!cchLeft)
+        kmk_cc_eval_fatal(pCompiler, pchWord, "undefine requires a variable name");
+
+    /** @todo GNU make doesn't actually do the list thing for undefine, it seems
+     *        to assume everything after it is a single variable...  Going with
+     *        simple common code for now. */
+    return kmk_cc_eval_do_with_variable_list(pCompiler, pchWord, cchLeft, kKmkCcEvalInstr_undefine, fQualifiers);
+}
+
+
+/**
+ * Parses a '[qualifiers] unexport variable [..]' expression.
+ *
+ * A 'unexport' directive is final, any qualifiers must preceed it.  So, we just
+ * have to extract the variable names now.
+ *
+ * @returns 1 to indicate we've handled a keyword (see
+ *          kmk_cc_eval_try_handle_keyword).
+ * @param   pCompiler   The compiler state.
+ * @param   pchWord     First char after 'define'.
+ * @param   cchLeft     The number of chars left to parse on this line.
+ * @param   fQualifiers The qualifiers.
+ */
+static int kmk_cc_eval_do_var_unexport(PKMKCCEVALCOMPILER pCompiler, const char *pchWord, size_t cchLeft, unsigned fQualifiers)
+{
+    PKMKCCEVALCORE pInstr;
+
+    /*
+     * Join paths with undefine and export, unless it's an unexport all directive.
+     */
+    KMK_CC_EVAL_SKIP_SPACES_AFTER_WORD(pCompiler, pchWord, cchLeft);
+    if (cchLeft)
+        return kmk_cc_eval_do_with_variable_list(pCompiler, pchWord, cchLeft, kKmkCcEvalInstr_unexport, fQualifiers);
+
+    /*
+     * We're unexporting all variables.
+     */
+    pInstr = kmk_cc_block_alloc_eval(pCompiler->ppBlockTail, sizeof(*pInstr));
+    pInstr->enmOpcode = kKmkCcEvalInstr_unexport_all;
+    pInstr->iLine     = pCompiler->iLine;
     return 1;
 }
 
@@ -5399,8 +5493,8 @@ static int kmk_cc_eval_do_var_define(PKMKCCEVALCOMPILER pCompiler, const char *p
 }
 
 
-static int kmk_cc_eval_handle_assignment_or_recipe(PKMKCCEVALCOMPILER pCompiler, const char *pchTmp,
-                                                   const char *pchWord, size_t cchLeft, unsigned fQualifiers)
+static int kmk_cc_eval_handle_assignment_or_recipe(PKMKCCEVALCOMPILER pCompiler, const char *pchWord, size_t cchLeft,
+                                                   unsigned fQualifiers)
 {
     /*
      * We're currently at a word which may or may not be a variable name
@@ -5617,6 +5711,7 @@ static int kmk_cc_eval_handle_assignment_or_recipe(PKMKCCEVALCOMPILER pCompiler,
         cchValue    = kmk_cc_eval_prep_normal_line(pCompiler, pchWord, cchLeft);
         fPlainValue = memchr(pchWord, '$', cchLeft) == NULL;
 
+
         /*
          * Emit the instruction.
          */
@@ -5656,7 +5751,8 @@ static int kmk_cc_eval_handle_assignment_or_recipe(PKMKCCEVALCOMPILER pCompiler,
 
 
 /**
- * Parses a 'local [override] variable = value' expression.
+ * Parses a 'local [override] variable = value', 'local define variable', and
+ * 'local undefine variable [...]' expressions.
  *
  * The 'local' directive must be first and it does not permit any qualifiers at
  * the moment.  Should any be added later, they will have to come after 'local'.
@@ -5674,33 +5770,20 @@ static int kmk_cc_eval_do_var_local(PKMKCCEVALCOMPILER pCompiler, const char *pc
     if (cchLeft)
     {
         /*
-         * Find the end of the variable name.
+         * Check for 'local define' and 'local undefine'
          */
+        if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "define", 6))   /* final */
+            return kmk_cc_eval_do_var_define(pCompiler, pchWord + 6, cchLeft + 6, KMK_CC_EVAL_QUALIFIER_LOCAL);
+        if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "undefine", 8))   /* final */
+            return kmk_cc_eval_do_var_undefine(pCompiler, pchWord + 8, cchLeft + 8, KMK_CC_EVAL_QUALIFIER_LOCAL);
 
+        /*
+         * Simpler to just join paths with the rest here, even if we could
+         * probably optimize the parsing a little if we liked.
+         */
+        return kmk_cc_eval_handle_assignment_or_recipe(pCompiler, pchWord, cchLeft, KMK_CC_EVAL_QUALIFIER_LOCAL);
     }
-    else
-        kmk_cc_eval_fatal(pCompiler, pchWord, "Expected variable name, assignment operator and value after 'local'");
-    return 1;
-}
-
-
-/**
- * Parses 'export [variable]' and 'export [qualifiers] variable = value'
- * expressions.
- *
- * When we find the 'export' directive at the start of a line, we need to
- * continue parsing with till we can tell the difference between the two forms.
- *
- * @returns 1 to indicate we've handled a keyword (see
- *          kmk_cc_eval_try_handle_keyword).
- * @param   pCompiler   The compiler state.
- * @param   pchWord     First char after 'define'.
- * @param   cchLeft     The number of chars left to parse on this line.
- * @param   fQualifiers The qualifiers.
- */
-static int kmk_cc_eval_handle_var_export(PKMKCCEVALCOMPILER pCompiler, const char *pchWord, size_t cchLeft, unsigned fQualifiers)
-{
-    kmk_cc_eval_fatal(pCompiler, pchWord, "export not implemented yet");
+    kmk_cc_eval_fatal(pCompiler, pchWord, "Expected variable name, assignment operator and value after 'local'");
     return 1;
 }
 
@@ -5726,13 +5809,16 @@ static int kmk_cc_eval_try_handle_var_with_keywords(PKMKCCEVALCOMPILER pCompiler
             char ch = *pchWord;
             if (KMK_CC_EVAL_IS_1ST_IN_VARIABLE_KEYWORD(ch))
             {
-                if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "define", 6))   /* final */
+                if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "define", 6))   /* final */
                     return kmk_cc_eval_do_var_define(pCompiler, pchWord + 6, cchLeft - 6, fQualifiers);
 
-                if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "undefine", 8)) /* final */
-                    return kmk_cc_eval_do_var_undefine(pCompiler, pchWord + 6, cchLeft - 6, fQualifiers);
+                if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "undefine", 8)) /* final */
+                    return kmk_cc_eval_do_var_undefine(pCompiler, pchWord + 8, cchLeft -86, fQualifiers);
 
-                if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "export", 6))
+                if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "unexport", 8)) /* final */
+                    return kmk_cc_eval_do_var_unexport(pCompiler, pchWord + 8, cchLeft - 8, fQualifiers);
+
+                if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "export", 6))
                 {
                     if (!(fQualifiers & KMK_CC_EVAL_QUALIFIER_EXPORT))
                         fQualifiers |= KMK_CC_EVAL_QUALIFIER_EXPORT;
@@ -5743,7 +5829,7 @@ static int kmk_cc_eval_try_handle_var_with_keywords(PKMKCCEVALCOMPILER pCompiler
                     continue;
                 }
 
-                if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "override", 8))
+                if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "override", 8))
                 {
                     if (!(fQualifiers & KMK_CC_EVAL_QUALIFIER_OVERRIDE))
                         fQualifiers |= KMK_CC_EVAL_QUALIFIER_OVERRIDE;
@@ -5754,7 +5840,7 @@ static int kmk_cc_eval_try_handle_var_with_keywords(PKMKCCEVALCOMPILER pCompiler
                     continue;
                 }
 
-                if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "private", 7))
+                if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "private", 7))
                 {
                     if (!(fQualifiers & KMK_CC_EVAL_QUALIFIER_PRIVATE))
                         fQualifiers |= KMK_CC_EVAL_QUALIFIER_PRIVATE;
@@ -5774,7 +5860,7 @@ static int kmk_cc_eval_try_handle_var_with_keywords(PKMKCCEVALCOMPILER pCompiler
             {
                 const char *pchEqual = (const char *)memchr(pchWord, '=', cchLeft);
                 if (pchEqual)
-                    return kmk_cc_eval_handle_assignment_or_recipe(pCompiler, pchEqual, pchWord, cchLeft, fQualifiers);
+                    return kmk_cc_eval_handle_assignment_or_recipe(pCompiler, pchWord, cchLeft, fQualifiers);
             }
             return 0;
         }
@@ -5786,6 +5872,122 @@ static int kmk_cc_eval_try_handle_var_with_keywords(PKMKCCEVALCOMPILER pCompiler
 
 
 /**
+ * Parses 'export [variable]' and 'export [qualifiers] variable = value'
+ * expressions.
+ *
+ * When we find the 'export' directive at the start of a line, we need to
+ * continue parsing with till we can tell the difference between the two forms.
+ *
+ * @returns 1 to indicate we've handled a keyword (see
+ *          kmk_cc_eval_try_handle_keyword).
+ * @param   pCompiler   The compiler state.
+ * @param   pchWord     First char after 'define'.
+ * @param   cchLeft     The number of chars left to parse on this line.
+ */
+static int kmk_cc_eval_handle_var_export(PKMKCCEVALCOMPILER pCompiler, const char *pchWord, size_t cchLeft)
+{
+    KMK_CC_EVAL_SKIP_SPACES_AFTER_WORD(pCompiler, pchWord, cchLeft);
+
+    if (cchLeft)
+    {
+        unsigned iSavedEscEol;
+        unsigned cWords;
+
+        /*
+         * We need to figure out whether this is an assignment or a export statement,
+         * in the latter case join paths with 'export' and 'undefine'.
+         */
+        const char *pchEqual = (const char *)memchr(pchWord, '=', cchLeft);
+        if (!pchEqual)
+            return kmk_cc_eval_do_with_variable_list(pCompiler, pchWord, cchLeft, kKmkCcEvalInstr_export, 0 /*fQualifiers*/);
+
+        /*
+         * Found an '=', could be an assignment.  Let's take the easy way out
+         * and just parse the whole statement into words like we would do if
+         * it wasn't an assignment, and then check the words out for
+         * assignment keywords and operators.
+         */
+        iSavedEscEol = pCompiler->iEscEol;
+        cWords       = kmk_cc_eval_parse_words(pCompiler, pchWord, cchLeft);
+        if (cWords)
+        {
+            PKMKCCEVALVARIABLES pInstr;
+            PKMKCCEVALWORD pWord = pCompiler->paWords;
+            unsigned       iWord = 0;
+            while (iWord < cWords)
+            {
+                /* Trailing assignment operator or terminal assignment directive ('undefine'
+                   and 'unexport' makes no sense here but GNU make ignores that). */
+                if (   (   pWord->cchWord > 1
+                        && pWord->pchWord[pWord->cchWord - 1] == '=')
+                    || KMK_CC_STRCMP_CONST(pWord->pchWord, pWord->cchWord, "define", 6)
+                    || KMK_CC_STRCMP_CONST(pWord->pchWord, pWord->cchWord, "undefine", 8)
+                    || KMK_CC_STRCMP_CONST(pWord->pchWord, pWord->cchWord, "unexport", 8) )
+                {
+                    pCompiler->iEscEol = iSavedEscEol;
+                    return kmk_cc_eval_try_handle_var_with_keywords(pCompiler, pchWord, cchLeft, KMK_CC_EVAL_QUALIFIER_EXPORT);
+                }
+
+                /* If not a variable assignment qualifier, it must be a variable name
+                   followed by an assignment operator. */
+                if (iWord + 1 < cWords)
+                {
+                    if (   !KMK_CC_STRCMP_CONST(pWord->pchWord, pWord->cchWord, "export", 6)
+                        && !KMK_CC_STRCMP_CONST(pWord->pchWord, pWord->cchWord, "private", 7)
+                        && !KMK_CC_STRCMP_CONST(pWord->pchWord, pWord->cchWord, "override", 8))
+                    {
+                        pWord++;
+                        if (   pWord->cchWord > 0
+                            && (   pWord->pchWord[0] == '='
+                                || (   pWord->cchWord > 1
+                                    && pWord->pchWord[1] == '='
+                                    && (   pWord->pchWord[0] == ':'
+                                        || pWord->pchWord[0] == '+'
+                                        || pWord->pchWord[0] == '?'
+                                        || pWord->pchWord[0] == '<') ) ) )
+                        {
+                            pCompiler->iEscEol = iSavedEscEol;
+                            return kmk_cc_eval_try_handle_var_with_keywords(pCompiler, pchWord, cchLeft,
+                                                                            KMK_CC_EVAL_QUALIFIER_EXPORT);
+                        }
+                        break;
+                    }
+                }
+                else
+                    break;
+                /* next */
+                pWord++;
+                iWord++;
+            }
+
+            /*
+             * It's not an assignment.
+             * (This is the same as kmk_cc_eval_do_with_variable_list does.)
+             */
+            pInstr = (PKMKCCEVALVARIABLES)kmk_cc_block_alloc_eval(pCompiler->ppBlockTail, KMKCCEVALVARIABLES_SIZE(cWords));
+            pInstr->Core.enmOpcode = kKmkCcEvalInstr_export;
+            pInstr->Core.iLine     = pCompiler->iLine;
+            pInstr->cVars          = cWords;
+            kmk_cc_eval_init_spp_array_from_duplicated_words(pCompiler, cWords, pCompiler->paWords, pInstr->aVars);
+            kmk_cc_block_realign(pCompiler->ppBlockTail);
+        }
+        else
+            KMK_CC_ASSERT(0);
+    }
+    else
+    {
+        /*
+         * We're exporting all variables.
+         */
+        PKMKCCEVALCORE pInstr = kmk_cc_block_alloc_eval(pCompiler->ppBlockTail, sizeof(*pInstr));
+        pInstr->enmOpcode = kKmkCcEvalInstr_export_all;
+        pInstr->iLine     = pCompiler->iLine;
+    }
+    return 1;
+}
+
+
+/**
  * When entering this function we know that the first two character in the first
  * word both independently occurs in keywords.
  *
@@ -5810,21 +6012,23 @@ int kmk_cc_eval_try_handle_keyword(PKMKCCEVALCOMPILER pCompiler, char ch, const
      */
     if (KMK_CC_EVAL_IS_1ST_IN_VARIABLE_KEYWORD(ch))
     {
-        if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "local", 5))
+        if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "local", 5))
             return kmk_cc_eval_do_var_local(pCompiler, pchWord + 5, cchLeft - 5);
-        if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "define", 6))
+        if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "define", 6))
             return kmk_cc_eval_do_var_define(pCompiler, pchWord + 6, cchLeft - 6, 0);
-        if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "export", 6))
-            return kmk_cc_eval_handle_var_export(pCompiler, pchWord + 6, cchLeft - 6, 0);
-        if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "undefine", 8))
+        if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "export", 6))
+            return kmk_cc_eval_handle_var_export(pCompiler, pchWord + 6, cchLeft - 6);
+        if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "undefine", 8))
             return kmk_cc_eval_do_var_undefine(pCompiler, pchWord + 8, cchLeft - 8, 0);
-        if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "override", 8))
+        if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "unexport", 8))
+            return kmk_cc_eval_do_var_unexport(pCompiler, pchWord + 8, cchLeft - 8, 0);
+        if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "override", 8))
         {
             if (kmk_cc_eval_try_handle_var_with_keywords(pCompiler, pchWord + 8, cchLeft - 8, KMK_CC_EVAL_QUALIFIER_OVERRIDE))
                 return 1;
             pCompiler->iEscEol = iSavedEscEol;
         }
-        else if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "private", 7))
+        else if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "private", 7))
         {
             if (kmk_cc_eval_try_handle_var_with_keywords(pCompiler, pchWord + 7, cchLeft - 7, KMK_CC_EVAL_QUALIFIER_PRIVATE))
                 return 1;
@@ -5844,25 +6048,25 @@ int kmk_cc_eval_try_handle_keyword(PKMKCCEVALCOMPILER pCompiler, char ch, const
         /* 'if...' */
         if (ch2 == 'f')
         {
-            if (KMK_CC_WORD_COMP_IS_EOL(pCompiler, pchWord, cchLeft))
+            if (KMK_CC_EVAL_WORD_COMP_IS_EOL(pCompiler, pchWord, cchLeft))
                 return kmk_cc_eval_do_if(pCompiler, pchWord, cchLeft, 0 /* in else */);
 
-            if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "eq", 2))
+            if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "eq", 2))
                 return kmk_cc_eval_do_ifeq( pCompiler, pchWord + 2, cchLeft - 2, 0 /* in else */, 1 /* positive */);
 
-            if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "def", 3))
+            if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "def", 3))
                 return kmk_cc_eval_do_ifdef(pCompiler, pchWord + 3, cchLeft - 3, 0 /* in else */, 1 /* positive */);
 
-            if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "neq", 3))
+            if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "neq", 3))
                 return kmk_cc_eval_do_ifeq( pCompiler, pchWord + 3, cchLeft - 3, 0 /* in else */, 0 /* positive */);
 
-            if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "1of", 3))
+            if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "1of", 3))
                 return kmk_cc_eval_do_if1of(pCompiler, pchWord + 3, cchLeft - 3, 0 /* in else */, 1 /* positive */);
 
-            if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "ndef", 4))
+            if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "ndef", 4))
                 return kmk_cc_eval_do_ifdef(pCompiler, pchWord + 4, cchLeft - 4, 0 /* in else */, 0 /* positive */);
 
-            if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "n1of", 4))
+            if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "n1of", 4))
                 return kmk_cc_eval_do_if1of(pCompiler, pchWord + 4, cchLeft - 4, 0 /* in else */, 0 /* positive */);
         }
         /* include... */
@@ -5870,45 +6074,45 @@ int kmk_cc_eval_try_handle_keyword(PKMKCCEVALCOMPILER pCompiler, char ch, const
         {
             pchWord += 5;
             cchLeft -= 5;
-            if (KMK_CC_WORD_COMP_IS_EOL(pCompiler, pchWord, cchLeft))
+            if (KMK_CC_EVAL_WORD_COMP_IS_EOL(pCompiler, pchWord, cchLeft))
                 return kmk_cc_eval_do_include(pCompiler, pchWord, cchLeft, kKmkCcEvalInstr_include);
             if (cchLeft >= 3 && KMK_CC_WORD_COMP_CONST_3(pchWord, "dep"))
             {
                 pchWord += 3;
                 cchLeft -= 3;
-                if (KMK_CC_WORD_COMP_IS_EOL(pCompiler, pchWord, cchLeft))
+                if (KMK_CC_EVAL_WORD_COMP_IS_EOL(pCompiler, pchWord, cchLeft))
                     return kmk_cc_eval_do_include(pCompiler, pchWord, cchLeft, kKmkCcEvalInstr_includedep);
-                if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "-queue", 6))
+                if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "-queue", 6))
                     return kmk_cc_eval_do_include(pCompiler, pchWord + 6, cchLeft - 6, kKmkCcEvalInstr_includedep_queue);
-                if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "-flush", 6))
+                if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "-flush", 6))
                     return kmk_cc_eval_do_include(pCompiler, pchWord + 6, cchLeft - 6, kKmkCcEvalInstr_includedep_flush);
             }
         }
     }
     else if (ch == 'e') /* A few directives starts with 'e'. */
     {
-        if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "else", 4))
+        if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "else", 4))
             return kmk_cc_eval_do_else(pCompiler, pchWord + 4, cchLeft - 4);
-        if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "endif", 5))
+        if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "endif", 5))
             return kmk_cc_eval_do_endif(pCompiler, pchWord + 5, cchLeft - 5);
         /* export and endef are handled elsewhere, though stray endef's may end up here... */
-        KMK_CC_ASSERT(!KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "export", 6));
+        KMK_CC_ASSERT(!KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "export", 6));
 
     }
     else /* the rest. */
     {
-        if (   KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "sinclude", 8)
-            || KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "-include", 8))
+        if (   KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "sinclude", 8)
+            || KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "-include", 8))
             return kmk_cc_eval_do_include(pCompiler, pchWord + 8, cchLeft - 8, kKmkCcEvalInstr_include_silent);
-        if (KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "vpath", 5))
+        if (KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "vpath", 5))
             return kmk_cc_eval_do_vpath(pCompiler, pchWord + 5, cchLeft - 5);
 
-        KMK_CC_ASSERT(!KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "local", 5));
-        KMK_CC_ASSERT(!KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "define", 6));
-        KMK_CC_ASSERT(!KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "private", 7));
-        KMK_CC_ASSERT(!KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "override", 8));
-        KMK_CC_ASSERT(!KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "unexport", 8));
-        KMK_CC_ASSERT(!KMK_CC_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "undefine", 8));
+        KMK_CC_ASSERT(!KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "local", 5));
+        KMK_CC_ASSERT(!KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "define", 6));
+        KMK_CC_ASSERT(!KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "private", 7));
+        KMK_CC_ASSERT(!KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "override", 8));
+        KMK_CC_ASSERT(!KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "unexport", 8));
+        KMK_CC_ASSERT(!KMK_CC_EVAL_WORD_COMP_CONST(pCompiler, pchWord, cchLeft, "undefine", 8));
     }
 
     pCompiler->iEscEol = iSavedEscEol;
@@ -6148,7 +6352,7 @@ static int kmk_cc_eval_compile_worker(PKMKCCEVALPROG pEvalProg, const char *pszC
                     {
                         pchTmp = (const char *)memchr(pchWord, '=', cchLeft);
                         if (pchTmp)
-                            kmk_cc_eval_handle_assignment_or_recipe(&Compiler, pchTmp, pchWord, cchLeft, 0);
+                            kmk_cc_eval_handle_assignment_or_recipe(&Compiler, pchWord, cchLeft, 0 /*fQualifiers*/);
                         else
                             kmk_cc_eval_handle_recipe(&Compiler, pchTmp, pchWord, cchLeft);
                     }
diff --git a/src/kmk/kmkbuiltin/kDepObj.c b/src/kmk/kmkbuiltin/kDepObj.c
index 7b42a59..3469088 100644
--- a/src/kmk/kmkbuiltin/kDepObj.c
+++ b/src/kmk/kmkbuiltin/kDepObj.c
@@ -1,4 +1,4 @@
-/* $Id: kDepObj.c 2759 2015-01-28 16:14:00Z bird $ */
+/* $Id: kDepObj.c 2804 2016-01-07 20:47:06Z bird $ */
 /** @file
  * kDepObj - Extract dependency information from an object file.
  */
@@ -54,7 +54,6 @@
 *   Defined Constants And Macros                                               *
 *******************************************************************************/
 /*#define DEBUG*/
-#define DEBUG
 #ifdef DEBUG
 # define dprintf(a)             printf a
 # define dump(pb, cb, offBase)  depHexDump(pb,cb,offBase)
diff --git a/src/kmk/kmkbuiltin/redirect.c b/src/kmk/kmkbuiltin/redirect.c
index b928215..c1fdfd2 100644
--- a/src/kmk/kmkbuiltin/redirect.c
+++ b/src/kmk/kmkbuiltin/redirect.c
@@ -1,10 +1,10 @@
-/* $Id: redirect.c 2779 2015-02-24 03:50:12Z bird $ */
+/* $Id: redirect.c 2812 2016-03-13 11:22:53Z bird $ */
 /** @file
  * kmk_redirect - Do simple program <-> file redirection (++).
  */
 
 /*
- * Copyright (c) 2007-2014 knut st. osmundsen <bird-kBuild-spamx at anduin.net>
+ * Copyright (c) 2007-2016 knut st. osmundsen <bird-kBuild-spamx at anduin.net>
  *
  * This file is part of kBuild.
  *
@@ -33,6 +33,7 @@
 #include <errno.h>
 #include <fcntl.h>
 #if defined(_MSC_VER)
+# include <ctype.h>
 # include <io.h>
 # include <direct.h>
 # include <process.h>
@@ -49,7 +50,46 @@
 #endif
 
 
+/*********************************************************************************************************************************
+*   Global Variables                                                                                                             *
+*********************************************************************************************************************************/
+/** Number of times the '-v' switch was seen. */
+static unsigned g_cVerbosity = 0;
+
+
 #if defined(_MSC_VER)
+
+/**
+ * Checks if this is an Watcom option where we must just pass thru the string
+ * as-is.
+ *
+ * This is currnetly only used for -d (defining macros).
+ *
+ * @returns 1 if pass-thru, 0 if not.
+ * @param   pszArg          The argument to consider.
+ */
+static int isWatcomPassThruOption(const char *pszArg)
+{
+    char ch = *pszArg++;
+    if (ch != '-' && ch != '/')
+        return 0;
+    ch = *pszArg++;
+    switch (ch)
+    {
+        /* Example: -d+VAR="string-value" */
+        case 'd':
+            if (ch == '+')
+                ch = *pszArg++;
+            if (!isalpha(ch) && ch != '_')
+                return 0;
+            return 1;
+
+        default:
+            return 0;
+    }
+}
+
+
 /**
  * Replaces arguments in need of quoting.
  *
@@ -64,13 +104,15 @@
  * @param   fWatcomBrainDamage  Set if we're catering for wcc, wcc386 or similar
  *                              OpenWatcom tools.  They seem to follow some
  *                              ancient or home made quoting convention.
+ * @param   pStdErr             For verbose debug info.
  */
-static void quoteArguments(int argc, char **argv, int fWatcomBrainDamage)
+static void quoteArguments(int argc, char **argv, int fWatcomBrainDamage, FILE *pStdErr)
 {
     int i;
     for (i = 0; i < argc; i++)
     {
-        const char *pszOrg    = argv[i];
+        const char *pszOrgOrg = argv[i];
+        const char *pszOrg    = pszOrgOrg;
         size_t      cchOrg    = strlen(pszOrg);
         const char *pszQuotes = (const char *)memchr(pszOrg, '"', cchOrg);
         const char *pszProblem = NULL;
@@ -93,12 +135,13 @@ static void quoteArguments(int argc, char **argv, int fWatcomBrainDamage)
             char   ch;
             int    fComplicated = pszQuotes || (cchOrg > 0 && pszOrg[cchOrg - 1] == '\\');
             size_t cchNew       = fComplicated ? cchOrg * 2 + 2 : cchOrg + 2;
-            char  *pszNew       = (char *)malloc(cchNew + 1);
+            char  *pszNew       = (char *)malloc(cchNew + 1 /*term*/ + 3 /*passthru hack*/);
 
             argv[i] = pszNew;
 
-            /* Watcom does not grok "-i=c:\program files\watcom\h", it thing
-               it's a source specification. The quote must follow the equal. */
+            /* Watcom does not grok stuff like "-i=c:\program files\watcom\h",
+               it think it's a source specification. In that case the quote
+               must follow the equal sign. */
             if (fWatcomBrainDamage)
             {
                 size_t cchUnquoted  = 0;
@@ -106,13 +149,18 @@ static void quoteArguments(int argc, char **argv, int fWatcomBrainDamage)
                     cchUnquoted = 1;
                 else if (pszOrg[0] == '-' || pszOrg[0] == '/') /* Switch quoting. */
                 {
-                    const char *pszNeedQuoting = (const char *)memchr(pszOrg, '=', cchOrg);
-                    if (   pszNeedQuoting == NULL
-                        || (uintptr_t)pszNeedQuoting > (uintptr_t)(pszProblem ? pszProblem : pszQuotes))
-                        pszNeedQuoting = pszProblem ? pszProblem : pszQuotes;
+                    if (isWatcomPassThruOption(pszOrg))
+                        cchUnquoted = strlen(pszOrg) + 1;
                     else
-                        pszNeedQuoting++;
-                    cchUnquoted = pszNeedQuoting - pszOrg;
+                    {
+                        const char *pszNeedQuoting = (const char *)memchr(pszOrg, '=', cchOrg); /* For -i=dir and similar. */
+                        if (   pszNeedQuoting == NULL
+                            || (uintptr_t)pszNeedQuoting > (uintptr_t)(pszProblem ? pszProblem : pszQuotes))
+                            pszNeedQuoting = pszProblem ? pszProblem : pszQuotes;
+                        else
+                            pszNeedQuoting++;
+                        cchUnquoted = pszNeedQuoting - pszOrg;
+                    }
                 }
                 if (cchUnquoted)
                 {
@@ -168,19 +216,29 @@ static void quoteArguments(int argc, char **argv, int fWatcomBrainDamage)
             *pszNew++ = '"';
             *pszNew = '\0';
         }
+
+        if (g_cVerbosity > 0)
+        {
+            if (argv[i] == pszOrgOrg)
+                fprintf(pStdErr, "kmk_redirect: debug: argv[%i]=%s<eos>\n", i, pszOrgOrg);
+            else
+            {
+                fprintf(pStdErr, "kmk_redirect: debug: argv[%i]=%s<eos>\n", i, argv[i]);
+                fprintf(pStdErr, "kmk_redirect: debug:(orig[%i]=%s<eos>)\n", i, pszOrgOrg);
+            }
+        }
     }
 
     /*for (i = 0; i < argc; i++) fprintf(stderr, "argv[%u]=%s;;\n", i, argv[i]);*/
 }
-#endif /* _MSC_VER */
 
 
-#ifdef _MSC_VER
 /** Used by safeCloseFd. */
 static void __cdecl ignore_invalid_parameter(const wchar_t *a, const wchar_t *b, const wchar_t *c, unsigned d, uintptr_t e)
 {
 }
-#endif
+
+#endif /* _MSC_VER */
 
 
 /**
@@ -218,7 +276,7 @@ static const char *name(const char *pszName)
 static int usage(FILE *pOut,  const char *argv0)
 {
     fprintf(pOut,
-            "usage: %s [-[rwa+tb]<fd> <file>] [-c<fd>] [-Z] [-E <var=val>] [-C <dir>] [--wcc-brain-damage] -- <program> [args]\n"
+            "usage: %s [-[rwa+tb]<fd> <file>] [-c<fd>] [-Z] [-E <var=val>] [-C <dir>] [--wcc-brain-damage] [-v] -- <program> [args]\n"
             "   or: %s --help\n"
             "   or: %s --version\n"
             "\n"
@@ -241,6 +299,8 @@ static int usage(FILE *pOut,  const char *argv0)
             "The --wcc-brain-damage switch is to work around wcc and wcc386 (Open Watcom)\n"
             "not following normal quoting conventions on Windows, OS/2, and DOS.\n"
             "\n"
+            "The -v switch is for making the thing more verbose.\n"
+            "\n"
             "This command was originally just a quick hack to avoid invoking the shell\n"
             "on Windows (cygwin) where forking is very expensive and has exhibited\n"
             "stability issues on SMP machines.  It has since grown into something like\n"
@@ -256,6 +316,8 @@ int main(int argc, char **argv, char **envp)
     int i;
 #if defined(_MSC_VER)
     intptr_t rc;
+#else
+    int j;
 #endif
     FILE *pStdErr = stderr;
     FILE *pStdOut = stdout;
@@ -469,6 +531,15 @@ int main(int argc, char **argv, char **envp)
             }
 
             /*
+             * Verbose operation switch?
+             */
+            if (*psz == 'v')
+            {
+                g_cVerbosity++;
+                continue;
+            }
+
+            /*
              * Close the specified file descriptor (no stderr/out/in aliases).
              */
             if (*psz == 'c')
@@ -749,7 +820,7 @@ int main(int argc, char **argv, char **envp)
     }
 
     /* MSC is a PITA since it refuses to quote the arguments... */
-    quoteArguments(argc - i, &argv[i], fWatcomBrainDamage);
+    quoteArguments(argc - i, &argv[i], fWatcomBrainDamage, pStdErr);
     rc = _spawnvp(_P_WAIT, argv[i], &argv[i]);
     if (rc == -1 && pStdErr)
     {
@@ -758,6 +829,9 @@ int main(int argc, char **argv, char **envp)
     }
     return rc;
 #else
+    if (g_cVerbosity > 0)
+        for (j = i; j < argc; j++)
+            fprintf(pStdErr, "kmk_redirect: debug: argv[%i]=%s<eos>\n", j - i, argv[j]);
     execvp(argv[i], &argv[i]);
     fprintf(pStdErr, "%s: error: _execvp(_P_WAIT, \"%s\", ...) failed: %s\n", name(argv[0]), argv[i], strerror(errno));
     return 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-virtualbox/kbuild.git



More information about the Pkg-virtualbox-commits mailing list