Skip to content

Commit

Permalink
Revert "Qmake: Introduce and use QMAKE_NULL_DEVICE variable"
Browse files Browse the repository at this point in the history
With that change QNX7 builds in windows will fail.

This reverts commit b4e9cb4.

Task-number: QTBUG-63535
Change-Id: Ia91d173803af62d41d1a7e5832bab911920f590d
Reviewed-by: Frederik Gladhorn <[email protected]>
  • Loading branch information
jaheikk committed Oct 2, 2017
1 parent 8883e44 commit ec16ba3
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 12 deletions.
14 changes: 12 additions & 2 deletions mkspecs/features/ctest_testcase_common.prf
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@

CMAKE_VERSION = $$system(cmake --version 2>$$QMAKE_NULL_DEVICE, lines)
win32 {
CMAKE_VERSION = $$system(cmake --version 2>NUL, lines)
} else {
CMAKE_VERSION = $$system(cmake --version 2>/dev/null, lines)
}

CMAKE_VERSION = $$member(CMAKE_VERSION, 0, 0)

check.commands =
Expand All @@ -10,7 +15,12 @@ isEmpty(CMAKE_VERSION) {
return()
}

CTEST_VERSION = $$system(ctest --version 2>$$QMAKE_NULL_DEVICE)
win32 {
CTEST_VERSION = $$system(ctest --version 2>NUL)
} else {
CTEST_VERSION = $$system(ctest --version 2>/dev/null)
}

isEmpty(CTEST_VERSION) {
message("ctest executable not found. Not running CMake unit tests")
return()
Expand Down
5 changes: 4 additions & 1 deletion mkspecs/features/qt_functions.prf
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,10 @@ defineReplace(pkgConfigExecutable) {
}
}

PKG_CONFIG += 2> $$QMAKE_NULL_DEVICE
equals(QMAKE_HOST.os, Windows): \
PKG_CONFIG += 2> NUL
else: \
PKG_CONFIG += 2> /dev/null

return($$PKG_CONFIG)
}
Expand Down
2 changes: 0 additions & 2 deletions mkspecs/features/spec_post.prf
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ 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 {
Expand All @@ -102,7 +101,6 @@ 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
Expand Down
18 changes: 12 additions & 6 deletions mkspecs/features/toolchain.prf
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ isEmpty($${target_prefix}.INCDIRS) {
# Get default include and library paths from compiler
#
gcc {
cmd_suffix = "<$$QMAKE_NULL_DEVICE >$$QMAKE_NULL_DEVICE"
equals(QMAKE_HOST.os, Windows): \
cmd_prefix = "set LC_ALL=C&"
else: \
!equals(QMAKE_HOST.os, Windows) {
cmd_prefix = "LC_ALL=C"
cmd_suffix = "</dev/null >/dev/null"
null_file = /dev/null
} else {
cmd_prefix = "set LC_ALL=C&"
cmd_suffix = "<NUL >NUL"
null_file = NUL
}

cxx_flags = $$QMAKE_CXXFLAGS

Expand All @@ -55,7 +59,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 $$QMAKE_NULL_DEVICE -v
cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$null_file -v
else: darwin:clang: \
# Need to link to pick up library paths
cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v
Expand Down Expand Up @@ -171,7 +175,9 @@ defineReplace(qtVariablesFromMSVC) {
}

defineReplace(qtVariablesFromGCC) {
ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) <$$QMAKE_NULL_DEVICE 2>$$QMAKE_NULL_DEVICE", lines, ec)
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)
!equals(ec, 0): qtCompilerErrror($$1)
return($$ret)
}
Expand Down
8 changes: 7 additions & 1 deletion qmake/generators/win32/mingw_make.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@
#include <stdlib.h>
#include <time.h>

#ifdef Q_OS_WIN
#define NULL_DEVICE "NUL"
#else
#define NULL_DEVICE "/dev/null"
#endif

QT_BEGIN_NAMESPACE

MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator()
Expand Down Expand Up @@ -323,7 +329,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t)
if(!project->isEmpty("QMAKE_PRE_LINK"))
t << "\n\t" <<var("QMAKE_PRE_LINK");
if(project->isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") {
t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>$$QMAKE_NULL_DEVICE";
t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" NULL_DEVICE;
if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) {
t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ;
} else {
Expand Down

0 comments on commit ec16ba3

Please sign in to comment.