unify handling of library prefixes and extensions

make sure that all specs define QMAKE_{PREFIX,EXTENSION}_{SH,STATIC}LIB,
and adjust the code to make halfways consistent use of these variables,
in particular on windows; Win32MakefileGenerator::getLibTarget() is gone
as a result, as is QMAKE_CYGWIN_SHLIB. still, tons of hardcoded "lib"
references remain in the unix generator, because no-one cares.

Change-Id: I6ccf37cc562f6584221c94fa27b2834412e4e4ca
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
This commit is contained in:
Oswald Buddenhagen 2015-09-29 12:44:30 +02:00
parent 3e6d172638
commit f734599629
13 changed files with 25 additions and 35 deletions

View File

@ -74,6 +74,9 @@ QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS
QMAKE_LFLAGS_EXE = \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\" QMAKE_LFLAGS_EXE = \"/MANIFESTDEPENDENCY:type=\'win32\' name=\'Microsoft.Windows.Common-Controls\' version=\'6.0.0.0\' publicKeyToken=\'6595b64144ccf1df\' language=\'*\' processorArchitecture=\'*\'\"
QMAKE_LFLAGS_DLL = /DLL QMAKE_LFLAGS_DLL = /DLL
QMAKE_LFLAGS_LTCG = /LTCG QMAKE_LFLAGS_LTCG = /LTCG
QMAKE_PREFIX_SHLIB =
QMAKE_EXTENSION_SHLIB = dll
QMAKE_PREFIX_STATICLIB =
QMAKE_EXTENSION_STATICLIB = lib QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib

View File

@ -12,5 +12,6 @@ QMAKE_YACCFLAGS_MANGLE += -p $base -b $base
QMAKE_YACC_HEADER = $base.tab.h QMAKE_YACC_HEADER = $base.tab.h
QMAKE_YACC_SOURCE = $base.tab.c QMAKE_YACC_SOURCE = $base.tab.c
QMAKE_PREFIX_SHLIB = lib QMAKE_PREFIX_SHLIB = lib
QMAKE_EXTENSION_SHLIB = so
QMAKE_PREFIX_STATICLIB = lib QMAKE_PREFIX_STATICLIB = lib
QMAKE_EXTENSION_STATICLIB = a QMAKE_EXTENSION_STATICLIB = a

View File

@ -62,6 +62,9 @@ QMAKE_LFLAGS_LTCG = /LTCG
QMAKE_LIBS_NETWORK = ws2.lib QMAKE_LIBS_NETWORK = ws2.lib
QMAKE_LIBS_OPENGL = QMAKE_LIBS_OPENGL =
QMAKE_LIBS_COMPAT = QMAKE_LIBS_COMPAT =
QMAKE_PREFIX_SHLIB =
QMAKE_EXTENSION_SHLIB = dll
QMAKE_PREFIX_STATICLIB =
QMAKE_EXTENSION_STATICLIB = lib QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS_EGL = libEGL.lib QMAKE_LIBS_EGL = libEGL.lib

View File

@ -70,6 +70,9 @@ QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS
QMAKE_LFLAGS_EXE = /MANIFEST:NO QMAKE_LFLAGS_EXE = /MANIFEST:NO
QMAKE_LFLAGS_DLL = /MANIFEST:NO /DLL QMAKE_LFLAGS_DLL = /MANIFEST:NO /DLL
QMAKE_LFLAGS_LTCG = /LTCG QMAKE_LFLAGS_LTCG = /LTCG
QMAKE_PREFIX_SHLIB =
QMAKE_EXTENSION_SHLIB = dll
QMAKE_PREFIX_STATICLIB =
QMAKE_EXTENSION_STATICLIB = lib QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS += runtimeobject.lib QMAKE_LIBS += runtimeobject.lib

View File

@ -6,7 +6,7 @@
MAKEFILE_GENERATOR = UNIX MAKEFILE_GENERATOR = UNIX
QMAKE_PLATFORM = cygwin unix posix QMAKE_PLATFORM = cygwin unix posix
CONFIG += incremental CONFIG += incremental unversioned_libname
QMAKE_INCREMENTAL_STYLE = sublib QMAKE_INCREMENTAL_STYLE = sublib
QMAKE_COMPILER = gcc QMAKE_COMPILER = gcc
@ -56,7 +56,6 @@ QMAKE_LFLAGS_PLUGIN = $$QMAKE_LFLAGS_SHLIB
QMAKE_LFLAGS_SONAME = -Wl,-soname, QMAKE_LFLAGS_SONAME = -Wl,-soname,
QMAKE_LFLAGS_THREAD = QMAKE_LFLAGS_THREAD =
QMAKE_LFLAGS_RPATH = -Wl,-rpath, QMAKE_LFLAGS_RPATH = -Wl,-rpath,
QMAKE_CYGWIN_SHLIB = 1
QMAKE_LIBS = QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_DYNLOAD = -ldl
@ -64,6 +63,7 @@ QMAKE_LIBS_X11 = -lXext -lX11
QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD = -lpthread QMAKE_LIBS_THREAD = -lpthread
QMAKE_PREFIX_SHLIB = lib QMAKE_PREFIX_SHLIB = lib
QMAKE_EXTENSION_SHLIB = dll
QMAKE_PREFIX_STATICLIB = lib QMAKE_PREFIX_STATICLIB = lib
QMAKE_EXTENSION_STATICLIB = a QMAKE_EXTENSION_STATICLIB = a

View File

@ -54,13 +54,13 @@ win32 {
} else { } else {
equals(TEMPLATE, lib) { equals(TEMPLATE, lib) {
static { static {
QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.a QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.$${QMAKE_EXTENSION_STATICLIB}
} else: plugin|unversioned_libname { } else: plugin|unversioned_libname {
QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.so QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.$${QMAKE_EXTENSION_SHLIB}
} else { } else {
TEMP_VERSION = $$VERSION TEMP_VERSION = $$VERSION
isEmpty(TEMP_VERSION):TEMP_VERSION = 1.0.0 isEmpty(TEMP_VERSION):TEMP_VERSION = 1.0.0
QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.so.$${TEMP_VERSION} QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${LIBPREFIX}$${TARGET}.$${QMAKE_EXTENSION_SHLIB}.$${TEMP_VERSION}
} }
} else { } else {
QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${TARGET} QMAKE_RESOLVED_TARGET = $${QMAKE_RESOLVED_TARGET}$${TARGET}

View File

@ -87,6 +87,8 @@ QMAKE_LFLAGS_GCSECTIONS = -Wl,--gc-sections
QMAKE_LFLAGS_USE_GOLD = -fuse-ld=gold QMAKE_LFLAGS_USE_GOLD = -fuse-ld=gold
QMAKE_LINK_OBJECT_MAX = 10 QMAKE_LINK_OBJECT_MAX = 10
QMAKE_LINK_OBJECT_SCRIPT = object_script QMAKE_LINK_OBJECT_SCRIPT = object_script
QMAKE_PREFIX_SHLIB =
QMAKE_EXTENSION_SHLIB = dll
QMAKE_PREFIX_STATICLIB = lib QMAKE_PREFIX_STATICLIB = lib
QMAKE_EXTENSION_STATICLIB = a QMAKE_EXTENSION_STATICLIB = a

View File

@ -70,6 +70,9 @@ QMAKE_LFLAGS_CONSOLE = /SUBSYSTEM:console
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:windows QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:windows
QMAKE_LFLAGS_DLL = /DLL QMAKE_LFLAGS_DLL = /DLL
QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
QMAKE_PREFIX_SHLIB =
QMAKE_EXTENSION_SHLIB = dll
QMAKE_PREFIX_STATICLIB =
QMAKE_EXTENSION_STATICLIB = lib QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS = QMAKE_LIBS =

View File

@ -45,14 +45,6 @@ QT_BEGIN_NAMESPACE
void void
UnixMakefileGenerator::init() UnixMakefileGenerator::init()
{ {
if(project->isEmpty("QMAKE_EXTENSION_SHLIB")) {
if(project->isEmpty("QMAKE_CYGWIN_SHLIB")) {
project->values("QMAKE_EXTENSION_SHLIB").append("so");
} else {
project->values("QMAKE_EXTENSION_SHLIB").append("dll");
}
}
ProStringList &configs = project->values("CONFIG"); ProStringList &configs = project->values("CONFIG");
if(project->isEmpty("ICON") && !project->isEmpty("RC_FILE")) if(project->isEmpty("ICON") && !project->isEmpty("RC_FILE"))
project->values("ICON") = project->values("RC_FILE"); project->values("ICON") = project->values("RC_FILE");
@ -702,7 +694,6 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
} else if(project->first("TEMPLATE") == "app") { } else if(project->first("TEMPLATE") == "app") {
target = "$(QMAKE_TARGET)"; target = "$(QMAKE_TARGET)";
} else if(project->first("TEMPLATE") == "lib") { } else if(project->first("TEMPLATE") == "lib") {
if(project->isEmpty("QMAKE_CYGWIN_SHLIB")) {
if (!project->isActiveConfig("staticlib") if (!project->isActiveConfig("staticlib")
&& !project->isActiveConfig("plugin") && !project->isActiveConfig("plugin")
&& !project->isActiveConfig("unversioned_libname")) { && !project->isActiveConfig("unversioned_libname")) {
@ -712,7 +703,6 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
links << "$(TARGET0)"; links << "$(TARGET0)";
} }
} }
}
} }
for(int i = 0; i < targets.size(); ++i) { for(int i = 0; i < targets.size(); ++i) {
QString src = targets.at(i).toQString(), QString src = targets.at(i).toQString(),

View File

@ -56,11 +56,6 @@ QString MingwMakefileGenerator::escapeDependencyPath(const QString &path) const
return ret; return ret;
} }
QString MingwMakefileGenerator::getLibTarget()
{
return QString("lib" + project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".a");
}
QString MingwMakefileGenerator::getManifestFileForRcFile() const QString MingwMakefileGenerator::getManifestFileForRcFile() const
{ {
return project->first("QMAKE_MANIFEST").toQString(); return project->first("QMAKE_MANIFEST").toQString();
@ -230,8 +225,7 @@ void MingwMakefileGenerator::init()
QString destDir = ""; QString destDir = "";
if(!project->first("DESTDIR").isEmpty()) if(!project->first("DESTDIR").isEmpty())
destDir = Option::fixPathToTargetOS(project->first("DESTDIR") + Option::dir_sep, false, false); destDir = Option::fixPathToTargetOS(project->first("DESTDIR") + Option::dir_sep, false, false);
project->values("MINGW_IMPORT_LIB").prepend(destDir + "lib" + project->first("TARGET") project->values("MINGW_IMPORT_LIB").prepend(destDir + project->first("LIB_TARGET"));
+ project->first("TARGET_VERSION_EXT") + ".a");
project->values("QMAKE_LFLAGS").append(QString("-Wl,--out-implib,") + fileVar("MINGW_IMPORT_LIB")); project->values("QMAKE_LFLAGS").append(QString("-Wl,--out-implib,") + fileVar("MINGW_IMPORT_LIB"));
} }

View File

@ -47,7 +47,6 @@ protected:
QString escapeDependencyPath(const QString &path) const; QString escapeDependencyPath(const QString &path) const;
ProString escapeDependencyPath(const ProString &path) const { return MakefileGenerator::escapeDependencyPath(path); } ProString escapeDependencyPath(const ProString &path) const { return MakefileGenerator::escapeDependencyPath(path); }
virtual ProString fixLibFlag(const ProString &lib); virtual ProString fixLibFlag(const ProString &lib);
QString getLibTarget();
virtual QString getManifestFileForRcFile() const; virtual QString getManifestFileForRcFile() const;
bool writeMakefile(QTextStream &); bool writeMakefile(QTextStream &);
void init(); void init();

View File

@ -318,14 +318,12 @@ void Win32MakefileGenerator::processVars()
void Win32MakefileGenerator::fixTargetExt() void Win32MakefileGenerator::fixTargetExt()
{ {
if (project->isEmpty("QMAKE_EXTENSION_STATICLIB"))
project->values("QMAKE_EXTENSION_STATICLIB").append("lib");
if (project->isEmpty("QMAKE_EXTENSION_SHLIB"))
project->values("QMAKE_EXTENSION_SHLIB").append("dll");
if (!project->values("QMAKE_APP_FLAG").isEmpty()) { if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
project->values("TARGET_EXT").append(".exe"); project->values("TARGET_EXT").append(".exe");
} else if (project->isActiveConfig("shared")) { } else if (project->isActiveConfig("shared")) {
project->values("LIB_TARGET").prepend(project->first("QMAKE_PREFIX_STATICLIB")
+ project->first("TARGET") + project->first("TARGET_VERSION_EXT")
+ '.' + project->first("QMAKE_EXTENSION_STATICLIB"));
project->values("TARGET_EXT").append(project->first("TARGET_VERSION_EXT") + "." project->values("TARGET_EXT").append(project->first("TARGET_VERSION_EXT") + "."
+ project->first("QMAKE_EXTENSION_SHLIB")); + project->first("QMAKE_EXTENSION_SHLIB"));
project->values("TARGET").first() = project->first("QMAKE_PREFIX_SHLIB") + project->first("TARGET"); project->values("TARGET").first() = project->first("QMAKE_PREFIX_SHLIB") + project->first("TARGET");
@ -782,11 +780,6 @@ void Win32MakefileGenerator::writeRcFilePart(QTextStream &t)
} }
} }
QString Win32MakefileGenerator::getLibTarget()
{
return QString(project->first("TARGET") + project->first("TARGET_VERSION_EXT") + ".lib");
}
QString Win32MakefileGenerator::defaultInstall(const QString &t) QString Win32MakefileGenerator::defaultInstall(const QString &t)
{ {
if((t != "target" && t != "dlltarget") || if((t != "target" && t != "dlltarget") ||
@ -833,7 +826,7 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
} }
} }
if(project->isActiveConfig("shared") && !project->isActiveConfig("plugin")) { if(project->isActiveConfig("shared") && !project->isActiveConfig("plugin")) {
QString lib_target = getLibTarget(); ProString lib_target = project->first("LIB_TARGET");
QString src_targ = escapeFilePath( QString src_targ = escapeFilePath(
(project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR")) (project->isEmpty("DESTDIR") ? QString("$(DESTDIR)") : project->first("DESTDIR"))
+ lib_target); + lib_target);

View File

@ -66,7 +66,6 @@ protected:
void processVars(); void processVars();
void fixTargetExt(); void fixTargetExt();
void processRcFileVar(); void processRcFileVar();
virtual QString getLibTarget();
static QString cQuoted(const QString &str); static QString cQuoted(const QString &str);
virtual QString getManifestFileForRcFile() const; virtual QString getManifestFileForRcFile() const;
}; };