author: Fathi Boudra <fabo@debian.org>

--- a/config.tests/unix/compile.test
+++ b/config.tests/unix/compile.test
@@ -66,7 +66,7 @@ cd "$OUTDIR/$TEST"
 
 test -r Makefile && $MAKE distclean >/dev/null 2>&1
 
-"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
+"$OUTDIR/bin/qmake-qt4" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
 
 if [ "$VERBOSE" = "yes" ]; then
     $MAKE
--- a/config.tests/unix/doubleformat.test
+++ b/config.tests/unix/doubleformat.test
@@ -10,7 +10,7 @@ OUTDIR=$4
 
 # build and run a test program
 test -d "$OUTDIR/config.tests/unix/doubleformat" || mkdir -p "$OUTDIR/config.tests/unix/doubleformat"
-"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/doubleformat/doubleformattest.pro" -o "$OUTDIR/config.tests/unix/doubleformat/Makefile" >/dev/null 2>&1
+"$OUTDIR/bin/qmake-qt4" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/doubleformat/doubleformattest.pro" -o "$OUTDIR/config.tests/unix/doubleformat/Makefile" >/dev/null 2>&1
 cd "$OUTDIR/config.tests/unix/doubleformat"
 
 DOUBLEFORMAT="UNKNOWN"
--- a/config.tests/unix/endian.test
+++ b/config.tests/unix/endian.test
@@ -10,7 +10,7 @@ OUTDIR=$4
 
 # build and run a test program
 test -d "$OUTDIR/config.tests/unix/endian" || mkdir -p "$OUTDIR/config.tests/unix/endian"
-"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/endian/endiantest.pro" -o "$OUTDIR/config.tests/unix/endian/Makefile" >/dev/null 2>&1
+"$OUTDIR/bin/qmake-qt4" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/endian/endiantest.pro" -o "$OUTDIR/config.tests/unix/endian/Makefile" >/dev/null 2>&1
 cd "$OUTDIR/config.tests/unix/endian"
 
 
--- a/config.tests/unix/ptrsize.test
+++ b/config.tests/unix/ptrsize.test
@@ -10,7 +10,7 @@ OUTDIR=$4
 
 # build and run a test program
 test -d "$OUTDIR/config.tests/unix/ptrsize" || mkdir -p "$OUTDIR/config.tests/unix/ptrsize"
-"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/ptrsize/ptrsizetest.pro" -o "$OUTDIR/config.tests/unix/ptrsize/Makefile" >/dev/null 2>&1
+"$OUTDIR/bin/qmake-qt4" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/unix/ptrsize/ptrsizetest.pro" -o "$OUTDIR/config.tests/unix/ptrsize/Makefile" >/dev/null 2>&1
 cd "$OUTDIR/config.tests/unix/ptrsize"
 
 if [ "$VERBOSE" = "yes" ]; then
--- a/config.tests/x11/notype.test
+++ b/config.tests/x11/notype.test
@@ -27,7 +27,7 @@ if [ $XPLATFORM = "solaris-g++" -o $XPLA
     NOTYPE=yes
 
     test -d "$OUTDIR/config.tests/x11/notype" || mkdir -p "$OUTDIR/config.tests/x11/notype"
-    "$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/x11/notype/notypetest.pro" -o "$OUTDIR/config.tests/x11/notype/Makefile" >/dev/null 2>&1
+    "$OUTDIR/bin/qmake-qt4" -nocache -spec "$QMKSPEC" "$SRCDIR/config.tests/x11/notype/notypetest.pro" -o "$OUTDIR/config.tests/x11/notype/Makefile" >/dev/null 2>&1
     cd "$OUTDIR/config.tests/x11/notype"
 
     if [ "$VERBOSE" = "yes" ]; then
--- a/configure
+++ b/configure
@@ -4294,7 +4294,7 @@ END {
 }
 
 # build qmake
-if true; then ###[ '!' -f "$outpath/bin/qmake" ];
+if true; then ###[ '!' -f "$outpath/bin/qmake-qt4" ];
     echo "Creating qmake. Please wait..."
 
     OLD_QCONFIG_H=
@@ -7206,8 +7206,8 @@ QMAKE_ABSOLUTE_SOURCE_ROOT = \$\$QT_SOUR
 QMAKE_MOC_SRC    = \$\$QT_BUILD_TREE/src/moc
 
 #local paths that cannot be queried from the QT_INSTALL_* properties while building QTDIR
-QMAKE_MOC        = \$\$QT_BUILD_TREE/bin/moc
-QMAKE_UIC        = \$\$QT_BUILD_TREE/bin/uic
+QMAKE_MOC        = \$\$QT_BUILD_TREE/bin/moc-qt4
+QMAKE_UIC        = \$\$QT_BUILD_TREE/bin/uic-qt4
 QMAKE_UIC3       = \$\$QT_BUILD_TREE/bin/uic3
 QMAKE_RCC        = \$\$QT_BUILD_TREE/bin/rcc
 QMAKE_QDBUSXML2CPP = \$\$QT_BUILD_TREE/bin/qdbusxml2cpp
@@ -7588,11 +7588,11 @@ EXEC=""
 #-------------------------------------------------------------------------------
 
 echo "Finding project files. Please wait..."
-"$outpath/bin/qmake" -prl -r "${relpath}/projects.pro"
+"$outpath/bin/qmake-qt4" -prl -r "${relpath}/projects.pro"
 if [ -f "${relpath}/projects.pro" ]; then
     mkfile="${outpath}/Makefile"
     [ -f "$mkfile" ] && chmod +w "$mkfile"
-    QTDIR="$outpath" "$outpath/bin/qmake" -spec "$XQMAKESPEC" "${relpath}/projects.pro" -o "$mkfile"
+    QTDIR="$outpath" "$outpath/bin/qmake-qt4" -spec "$XQMAKESPEC" "${relpath}/projects.pro" -o "$mkfile"
 fi
 
 # .projects      -> projects to process
@@ -7767,7 +7767,7 @@ for file in .projects .projects.3; do
         QMAKE_SPEC_ARGS="-spec $SPEC"
         echo $ECHO_N "  for $a$ECHO_C"
 
-        QMAKE="$outpath/bin/qmake"
+        QMAKE="$outpath/bin/qmake-qt4"
 	QMAKE_ARGS="$QMAKE_SWITCHES $QMAKE_SPEC_ARGS"
         if [ "$file" = ".projects.3" ]; then
             echo " (fast)"
--- a/projects.pro
+++ b/projects.pro
@@ -142,7 +142,7 @@ qmake.path=$$[QT_INSTALL_BINS]
 win32 {
    qmake.files=$$QT_BUILD_TREE/bin/qmake.exe
 } else {
-   qmake.files=$$QT_BUILD_TREE/bin/qmake
+   qmake.files=$$QT_BUILD_TREE/bin/qmake-qt4
 }
 INSTALLS += qmake
 
--- a/qmake/Makefile.unix
+++ b/qmake/Makefile.unix
@@ -75,17 +75,17 @@ CPPFLAGS = -I. -Igenerators -Igenerators
 
 CXXFLAGS = @QMAKE_CXXFLAGS@ $(CPPFLAGS)
 
-first all: $(BUILD_PATH)/bin/qmake
-qmake: $(BUILD_PATH)/bin/qmake
+first all: $(BUILD_PATH)/bin/qmake-qt4
+qmake: $(BUILD_PATH)/bin/qmake-qt4
 
-$(BUILD_PATH)/bin/qmake: $(OBJS) $(QOBJS)
+$(BUILD_PATH)/bin/qmake-qt4: $(OBJS) $(QOBJS)
 	$(CXX) -o "$@" $(OBJS) $(QOBJS) $(LFLAGS)
 
 clean::
 	rm -f $(OBJS) $(QOBJS)
 
 distclean:: clean
-	rm -rf $(BUILD_PATH)/bin/qmake .deps
+	rm -rf $(BUILD_PATH)/bin/qmake-qt4 .deps
 
 depend:
 	makedepend -D__MAKEDEPEND__ $(CPPFLAGS) $(DEPEND_SRC)
--- a/tools/linguist/lrelease/lrelease.pro
+++ b/tools/linguist/lrelease/lrelease.pro
@@ -1,5 +1,5 @@
 TEMPLATE        = app
-TARGET          = lrelease
+TARGET          = lrelease-qt4
 DESTDIR         = ../../../bin
 
 DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
--- a/tools/linguist/lupdate/lupdate.pro
+++ b/tools/linguist/lupdate/lupdate.pro
@@ -1,5 +1,5 @@
 TEMPLATE        = app
-TARGET          = lupdate
+TARGET          = lupdate-qt4
 DESTDIR          = ../../../bin
 
 QT              -= gui
--- a/src/tools/moc/moc.pro
+++ b/src/tools/moc/moc.pro
@@ -1,5 +1,5 @@
 TEMPLATE	= app
-TARGET		= moc
+TARGET		= moc-qt4
 
 DEFINES	       += QT_MOC
 DESTDIR         = ../../../bin
--- a/src/tools/uic/uic.pro
+++ b/src/tools/uic/uic.pro
@@ -1,5 +1,5 @@
 TEMPLATE = app
-TARGET = uic
+TARGET = uic-qt4
 
 DESTDIR = ../../../bin
 DEFINES += QT_UIC
--- a/tools/assistant/tools/assistant/assistant.pro
+++ b/tools/assistant/tools/assistant/assistant.pro
@@ -2,7 +2,7 @@ include($$QT_SOURCE_TREE/tools/shared/fo
 
 TEMPLATE = app
 LANGUAGE = C++
-TARGET = assistant
+TARGET = assistant-qt4
 
 contains(QT_CONFIG, webkit) {
     QT += webkit
--- a/tools/designer/src/designer/designer.pro
+++ b/tools/designer/src/designer/designer.pro
@@ -25,7 +25,7 @@ contains(CONFIG, static) {
     DEFINES += QT_DESIGNER_STATIC
 }
 
-TARGET = designer
+TARGET = designer-qt4
 
 include($$QT_SOURCE_TREE/tools/shared/fontpanel/fontpanel.pri)
 include($$QT_SOURCE_TREE/tools/shared/qttoolbardialog/qttoolbardialog.pri)
--- a/tools/linguist/linguist/linguist.pro
+++ b/tools/linguist/linguist/linguist.pro
@@ -69,7 +69,7 @@ HEADERS += \
 
 contains(QT_PRODUCT, OpenSource.*):DEFINES *= QT_OPENSOURCE
 DEFINES += QT_KEYWORDS
-TARGET = linguist
+TARGET = linguist-qt4
 win32:RC_FILE = linguist.rc
 mac { 
     static:CONFIG -= global_init_link_order
--- a/tools/qtconfig/qtconfig.pro
+++ b/tools/qtconfig/qtconfig.pro
@@ -19,7 +19,7 @@ FORMS        = mainwindowbase.ui palette
 RESOURCES    = qtconfig.qrc
 
 PROJECTNAME        = Qt Configuration
-TARGET                = qtconfig
+TARGET                = qtconfig-qt4
 DESTDIR                = ../../bin
 
 target.path=$$[QT_INSTALL_BINS]
--- a/translations/translations.pri
+++ b/translations/translations.pri
@@ -8,7 +8,7 @@ defineReplace(prependAll) {
     return ($$result)
 }
 
-qtPrepareTool(LUPDATE, lupdate)
+qtPrepareTool(LUPDATE, lupdate-qt4)
 LUPDATE += -locations relative -no-ui-lines
 
 ###### Qt Libraries
--- a/translations/translations.pro
+++ b/translations/translations.pro
@@ -1,6 +1,6 @@
 TRANSLATIONS = $$files(*.ts)
 
-qtPrepareTool(LRELEASE, lrelease)
+qtPrepareTool(LRELEASE, lrelease-qt4)
 
 contains(TEMPLATE_PREFIX, vc):vcproj = 1
 
@@ -14,7 +14,7 @@ updateqm.input = TRANSLATIONS
 updateqm.output = ${QMAKE_FILE_BASE}.qm
 isEmpty(vcproj):updateqm.variable_out = PRE_TARGETDEPS
 updateqm.commands = $$LRELEASE ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT}
-silent:updateqm.commands = @echo lrelease ${QMAKE_FILE_IN} && $$updateqm.commands
+silent:updateqm.commands = @echo lrelease-qt4 ${QMAKE_FILE_IN} && $$updateqm.commands
 updateqm.name = LRELEASE ${QMAKE_FILE_IN}
 updateqm.CONFIG += no_link
 QMAKE_EXTRA_COMPILERS += updateqm
--- a/mkspecs/features/moc.prf
+++ b/mkspecs/features/moc.prf
@@ -1,6 +1,6 @@
 
 #global defaults
-qtPrepareTool(QMAKE_MOC, moc)
+qtPrepareTool(QMAKE_MOC, moc-qt4)
 isEmpty(MOC_DIR):MOC_DIR = .
 isEmpty(QMAKE_H_MOD_MOC):QMAKE_H_MOD_MOC = moc_
 isEmpty(QMAKE_EXT_CPP_MOC):QMAKE_EXT_CPP_MOC = .moc
--- a/mkspecs/features/uic.prf
+++ b/mkspecs/features/uic.prf
@@ -1,6 +1,6 @@
 defined(qtPrepareTool)|load(qt_functions) ### Qt 5: see default_pre.prf
 qtPrepareTool(QMAKE_UIC3, uic3)
-qtPrepareTool(QMAKE_UIC, uic)
+qtPrepareTool(QMAKE_UIC, uic-qt4)
 
 isEmpty(UI_DIR):UI_DIR = .
 isEmpty(UI_SOURCES_DIR):UI_SOURCES_DIR = $$UI_DIR
