diff --git a/mkspecs/features/ctest_testcase_common.prf b/mkspecs/features/ctest_testcase_common.prf index cdc5cca1d7..15701b6a41 100644 --- a/mkspecs/features/ctest_testcase_common.prf +++ b/mkspecs/features/ctest_testcase_common.prf @@ -1,10 +1,5 @@ -win32 { - CMAKE_VERSION = $$system(cmake --version 2>NUL, lines) -} else { - CMAKE_VERSION = $$system(cmake --version 2>/dev/null, lines) -} - +CMAKE_VERSION = $$system(cmake --version 2>$$QMAKE_NULL_DEVICE, lines) CMAKE_VERSION = $$member(CMAKE_VERSION, 0, 0) check.commands = @@ -15,12 +10,7 @@ isEmpty(CMAKE_VERSION) { return() } -win32 { - CTEST_VERSION = $$system(ctest --version 2>NUL) -} else { - CTEST_VERSION = $$system(ctest --version 2>/dev/null) -} - +CTEST_VERSION = $$system(ctest --version 2>$$QMAKE_NULL_DEVICE) isEmpty(CTEST_VERSION) { message("ctest executable not found. Not running CMake unit tests") return() diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index c00fdb73f8..1f44650227 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -291,10 +291,7 @@ defineReplace(pkgConfigExecutable) { } } - equals(QMAKE_HOST.os, Windows): \ - PKG_CONFIG += 2> NUL - else: \ - PKG_CONFIG += 2> /dev/null + PKG_CONFIG += 2> $$QMAKE_NULL_DEVICE return($$PKG_CONFIG) } diff --git a/mkspecs/features/spec_post.prf b/mkspecs/features/spec_post.prf index f87bf3c037..62be69ffda 100644 --- a/mkspecs/features/spec_post.prf +++ b/mkspecs/features/spec_post.prf @@ -82,6 +82,7 @@ equals(MAKEFILE_GENERATOR, MSBUILD) \ QMAKE_MKDIR = mkdir # legacy QMAKE_MKDIR_CMD = if not exist %1 mkdir %1 & if not exist %1 exit 1 QMAKE_STREAM_EDITOR = $(QMAKE) -install sed + QMAKE_NULL_DEVICE = NUL QMAKE_INSTALL_FILE = copy /y QMAKE_INSTALL_PROGRAM = copy /y } else { @@ -101,6 +102,7 @@ equals(MAKEFILE_GENERATOR, MSBUILD) \ QMAKE_MKDIR = mkdir -p # legacy QMAKE_MKDIR_CMD = test -d %1 || mkdir -p %1 QMAKE_STREAM_EDITOR = sed + QMAKE_NULL_DEVICE = /dev/null equals(QMAKE_HOST.os, Windows) { MINGW_IN_SHELL = 1 # legacy diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index 35175f1744..e7ada377d7 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -32,15 +32,11 @@ isEmpty($${target_prefix}.INCDIRS) { # Get default include and library paths from compiler # gcc { - !equals(QMAKE_HOST.os, Windows) { - cmd_prefix = "LC_ALL=C" - cmd_suffix = "/dev/null" - null_file = /dev/null - } else { + cmd_suffix = "<$$QMAKE_NULL_DEVICE >$$QMAKE_NULL_DEVICE" + equals(QMAKE_HOST.os, Windows): \ cmd_prefix = "set LC_ALL=C&" - cmd_suffix = "NUL" - null_file = NUL - } + else: \ + cmd_prefix = "LC_ALL=C" cxx_flags = $$QMAKE_CXXFLAGS @@ -59,7 +55,7 @@ isEmpty($${target_prefix}.INCDIRS) { rim_qcc: \ # Need the cc1plus and ld command lines to pick up the paths - cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$null_file -v + cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$QMAKE_NULL_DEVICE -v else: darwin:clang: \ # Need to link to pick up library paths cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v @@ -175,9 +171,7 @@ defineReplace(qtVariablesFromMSVC) { } defineReplace(qtVariablesFromGCC) { - null_device = /dev/null - equals(QMAKE_HOST.os, Windows): null_device = NUL - ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) <$$null_device 2>$$null_device", lines, ec) + ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) <$$QMAKE_NULL_DEVICE 2>$$QMAKE_NULL_DEVICE", lines, ec) !equals(ec, 0): qtCompilerErrror($$1) return($$ret) } diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index bad53dc5b7..2d69f708fb 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -36,12 +36,6 @@ #include #include -#ifdef Q_OS_WIN -#define NULL_DEVICE "NUL" -#else -#define NULL_DEVICE "/dev/null" -#endif - QT_BEGIN_NAMESPACE MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator() @@ -329,7 +323,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { - t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" NULL_DEVICE; + t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>$$QMAKE_NULL_DEVICE"; if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) { t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ; } else {