diff options
Diffstat (limited to 'qmake')
-rw-r--r-- | qmake/Makefile.unix | 7 | ||||
-rw-r--r-- | qmake/Makefile.win32 | 1 | ||||
-rw-r--r-- | qmake/doc/src/qmake-manual.qdoc | 34 | ||||
-rw-r--r-- | qmake/generators/mac/pbuilder_pbx.cpp | 82 | ||||
-rw-r--r-- | qmake/generators/makefile.cpp | 95 | ||||
-rw-r--r-- | qmake/generators/makefile.h | 3 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake.h | 2 | ||||
-rw-r--r-- | qmake/generators/unix/unixmake2.cpp | 130 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.cpp | 28 | ||||
-rw-r--r-- | qmake/generators/win32/msvc_nmake.h | 1 |
10 files changed, 196 insertions, 187 deletions
diff --git a/qmake/Makefile.unix b/qmake/Makefile.unix index ef1c542f57..52873203a0 100644 --- a/qmake/Makefile.unix +++ b/qmake/Makefile.unix @@ -12,7 +12,8 @@ OBJS=project.o option.o property.o main.o ioutils.o proitems.o \ gbuild.o cesdkhandler.o #qt code -QOBJS=qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtextstream.o qiodevice.o qmalloc.o qglobal.o \ +QOBJS=qtextcodec.o qutfcodec.o qstring.o qstring_compat.o qstringbuilder.o qtextstream.o qiodevice.o \ + qdebug.o qmalloc.o qglobal.o \ qarraydata.o qbytearray.o qbytearraymatcher.o qdatastream.o qbuffer.o qlist.o qfiledevice.o qfile.o \ qfilesystementry.o qfilesystemengine.o qfsfileengine.o qfsfileengine_iterator.o qregexp.o qvector.o \ qbitarray.o qdir.o qdiriterator.o quuid.o qhash.o qfileinfo.o qdatetime.o qstringlist.o \ @@ -43,6 +44,7 @@ DEPEND_SRC = \ $(SOURCE_PATH)/src/corelib/tools/qstring_compat.cpp \ $(SOURCE_PATH)/src/corelib/io/qfiledevice.cpp \ $(SOURCE_PATH)/src/corelib/io/qtextstream.cpp $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp \ + $(SOURCE_PATH)/src/corelib/io/qdebug.cpp \ $(SOURCE_PATH)/src/corelib/global/qmalloc.cpp \ $(SOURCE_PATH)/src/corelib/global/qglobal.cpp $(SOURCE_PATH)/src/corelib/tools/qregexp.cpp \ $(SOURCE_PATH)/src/corelib/tools/qarraydata.cpp $(SOURCE_PATH)/src/corelib/tools/qbytearray.cpp\ @@ -240,6 +242,9 @@ qsettings_win.o: $(SOURCE_PATH)/src/corelib/io/qsettings_win.cpp qiodevice.o: $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qiodevice.cpp +qdebug.o: $(SOURCE_PATH)/src/corelib/io/qdebug.cpp + $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/io/qdebug.cpp + qmalloc.o: $(SOURCE_PATH)/src/corelib/global/qmalloc.cpp $(CXX) -c -o $@ $(CXXFLAGS) $(SOURCE_PATH)/src/corelib/global/qmalloc.cpp diff --git a/qmake/Makefile.win32 b/qmake/Makefile.win32 index b1936f3cec..62dc7bcdf8 100644 --- a/qmake/Makefile.win32 +++ b/qmake/Makefile.win32 @@ -94,6 +94,7 @@ QTOBJS= \ qglobal.obj \ qhash.obj \ qiodevice.obj \ + qdebug.obj \ qlist.obj \ qlinkedlist.obj \ qlocale.obj \ diff --git a/qmake/doc/src/qmake-manual.qdoc b/qmake/doc/src/qmake-manual.qdoc index 2f43c8ad1f..26fe0d62f1 100644 --- a/qmake/doc/src/qmake-manual.qdoc +++ b/qmake/doc/src/qmake-manual.qdoc @@ -2405,13 +2405,6 @@ \li architecture \li The target architecture. Defaults to \c VCPROJ_ARCH. \row - \li arguments - \li Allows arguments to be passed to the executable. - \row - \li author - \li Package author. Defaults to \c{Default package author}. - This option is only available for Windows Phone. - \row \li background \li Tile background color. Defaults to \c{green}. \row @@ -2420,7 +2413,7 @@ \row \li capabilities_device \li Specifies device capabilities to add to the capability list - (location, webcam, and so on). This option is not available on Windows Phone. + (location, webcam, and so on). \row \li default_language \li The default language code of the application. Defaults to "en". @@ -2435,10 +2428,6 @@ \li Tile foreground (text) color. Defaults to \c{light}. This option is only available for Windows Store apps on Windows 8 and Windows RT. \row - \li genre - \li Package genre. Defaults to \c{apps.normal}. - This option is only available for Windows Phone. - \row \li iconic_tile_icon \li Image file for the \c{iconic} tile template icon. Default provided by the mkspec. @@ -2451,10 +2440,6 @@ \li The unique ID of the app. Defaults to reusing the existing generated manifest's UUID, or generates a new UUID if none is present. \row - \li languages - \li A list of additional language codes supported by the application. This list - is empty by default. - \row \li logo_large \li Large logo image file. Default provided by the mkspec. \row @@ -2470,12 +2455,17 @@ \li name \li The name of the package as displayed to the user. Defaults to TARGET. \row + \li phone_product_id + \li The GUID of the product. Defaults to the value of WINRT_MANIFEST.identity. (Windows Phone only) + \row + \li phone_publisher_id + \li The GUID of the publisher. Defaults to an invalid GUID. (Windows Phone only) + \row \li publisher \li Display name of the publisher. Defaults to \c{Default publisher display name}. \row \li publisher_id - \li On Windows 8 or Windows RT, the publisher's distinguished name (default: \c{CN=MyCN}). - On Windows Phone, the publisher's UUID (default: invalid UUID string). + \li The publisher's distinguished name (default: \c{CN=MyCN}). \row \li splash_screen \li Splash screen image file. Default provided by the mkspec. @@ -2494,12 +2484,8 @@ \code WINRT_MANIFEST.publisher = MyCompany WINRT_MANIFEST.logo_store = someImage.png - winphone { - WINRT_MANIFEST.capabilities += ID_CAP_LOCATION ID_CAP_NETWORKING - } else { - WINRT_MANIFEST.capabilities += internetClient - WINRT_MANIFEST.device_capabilities += location - } + WINRT_MANIFEST.capabilities += internetClient + WINRT_MANIFEST.device_capabilities += location \endcode Additionally, an input manifest file can be specified by using WINRT_MANIFEST. diff --git a/qmake/generators/mac/pbuilder_pbx.cpp b/qmake/generators/mac/pbuilder_pbx.cpp index e1e373787c..042e21ab5a 100644 --- a/qmake/generators/mac/pbuilder_pbx.cpp +++ b/qmake/generators/mac/pbuilder_pbx.cpp @@ -681,7 +681,7 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) if (!filetype.isNull()) t << "\t\t\t" << writeSettings("lastKnownFileType", filetype) << ";\n"; t << "\t\t};\n"; - if (sources.at(source).isBuildable() && sources.at(source).isObjectOutput(file)) { //build reference + if (sources.at(source).isBuildable()) { //build reference QString build_key = keyFor(file + ".BUILDABLE"); t << "\t\t" << build_key << " = {\n" << "\t\t\t" << writeSettings("fileRef", src_key) << ";\n" @@ -690,7 +690,8 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t\t" << writeSettings("ATTRIBUTES", ProStringList(), SettingsAsList, 5) << ";\n" << "\t\t\t};\n" << "\t\t};\n"; - project->values("QMAKE_PBX_OBJ").append(build_key); + if (sources.at(source).isObjectOutput(file)) + project->values("QMAKE_PBX_OBJ").append(build_key); } } if(!src_list.isEmpty()) { @@ -1101,12 +1102,9 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t\t" << writeSettings("shellScript", fixForOutput("cp -r $BUILT_PRODUCTS_DIR/$FULL_PRODUCT_NAME " + escapeFilePath(destDir))) << ";\n" << "\t\t};\n"; } - // Copy Bundle Resources + // Copy Bundle Data if (!project->isEmpty("QMAKE_BUNDLE_DATA")) { ProStringList bundle_file_refs; - ProStringList bundle_resources_files; - - bool useCopyResourcesPhase = project->isActiveConfig("app_bundle") && project->first("TEMPLATE") == "app"; //all bundle data const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA"); @@ -1132,46 +1130,20 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) << "\t\t};\n"; } - if (!useCopyResourcesPhase || !path.isEmpty()) { - // The resource copy phase doesn't support paths, so we have to use - // a regular file copy phase (which doesn't optimize the resources). - QString phase_key = keyFor("QMAKE_PBX_BUNDLE_COPY." + bundle_data[i]); - if (!project->isEmpty(ProKey(bundle_data[i] + ".version"))) { - //### - } - - project->values("QMAKE_PBX_BUILDPHASES").append(phase_key); - t << "\t\t" << phase_key << " = {\n" - << "\t\t\t" << writeSettings("name", "Copy '" + bundle_data[i] + "' Files to Bundle") << ";\n" - << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n" - << "\t\t\t" << writeSettings("dstPath", escapeFilePath(path)) << ";\n" - << "\t\t\t" << writeSettings("dstSubfolderSpec", "1", SettingsNoQuote) << ";\n" - << "\t\t\t" << writeSettings("files", bundle_files, SettingsAsList, 4) << ";\n" - << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";\n" - << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n" - << "\t\t};\n"; - } else { - // Otherwise we leave it to the resource copy phase below - bundle_resources_files += bundle_files; + QString phase_key = keyFor("QMAKE_PBX_BUNDLE_COPY." + bundle_data[i]); + if (!project->isEmpty(ProKey(bundle_data[i] + ".version"))) { + //### } - } - if (useCopyResourcesPhase) { - if (!project->isEmpty("ICON")) { - ProString icon = project->first("ICON"); - if (icon.length() >= 2 && (icon.at(0) == '"' || icon.at(0) == '\'') && icon.endsWith(icon.at(0))) - icon = icon.mid(1, icon.length() - 2); - bundle_resources_files += keyFor(icon + ".BUILDABLE"); - } - - QString grp("Copy Bundle Resources"), key = keyFor(grp); - project->values("QMAKE_PBX_BUILDPHASES").append(key); - t << "\t\t" << key << " = {\n" + project->values("QMAKE_PBX_BUILDPHASES").append(phase_key); + t << "\t\t" << phase_key << " = {\n" + << "\t\t\t" << writeSettings("name", "Copy '" + bundle_data[i] + "' Files to Bundle") << ";\n" << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n" - << "\t\t\t" << writeSettings("files", bundle_resources_files, SettingsAsList, 4) << ";\n" - << "\t\t\t" << writeSettings("isa", "PBXResourcesBuildPhase", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("dstPath", escapeFilePath(path)) << ";\n" + << "\t\t\t" << writeSettings("dstSubfolderSpec", "1", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("files", bundle_files, SettingsAsList, 4) << ";\n" + << "\t\t\t" << writeSettings("isa", "PBXCopyFilesBuildPhase", SettingsNoQuote) << ";\n" << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n" - << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";\n" << "\t\t};\n"; } @@ -1180,11 +1152,35 @@ ProjectBuilderMakefileGenerator::writeMakeParts(QTextStream &t) t << "\t\t" << bundle_data_key << " = {\n" << "\t\t\t" << writeSettings("children", bundle_file_refs, SettingsAsList, 4) << ";\n" << "\t\t\t" << writeSettings("isa", "PBXGroup", SettingsNoQuote) << ";\n" - << "\t\t\t" << writeSettings("name", "Bundle Resources") << ";\n" + << "\t\t\t" << writeSettings("name", "Bundle Data") << ";\n" << "\t\t\t" << writeSettings("sourceTree", "<Group>") << ";\n" << "\t\t};\n"; } + // Copy bundle resources. Optimizes resources, and puts them into the Resources + // subdirectory on OSX, but doesn't support paths. + if (project->isActiveConfig("app_bundle") && project->first("TEMPLATE") == "app") { + ProStringList bundle_resources_files; + if (!project->isEmpty("ICON")) { + ProString icon = project->first("ICON"); + if (icon.length() >= 2 && (icon.at(0) == '"' || icon.at(0) == '\'') && icon.endsWith(icon.at(0))) + icon = icon.mid(1, icon.length() - 2); + bundle_resources_files += keyFor(icon + ".BUILDABLE"); + } + + if (!bundle_resources_files.isEmpty()) { + QString grp("Copy Bundle Resources"), key = keyFor(grp); + project->values("QMAKE_PBX_BUILDPHASES").append(key); + t << "\t\t" << key << " = {\n" + << "\t\t\t" << writeSettings("buildActionMask", "2147483647", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("files", bundle_resources_files, SettingsAsList, 4) << ";\n" + << "\t\t\t" << writeSettings("isa", "PBXResourcesBuildPhase", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("runOnlyForDeploymentPostprocessing", "0", SettingsNoQuote) << ";\n" + << "\t\t\t" << writeSettings("name", escapeFilePath(grp)) << ";\n" + << "\t\t};\n"; + } + } + //REFERENCE project->values("QMAKE_PBX_PRODUCTS").append(keyFor(pbx_dir + "QMAKE_PBX_REFERENCE")); t << "\t\t" << keyFor(pbx_dir + "QMAKE_PBX_REFERENCE") << " = {\n" diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp index 0e3e058c7b..7bc673bf7b 100644 --- a/qmake/generators/makefile.cpp +++ b/qmake/generators/makefile.cpp @@ -70,11 +70,6 @@ QT_BEGIN_NAMESPACE -// Well, Windows doesn't have this, so here's the macro -#ifndef S_ISDIR -# define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) -#endif - bool MakefileGenerator::canExecute(const QStringList &cmdline, int *a) const { int argv0 = -1; @@ -1749,23 +1744,7 @@ MakefileGenerator::verifyExtraCompiler(const ProString &comp, const QString &fil QString tmp_out = project->values(ProKey(comp + ".output")).first().toQString(); if(tmp_out.isEmpty()) return false; - QString tmp_cmd; - const ProKey ckey(comp + ".commands"); - if (!project->isEmpty(ckey)) { - int argv0 = -1; - ProStringList cmdline = project->values(ckey); - for(int i = 0; i < cmdline.count(); ++i) { - if(!cmdline.at(i).contains('=')) { - argv0 = i; - break; - } - } - if(argv0 != -1) { - cmdline[argv0] = Option::fixPathToTargetOS(cmdline.at(argv0).toQString(), false); - tmp_cmd = cmdline.join(' '); - } - } - + const QString tmp_cmd = project->values(ProKey(comp + ".commands")).join(' '); if (config.indexOf("combine") != -1) { QString cmd = replaceExtraCompilerVariables(tmp_cmd, QString(), tmp_out); if(system(cmd.toLatin1().constData())) @@ -1829,42 +1808,10 @@ MakefileGenerator::writeExtraCompilerTargets(QTextStream &t) for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { QString tmp_out = fileFixify(project->first(ProKey(*it + ".output")).toQString(), Option::output_dir, Option::output_dir); - QString tmp_cmd; - const ProKey ckey(*it + ".commands"); - if (!project->isEmpty(ckey)) { - QStringList cmdline = project->values(ckey).toQStringList(); - int argv0 = findExecutable(cmdline); - if(argv0 != -1) { - cmdline[argv0] = escapeFilePath(Option::fixPathToTargetOS(cmdline.at(argv0), false)); - tmp_cmd = cmdline.join(' '); - } - } - QString tmp_dep_cmd; + const QString tmp_cmd = project->values(ProKey(*it + ".commands")).join(' '); + const QString tmp_dep_cmd = project->values(ProKey(*it + ".depend_command")).join(' '); QString dep_cd_cmd; - const ProKey dckey(*it + ".depend_command"); - if (!project->isEmpty(dckey)) { - int argv0 = -1; - ProStringList cmdline = project->values(dckey); - for(int i = 0; i < cmdline.count(); ++i) { - if(!cmdline.at(i).contains('=')) { - argv0 = i; - break; - } - } - if(argv0 != -1) { - QString arg = cmdline.at(argv0).toQString(); - const QString c = Option::fixPathToLocalOS(arg, true); - if(exists(c)) { - arg = escapeFilePath(Option::fixPathToLocalOS(arg, false)); - } else { - arg = escapeFilePath(arg); - } - QFileInfo cmdFileInfo(arg); - if (!cmdFileInfo.isAbsolute() || cmdFileInfo.exists()) { - cmdline[argv0] = arg; - tmp_dep_cmd = cmdline.join(' '); - } - } + if (!tmp_dep_cmd.isEmpty()) { dep_cd_cmd = QLatin1String("cd ") + escapeFilePath(Option::fixPathToLocalOS(Option::output_dir, false)) + QLatin1String(" && "); @@ -2254,6 +2201,25 @@ MakefileGenerator::writeMakefile(QTextStream &t) return true; } +void +MakefileGenerator::writeDefaultVariables(QTextStream &t) +{ + t << "QMAKE = " << var("QMAKE_QMAKE") << endl; + t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; + t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; + t << "MKDIR = " << var("QMAKE_MKDIR") << endl; + t << "COPY = " << var("QMAKE_COPY") << endl; + t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; + t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; + t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl; + t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl; + t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; + t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; + t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; + t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; + t << "MOVE = " << var("QMAKE_MOVE") << endl; +} + QString MakefileGenerator::fixifySpecdir(const QString &spec, const QString &outdir) { if (QFileInfo(spec).isAbsolute()) @@ -2464,20 +2430,7 @@ MakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubT t << "include " << (*qeui_it) << endl; if (!(flags & SubTargetSkipDefaultVariables)) { - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; - t << "MKDIR = " << var("QMAKE_MKDIR") << endl; - t << "COPY = " << var("QMAKE_COPY") << endl; - t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; - t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; - t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl; - t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl; - t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; - t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; - t << "MOVE = " << var("QMAKE_MOVE") << endl; + writeDefaultVariables(t); t << "SUBTARGETS = "; // subtargets are sub-directory for(int target = 0; target < targets.size(); ++target) t << " \\\n\t\t" << targets.at(target)->target; diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h index a382ca6bf6..12186ebae3 100644 --- a/qmake/generators/makefile.h +++ b/qmake/generators/makefile.h @@ -107,6 +107,7 @@ protected: bool writeDummyMakefile(QTextStream &t); virtual bool writeStubMakefile(QTextStream &t); virtual bool writeMakefile(QTextStream &t); + virtual void writeDefaultVariables(QTextStream &t); QString pkgConfigPrefix() const; QString pkgConfigFileName(bool fixify=true); @@ -135,7 +136,7 @@ protected: const QString &out_directory_cdin, const QString &makefilein); virtual void writeSubMakeCall(QTextStream &t, const QString &outDirectory_cdin, const QString &makeFileIn); - void writeSubTargets(QTextStream &t, QList<SubTarget*> subtargets, int flags); + virtual void writeSubTargets(QTextStream &t, QList<SubTarget*> subtargets, int flags); //extra compiler interface bool verifyExtraCompiler(const ProString &c, const QString &f); diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h index 5820060adb..bada526967 100644 --- a/qmake/generators/unix/unixmake.h +++ b/qmake/generators/unix/unixmake.h @@ -69,6 +69,8 @@ protected: virtual QStringList &findDependencies(const QString &); virtual void init(); + virtual void writeDefaultVariables(QTextStream &t); + virtual void writeSubTargets(QTextStream &t, QList<SubTarget*> subtargets, int flags); void writeMakeParts(QTextStream &); bool writeMakefile(QTextStream &); diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp index cc375f5c46..0ac840d9c9 100644 --- a/qmake/generators/unix/unixmake2.cpp +++ b/qmake/generators/unix/unixmake2.cpp @@ -98,6 +98,81 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t) } void +UnixMakefileGenerator::writeDefaultVariables(QTextStream &t) +{ + MakefileGenerator::writeDefaultVariables(t); + t << "TAR = " << var("QMAKE_TAR") << endl; + t << "COMPRESS = " << var("QMAKE_GZIP") << endl; + + if (project->isEmpty("QMAKE_DISTNAME")) { + ProString distname = project->first("QMAKE_ORIG_TARGET"); + if (!project->isActiveConfig("no_dist_version")) + distname += project->first("VERSION"); + project->values("QMAKE_DISTNAME") = distname; + } + t << "DISTNAME = " << var("QMAKE_DISTNAME") << endl; + + if (project->isEmpty("QMAKE_DISTDIR")) + project->values("QMAKE_DISTDIR") = project->first("QMAKE_DISTNAME"); + t << "DISTDIR = " << escapeFilePath(fileFixify( + (project->isEmpty("OBJECTS_DIR") ? ProString(".tmp/") : project->first("OBJECTS_DIR")) + project->first("QMAKE_DISTDIR"), + Option::output_dir, Option::output_dir, FileFixifyAbsolute)) << endl; +} + +void +UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubTarget*> targets, int flags) +{ + MakefileGenerator::writeSubTargets(t, targets, flags); + + t << "dist: distdir FORCE" << endl; + t << "\t(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar)" + " && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)"; + t << endl << endl; + + t << "distdir:"; + for (int target = 0; target < targets.size(); ++target) { + SubTarget *subtarget = targets.at(target); + t << " " << subtarget->target << "-distdir"; + } + t << " FORCE\n\t" + << mkdir_p_asstring("$(DISTDIR)", false) << "\n\t" + << "$(COPY_FILE) --parents " << var("DISTFILES") << " $(DISTDIR)" << Option::dir_sep << endl << endl; + + const QString abs_source_path = project->first("QMAKE_ABSOLUTE_SOURCE_PATH").toQString(); + for (int target = 0; target < targets.size(); ++target) { + SubTarget *subtarget = targets.at(target); + QString in_directory = subtarget->in_directory; + if (!in_directory.isEmpty() && !in_directory.endsWith(Option::dir_sep)) + in_directory += Option::dir_sep; + QString out_directory = subtarget->out_directory; + if (!out_directory.isEmpty() && !out_directory.endsWith(Option::dir_sep)) + out_directory += Option::dir_sep; + if (!abs_source_path.isEmpty() && out_directory.startsWith(abs_source_path)) + out_directory = Option::output_dir + out_directory.mid(abs_source_path.length()); + + QString dist_directory = out_directory; + if (dist_directory.endsWith(Option::dir_sep)) + dist_directory.chop(Option::dir_sep.length()); + if (!dist_directory.startsWith(Option::dir_sep)) + dist_directory.prepend(Option::dir_sep); + + QString out_directory_cdin = out_directory.isEmpty() ? "\n\t" + : "\n\tcd " + out_directory + " && "; + QString makefilein = " -e -f " + subtarget->makefile + " distdir DISTDIR=$(DISTDIR)" + dist_directory; + + QString out = subtarget->makefile; + QString in = escapeFilePath(fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute)); + if (out.startsWith(in_directory)) + out.remove(0, in_directory.length()); + + t << subtarget->target << "-distdir: FORCE"; + writeSubTargetCall(t, in_directory, in, out_directory, out, + out_directory_cdin, makefilein); + t << endl; + } +} + +void UnixMakefileGenerator::writeMakeParts(QTextStream &t) { QString deps = fileFixify(Option::output.fileName()), target_deps, prl; @@ -142,6 +217,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << " " << var("QMAKE_FRAMEWORKPATH_FLAGS"); t << endl; + writeDefaultVariables(t); + if(!project->isActiveConfig("staticlib")) { t << "LINK = " << var("QMAKE_LINK") << endl; t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl; @@ -150,26 +227,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) t << "AR = " << var("QMAKE_AR") << endl; t << "RANLIB = " << var("QMAKE_RANLIB") << endl; - t << "QMAKE = " << var("QMAKE_QMAKE") << endl; - t << "TAR = " << var("QMAKE_TAR") << endl; - t << "COMPRESS = " << var("QMAKE_GZIP") << endl; if(project->isActiveConfig("compile_libtool")) t << "LIBTOOL = " << var("QMAKE_LIBTOOL") << endl; - t << "COPY = " << var("QMAKE_COPY") << endl; t << "SED = " << var("QMAKE_STREAM_EDITOR") << endl; - t << "COPY_FILE = " << var("QMAKE_COPY_FILE") << endl; - t << "COPY_DIR = " << var("QMAKE_COPY_DIR") << endl; t << "STRIP = " << var("QMAKE_STRIP") << endl; - t << "INSTALL_FILE = " << var("QMAKE_INSTALL_FILE") << endl; - t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl; - t << "INSTALL_PROGRAM = " << var("QMAKE_INSTALL_PROGRAM") << endl; - - t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl; - t << "SYMLINK = " << var("QMAKE_SYMBOLIC_LINK") << endl; - t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl; - t << "MOVE = " << var("QMAKE_MOVE") << endl; - t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl; - t << "MKDIR = " << var("QMAKE_MKDIR") << endl; t << endl; @@ -828,21 +889,15 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) } } - ProString ddir; - ProString packageName(project->first("QMAKE_ORIG_TARGET")); - if(!project->isActiveConfig("no_dist_version")) - packageName += var("VERSION"); - if (project->isEmpty("QMAKE_DISTDIR")) - ddir = packageName; - else - ddir = project->first("QMAKE_DISTDIR"); - - QString ddir_c = escapeFilePath(fileFixify((project->isEmpty("OBJECTS_DIR") ? ProString(".tmp/") : - project->first("OBJECTS_DIR")) + ddir, - Option::output_dir, Option::output_dir)); - t << "dist: \n\t" - << mkdir_p_asstring(ddir_c, false) << "\n\t" - << "$(COPY_FILE) --parents $(DIST) " << ddir_c << Option::dir_sep << " && "; + t << "dist: distdir FORCE\n\t"; + t << "(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar)" + " && $(MOVE) `dirname $(DISTDIR)`" << Option::dir_sep << "$(DISTNAME).tar.gz ." + " && $(DEL_FILE) -r $(DISTDIR)"; + t << endl << endl; + + t << "distdir: FORCE\n\t" + << mkdir_p_asstring("$(DISTDIR)", false) << "\n\t" + << "$(COPY_FILE) --parents $(DIST) $(DISTDIR)" << Option::dir_sep << endl; if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) { const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS"); for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) { @@ -851,20 +906,13 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t) const ProStringList &val = project->values((*var_it).toKey()); if(val.isEmpty()) continue; - t << "$(COPY_FILE) --parents " << val.join(' ') << " " << ddir_c << Option::dir_sep << " && "; + t << "\t$(COPY_FILE) --parents " << val.join(' ') << " $(DISTDIR)" << Option::dir_sep << endl; } } } if(!project->isEmpty("TRANSLATIONS")) - t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && "; - t << "(cd `dirname " << ddir_c << "` && " - << "$(TAR) " << packageName << ".tar " << ddir << " && " - << "$(COMPRESS) " << packageName << ".tar) && " - << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << packageName << ".tar.gz . && " - << "$(DEL_FILE) -r " << ddir_c - << endl << endl; - - t << endl; + t << "\t$(COPY_FILE) --parents " << var("TRANSLATIONS") << " $(DISTDIR)" << Option::dir_sep << endl; + t << endl << endl; QString clean_targets = "compiler_clean " + var("CLEAN_DEPS"); if(do_incremental) { diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp index 8e609fdcae..6189a01ef3 100644 --- a/qmake/generators/win32/msvc_nmake.cpp +++ b/qmake/generators/win32/msvc_nmake.cpp @@ -521,18 +521,23 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) const QString target = var("DEST_TARGET"); QString manifest = project->first("QMAKE_MANIFEST").toQString(); QString extraLFlags; + const bool linkerSupportsEmbedding = (msvcVersion() >= 1200); if (manifest.isEmpty()) { generateManifest = true; - manifest = escapeFilePath(target + ".embed.manifest"); - extraLFlags = "/MANIFEST /MANIFESTFILE:" + manifest; - project->values("QMAKE_CLEAN") << manifest; + if (linkerSupportsEmbedding) { + extraLFlags = "/MANIFEST:embed"; + } else { + manifest = escapeFilePath(target + ".embed.manifest"); + extraLFlags += "/MANIFEST /MANIFESTFILE:" + manifest; + project->values("QMAKE_CLEAN") << manifest; + } } else { manifest = escapeFilePath(fileFixify(manifest)); } const QString resourceId = (templateName == "app") ? "1" : "2"; const bool incrementalLinking = project->values("QMAKE_LFLAGS").toQStringList().filter(QRegExp("(/|-)INCREMENTAL:NO")).isEmpty(); - if (incrementalLinking) { + if (incrementalLinking && !linkerSupportsEmbedding) { // Link a resource that contains the manifest without modifying the exe/dll after linking. QString manifest_rc = escapeFilePath(target + "_manifest.rc"); @@ -565,8 +570,10 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t) // directly embed the manifest in the executable after linking t << "\n\t"; writeLinkCommand(t, extraLFlags); - t << "\n\tmt.exe /nologo /manifest " << manifest - << " /outputresource:$(DESTDIR_TARGET);" << resourceId; + if (!linkerSupportsEmbedding) { + t << "\n\tmt.exe /nologo /manifest " << manifest + << " /outputresource:$(DESTDIR_TARGET);" << resourceId; + } } } else { t << "\n\t"; @@ -597,4 +604,13 @@ void NmakeMakefileGenerator::writeLinkCommand(QTextStream &t, const QString &ext t << "\n<<"; } +int NmakeMakefileGenerator::msvcVersion() const +{ + const int fallbackVersion = 800; // Visual Studio 2005 + const QString ver = project->first(ProKey("MSVC_VER")).toQString(); + bool ok; + float f = ver.toFloat(&ok); + return ok ? int(f * 100) : fallbackVersion; +} + QT_END_NAMESPACE diff --git a/qmake/generators/win32/msvc_nmake.h b/qmake/generators/win32/msvc_nmake.h index 4d3c69bdd6..8d8f5360e0 100644 --- a/qmake/generators/win32/msvc_nmake.h +++ b/qmake/generators/win32/msvc_nmake.h @@ -54,6 +54,7 @@ class NmakeMakefileGenerator : public Win32MakefileGenerator void writeImplicitRulesPart(QTextStream &t); void writeBuildRulesPart(QTextStream &t); void writeLinkCommand(QTextStream &t, const QString &extraFlags = QString(), const QString &extraInlineFileContent = QString()); + int msvcVersion() const; void init(); protected: |