summaryrefslogtreecommitdiff
path: root/qmake/generators/win32/msvc_nmake.cpp
Side-by-side diff
Diffstat (limited to 'qmake/generators/win32/msvc_nmake.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/win32/msvc_nmake.cpp321
1 files changed, 273 insertions, 48 deletions
diff --git a/qmake/generators/win32/msvc_nmake.cpp b/qmake/generators/win32/msvc_nmake.cpp
index ecef34d..528cb19 100644
--- a/qmake/generators/win32/msvc_nmake.cpp
+++ b/qmake/generators/win32/msvc_nmake.cpp
@@ -1,13 +1,11 @@
/****************************************************************************
-** $Id$
+**
**
-** Definition of ________ class.
+** Implementation of NmakeMakefileGenerator class.
**
-** Created : 970521
+** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
**
-** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
-**
-** This file is part of the network module of the Qt GUI Toolkit.
+** This file is part of qmake.
**
** This file may be distributed under the terms of the Q Public License
** as defined by Trolltech AS of Norway and appearing in the file
@@ -43,7 +41,6 @@
#include <stdlib.h>
#include <time.h>
-
NmakeMakefileGenerator::NmakeMakefileGenerator(QMakeProject *p) : Win32MakefileGenerator(p), init_flag(FALSE)
{
@@ -54,6 +51,11 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
{
writeHeader(t);
if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
+ { //write the extra unix targets..
+ QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"];
+ for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
+ t << *it << " ";
+ }
t << "all clean:" << "\n\t"
<< "@echo \"Some of the required modules ("
<< var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t"
@@ -74,6 +76,24 @@ NmakeMakefileGenerator::writeMakefile(QTextStream &t)
return FALSE;
}
+QStringList
+&NmakeMakefileGenerator::findDependencies(const QString &file)
+{
+ QStringList &aList = MakefileGenerator::findDependencies(file);
+ // Note: The QMAKE_IMAGE_COLLECTION file have all images
+ // as dependency, so don't add precompiled header then
+ if (file == project->first("QMAKE_IMAGE_COLLECTION"))
+ return aList;
+ for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) {
+ if(file.endsWith(*it)) {
+ if(!aList.contains(precompH))
+ aList += precompH;
+ break;
+ }
+ }
+ return aList;
+}
+
void
NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
{
@@ -95,8 +115,8 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
QStringList &incs = project->variables()["INCLUDEPATH"];
for(QStringList::Iterator incit = incs.begin(); incit != incs.end(); ++incit) {
QString inc = (*incit);
- inc.replace(QRegExp("\\\\$"), "\\\\");
- inc.replace("\"", "");
+ if (inc.endsWith("\\"))
+ inc.truncate(inc.length()-1);
t << " -I\"" << inc << "\"";
}
t << " -I\"" << specdir() << "\""
@@ -111,8 +131,8 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
QStringList &libs = project->variables()["QMAKE_LIBS"];
for(QStringList::Iterator libit = libs.begin(); libit != libs.end(); ++libit) {
QString lib = (*libit);
- lib.replace(QRegExp("\\\\$"), "\\\\");
- lib.replace(QRegExp("\""), "");
+ if (lib.endsWith("\\"))
+ lib.truncate(lib.length()-1);
t << " \"" << lib << "\"";
}
t << endl;
@@ -138,6 +158,8 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
t << "MOVE = " << var("QMAKE_MOVE") << endl;
t << "CHK_DIR_EXISTS = " << var("QMAKE_CHK_DIR_EXISTS") << endl;
t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
+ t << "INSTALL_FILE= " << var("QMAKE_INSTALL_FILE") << endl;
+ t << "INSTALL_DIR = " << var("QMAKE_INSTALL_DIR") << endl;
t << endl;
t << "####### Files" << endl << endl;
@@ -149,6 +171,23 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
t << "UICIMPLS = " << varList("UICIMPLS") << endl;
t << "SRCMOC = " << varList("SRCMOC") << endl;
t << "OBJMOC = " << varList("OBJMOC") << endl;
+
+ QString extraCompilerDeps;
+ if(!project->isEmpty("QMAKE_EXTRA_WIN_COMPILERS")) {
+ t << "OBJCOMP = " << varList("OBJCOMP") << endl;
+ extraCompilerDeps += " $(OBJCOMP) ";
+
+ QStringList &comps = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"];
+ for(QStringList::Iterator compit = comps.begin(); compit != comps.end(); ++compit) {
+ QStringList &vars = project->variables()[(*compit) + ".variables"];
+ for(QStringList::Iterator varit = vars.begin(); varit != vars.end(); ++varit) {
+ QStringList vals = project->variables()[(*varit)];
+ if(!vals.isEmpty())
+ t << "QMAKE_COMP_" << (*varit) << " = " << valList(vals) << endl;
+ }
+ }
+ }
+
t << "DIST = " << varList("DISTFILES") << endl;
t << "TARGET = ";
if( !project->variables()[ "DESTDIR" ].isEmpty() )
@@ -164,6 +203,7 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
t << " " << (*cppit);
t << endl << endl;
+
if(!project->isActiveConfig("no_batch")) {
// Batchmode doesn't use the non implicit rules QMAKE_RUN_CXX & QMAKE_RUN_CC
project->variables().remove("QMAKE_RUN_CXX");
@@ -171,12 +211,14 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
QDict<void> source_directories;
source_directories.insert(".", (void*)1);
- if(!project->isEmpty("MOC_DIR"))
- source_directories.insert(project->first("MOC_DIR"), (void*)1);
- if(!project->isEmpty("UI_SOURCES_DIR"))
- source_directories.insert(project->first("UI_SOURCES_DIR"), (void*)1);
- else if(!project->isEmpty("UI_DIR"))
- source_directories.insert(project->first("UI_DIR"), (void*)1);
+ QString directories[] = { QString("MOC_DIR"), QString("UI_SOURCES_DIR"), QString("UI_DIR"), QString::null };
+ for(int y = 0; !directories[y].isNull(); y++) {
+ QString dirTemp = project->first(directories[y]);
+ if (dirTemp.endsWith("\\"))
+ dirTemp.truncate(dirTemp.length()-1);
+ if(!dirTemp.isEmpty())
+ source_directories.insert(dirTemp, (void*)1);
+ }
QString srcs[] = { QString("SOURCES"), QString("UICIMPLS"), QString("SRCMOC"), QString::null };
for(int x = 0; !srcs[x].isNull(); x++) {
QStringList &l = project->variables()[srcs[x]];
@@ -206,9 +248,9 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
}
t << "####### Build rules" << endl << endl;
- t << "all: " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)" << endl << endl;
- t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
- << var("POST_TARGETDEPS");
+ t << "all: " << fileFixify(Option::output.name()) << " " << varGlue("ALL_DEPS"," "," "," ") << "$(TARGET)" << endl << endl;
+ t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
+ << extraCompilerDeps << var("POST_TARGETDEPS");
if(!project->variables()["QMAKE_APP_OR_DLL"].isEmpty()) {
t << "\n\t" << "$(LINK) $(LFLAGS) /OUT:$(TARGET) @<< " << "\n\t "
<< "$(OBJECTS) $(OBJMOC) $(LIBS)";
@@ -216,13 +258,14 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
t << "\n\t" << "$(LIB) /OUT:$(TARGET) @<<" << "\n\t "
<< "$(OBJECTS) $(OBJMOC)";
}
+ t << extraCompilerDeps;
t << endl << "<<" << endl;
if ( !project->variables()["QMAKE_POST_LINK"].isEmpty() )
t << "\t" << var( "QMAKE_POST_LINK" ) << endl;
if(project->isActiveConfig("dll") && !project->variables()["DLLDESTDIR"].isEmpty()) {
QStringList dlldirs = project->variables()["DLLDESTDIR"];
for ( QStringList::Iterator dlldir = dlldirs.begin(); dlldir != dlldirs.end(); ++dlldir ) {
- t << "\n\t" << "-copy $(TARGET) " << *dlldir;
+ t << "\n\t" << "-$(COPY_FILE) \"$(TARGET)\" " << *dlldir;
}
}
QString targetfilename = project->variables()["TARGET"].first();
@@ -232,14 +275,14 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
version = "1.0";
if ( project->isActiveConfig("dll")) {
- t << "\n\t" << ("-$(IDC) $(TARGET) /idl tmp\\" + targetfilename + ".idl -version " + version);
- t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl");
- t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb");
+ t << "\n\t" << ("-$(IDC) $(TARGET) /idl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version);
+ t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
+ t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
t << "\n\t" << ("-$(IDC) $(TARGET) /regserver" );
} else {
- t << "\n\t" << ("-$(TARGET) -dumpidl tmp\\" + targetfilename + ".idl -version " + version);
- t << "\n\t" << ("-$(IDL) tmp\\" + targetfilename + ".idl /nologo /o tmp\\" + targetfilename + ".midl /tlb tmp\\" + targetfilename + ".tlb /iid tmp\\dump.midl /dlldata tmp\\dump.midl /cstub tmp\\dump.midl /header tmp\\dump.midl /proxy tmp\\dump.midl /sstub tmp\\dump.midl");
- t << "\n\t" << ("-$(IDC) $(TARGET) /tlb tmp\\" + targetfilename + ".tlb");
+ t << "\n\t" << ("-$(TARGET) -dumpidl " + var("OBJECTS_DIR") + targetfilename + ".idl -version " + version);
+ t << "\n\t" << ("-$(IDL) /nologo " + var("OBJECTS_DIR") + targetfilename + ".idl /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
+ t << "\n\t" << ("-$(IDC) $(TARGET) /tlb " + var("OBJECTS_DIR") + targetfilename + ".tlb");
t << "\n\t" << "-$(TARGET) -regserver";
}
}
@@ -250,33 +293,53 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
<< var("QMAKE_RC") << " " << var("RC_FILE") << endl << endl;
}
- t << "mocables: $(SRCMOC)" << endl << endl;
+ t << "mocables: $(SRCMOC)" << endl
+ << "uicables: $(UICIMPLS) $(UICDECLS)" << endl << endl;
writeMakeQmake(t);
+ QStringList dist_files = Option::mkfile::project_files;
+ if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES"))
+ dist_files += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"];
+ if(!project->isEmpty("TRANSLATIONS"))
+ dist_files << var("TRANSLATIONS");
+ if(!project->isEmpty("FORMS")) {
+ QStringList &forms = project->variables()["FORMS"];
+ for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) {
+ QString ui_h = fileFixify((*formit) + Option::h_ext.first());
+ if(QFile::exists(ui_h) )
+ dist_files << ui_h;
+ }
+ }
t << "dist:" << "\n\t"
- << "$(ZIP) " << var("PROJECT") << ".zip "
- << var("PROJECT") << ".pro $(SOURCES) $(HEADERS) $(DIST) $(FORMS)" << endl << endl;
-
- t << "clean:"
- << varGlue("OBJECTS","\n\t-del ","\n\t-del ","")
- << varGlue("SRCMOC" ,"\n\t-del ","\n\t-del ","")
- << varGlue("OBJMOC" ,"\n\t-del ","\n\t-del ","")
- << varGlue("UICDECLS" ,"\n\t-del ","\n\t-del ","")
- << varGlue("UICIMPLS" ,"\n\t-del ","\n\t-del ","")
- << varGlue("QMAKE_CLEAN","\n\t-del ","\n\t-del ","")
- << varGlue("CLEAN_FILES","\n\t-del ","\n\t-del ","");
-
+ << "$(ZIP) " << var("QMAKE_ORIG_TARGET") << ".zip " << "$(SOURCES) $(HEADERS) $(DIST) $(FORMS) "
+ << dist_files.join(" ") << " " << var("TRANSLATIONS") << " " << var("IMAGES") << endl << endl;
+
+ t << "uiclean:"
+ << varGlue("UICDECLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","")
+ << varGlue("UICIMPLS" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") << endl;
+
+ t << "mocclean:"
+ << varGlue("SRCMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","")
+ << varGlue("OBJMOC" ,"\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","") << endl;
+
+ t << "clean: uiclean mocclean"
+ << varGlue("OBJECTS","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","")
+ << varGlue("QMAKE_CLEAN","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","\n")
+ << varGlue("CLEAN_FILES","\n\t-$(DEL_FILE) ","\n\t-$(DEL_FILE) ","\n");
if ( project->isActiveConfig("activeqt")) {
- t << ("\n\t-del tmp\\" + targetfilename + ".*");
- t << "\n\t-del tmp\\dump.*";
+ t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".idl");
+ t << ("\n\t-$(DEL_FILE) " + var("OBJECTS_DIR") + targetfilename + ".tlb");
}
if(!project->isEmpty("IMAGES"))
- t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-del ", "\n\t-del ", "");
+ t << varGlue("QMAKE_IMAGE_COLLECTION", "\n\t-$(DEL_FILE) ", "\n\t-$(DEL_FILE) ", "");
+ t << endl;
+
+ // user defined targets
- // blasted user defined targets
+ QStringList::Iterator it;
QStringList &qut = project->variables()["QMAKE_EXTRA_WIN_TARGETS"];
- for(QStringList::Iterator it = qut.begin(); it != qut.end(); ++it) {
+ for(it = qut.begin(); it != qut.end(); ++it) {
QString targ = var((*it) + ".target"),
cmd = var((*it) + ".commands"), deps;
if(targ.isEmpty())
@@ -288,17 +351,105 @@ NmakeMakefileGenerator::writeNmakeParts(QTextStream &t)
dep = (*dep_it);
deps += " " + dep;
}
+ if(!project->variables()["QMAKE_NOFORCE"].isEmpty() &&
+ project->variables()[(*it) + ".CONFIG"].findIndex("phony") != -1)
+ deps += QString(" ") + "FORCE";
t << "\n\n" << targ << ":" << deps << "\n\t"
<< cmd;
}
-
t << endl << endl;
+ QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"];
+ for(it = quc.begin(); it != quc.end(); ++it) {
+ QString tmp_out = project->variables()[(*it) + ".output"].first();
+ QString tmp_cmd = project->variables()[(*it) + ".commands"].join(" ");
+ QString tmp_dep = project->variables()[(*it) + ".depends"].join(" ");
+ QStringList &vars = project->variables()[(*it) + ".variables"];
+ if(tmp_out.isEmpty() || tmp_cmd.isEmpty())
+ continue;
+ QStringList &tmp = project->variables()[(*it) + ".input"];
+ for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
+ QStringList &inputs = project->variables()[(*it2)];
+ for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
+ QFileInfo fi(Option::fixPathToLocalOS((*input)));
+ QString in = Option::fixPathToTargetOS((*input), FALSE),
+ out = tmp_out, cmd = tmp_cmd, deps;
+ out.replace("${QMAKE_FILE_BASE}", fi.baseName());
+ out.replace("${QMAKE_FILE_NAME}", fi.fileName());
+ cmd.replace("${QMAKE_FILE_BASE}", fi.baseName());
+ cmd.replace("${QMAKE_FILE_OUT}", out);
+ cmd.replace("${QMAKE_FILE_NAME}", fi.fileName());
+ for(QStringList::Iterator it3 = vars.begin(); it3 != vars.end(); ++it3)
+ cmd.replace("$(" + (*it3) + ")", "$(QMAKE_COMP_" + (*it3)+")");
+ if(!tmp_dep.isEmpty()) {
+ char buff[256];
+ QString dep_cmd = tmp_dep;
+ dep_cmd.replace("${QMAKE_FILE_NAME}", fi.fileName());
+ if(FILE *proc = QT_POPEN(dep_cmd.latin1(), "r")) {
+ while(!feof(proc)) {
+ int read_in = int(fread(buff, 1, 255, proc));
+ if(!read_in)
+ break;
+ int l = 0;
+ for(int i = 0; i < read_in; i++) {
+ if(buff[i] == '\n' || buff[i] == ' ') {
+ deps += " " + QCString(buff+l, (i - l) + 1);
+ l = i;
+ }
+ }
+ }
+ fclose(proc);
+ }
+ }
+ t << out << ": " << in << deps << "\n\t"
+ << cmd << endl << endl;
+ }
+ }
+ }
+ t << endl;
+
+ if(project->variables()["QMAKE_NOFORCE"].isEmpty())
+ t << "FORCE:" << endl << endl;
+
t << "distclean: clean"
- << "\n\t-del $(TARGET)"
+ << "\n\t-$(DEL_FILE) $(TARGET)"
<< endl << endl;
+
+ // precompiled header
+ if(usePCH) {
+ QString precompRule = QString("-c -Yc -Fp%1 -Fo%2").arg(precompPch).arg(precompObj);
+ t << precompObj << ": " << precompH << " " << findDependencies(precompH).join(" \\\n\t\t")
+ << "\n\t" << "$(CXX) " + precompRule +" $(CXXFLAGS) $(INCPATH) -TP " << precompH << endl << endl;
+ }
}
+QString
+NmakeMakefileGenerator::var(const QString &value)
+{
+ if (usePCH) {
+ if ((value == "QMAKE_RUN_CXX_IMP_BATCH"
+ || value == "QMAKE_RUN_CXX_IMP"
+ || value == "QMAKE_RUN_CXX")) {
+ QFileInfo precompHInfo(precompH);
+ QString precompRule = QString("-c -FI%1 -Yu%2 -Fp%3")
+ .arg(precompHInfo.fileName())
+ .arg(precompHInfo.fileName())
+ .arg(precompPch);
+ QString p = MakefileGenerator::var(value);
+ p.replace("-c", precompRule);
+ // Cannot use -Gm with -FI & -Yu, as this gives an
+ // internal compiler error, on the newer compilers
+ p.remove("-Gm");
+ return p;
+ } else if (value == "QMAKE_CXXFLAGS") {
+ // Remove internal compiler error option
+ return MakefileGenerator::var(value).remove("-Gm");
+ }
+ }
+
+ // Normal val
+ return MakefileGenerator::var(value);
+}
void
NmakeMakefileGenerator::init()
@@ -321,6 +472,11 @@ NmakeMakefileGenerator::init()
return;
}
+ if(project->isEmpty("QMAKE_INSTALL_FILE"))
+ project->variables()["QMAKE_INSTALL_FILE"].append("$(COPY_FILE)");
+ if(project->isEmpty("QMAKE_INSTALL_DIR"))
+ project->variables()["QMAKE_INSTALL_DIR"].append("$(COPY_DIR)");
+
bool is_qt = (project->first("TARGET") == "qt"QTDLL_POSTFIX || project->first("TARGET") == "qt-mt"QTDLL_POSTFIX);
project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"];
@@ -330,6 +486,12 @@ NmakeMakefileGenerator::init()
project->variables()["DEFINES"].append("QT_DLL");
if (project->isActiveConfig("qt_dll"))
if(configs.findIndex("qt") == -1) configs.append("qt");
+ if ( project->isActiveConfig("qtopia") ) {
+ if(configs.findIndex("qtopialib") == -1)
+ configs.append("qtopialib");
+ if(configs.findIndex("qtopiainc") == -1)
+ configs.append("qtopiainc");
+ }
if ( project->isActiveConfig("qt") ) {
if ( project->isActiveConfig( "plugin" ) ) {
project->variables()["CONFIG"].append("dll");
@@ -401,6 +563,13 @@ NmakeMakefileGenerator::init()
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"];
if ( project->isActiveConfig("qt") || project->isActiveConfig("opengl") )
project->variables()["CONFIG"].append("windows");
+ if ( project->isActiveConfig("qtopiainc") )
+ project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QTOPIA"];
+ if ( project->isActiveConfig("qtopialib") ) {
+ if(!project->isEmpty("QMAKE_LIBDIR_QTOPIA"))
+ project->variables()["QMAKE_LIBDIR"] += project->variables()["QMAKE_LIBDIR_QTOPIA"];
+ project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"];
+ }
if ( project->isActiveConfig("qt") ) {
project->variables()["CONFIG"].append("moc");
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"];
@@ -508,10 +677,26 @@ NmakeMakefileGenerator::init()
if ( project->isActiveConfig("moc") )
setMocAware(TRUE);
project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
+
+ QStringList &libList = project->variables()["QMAKE_LIBS"];
+ for( QStringList::Iterator stIt = libList.begin(); stIt != libList.end(); ) {
+ QString s = *stIt;
+ if( s.startsWith( "-l" ) ) {
+ stIt = libList.remove( stIt );
+ stIt = libList.insert( stIt, s.mid( 2 ) + ".lib" );
+ } else if( s.startsWith( "-L" ) ) {
+ stIt = libList.remove( stIt );
+ project->variables()["QMAKE_LIBDIR"].append(QDir::convertSeparators(s.mid( 2 )));
+ } else {
+ stIt++;
+ }
+ }
+
project->variables()["QMAKE_FILETAGS"] += QStringList::split(' ',
"HEADERS SOURCES DEF_FILE RC_FILE TARGET QMAKE_LIBS DESTDIR DLLDESTDIR INCLUDEPATH");
QStringList &l = project->variables()["QMAKE_FILETAGS"];
- for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ QStringList::Iterator it;
+ for(it = l.begin(); it != l.end(); ++it) {
QStringList &gdmf = project->variables()[(*it)];
for(QStringList::Iterator inner = gdmf.begin(); inner != gdmf.end(); ++inner)
(*inner) = Option::fixPathToTargetOS((*inner), FALSE);
@@ -539,11 +724,30 @@ NmakeMakefileGenerator::init()
project->variables()["RES_FILE"] = project->variables()["RC_FILE"];
project->variables()["RES_FILE"].first().replace(".rc",".res");
project->variables()["POST_TARGETDEPS"] += project->variables()["RES_FILE"];
+ project->variables()["CLEAN_FILES"] += project->variables()["RES_FILE"];
}
if ( !project->variables()["RES_FILE"].isEmpty())
project->variables()["QMAKE_LIBS"] += project->variables()["RES_FILE"];
+ // Base class init!
MakefileGenerator::init();
+
+ // Setup PCH variables
+ precompH = project->first("PRECOMPILED_HEADER");
+ usePCH = !precompH.isEmpty() && project->isActiveConfig("precompile_header");
+ if (usePCH) {
+ // Created files
+ precompObj = var("OBJECTS_DIR") + project->first("TARGET") + "_pch" + Option::obj_ext;
+ precompPch = var("OBJECTS_DIR") + project->first("TARGET") + "_pch.pch";
+ // Add linking of precompObj (required for whole precompiled classes)
+ project->variables()["OBJECTS"] += precompObj;
+ // Add pch file to cleanup
+ project->variables()["QMAKE_CLEAN"] += precompPch;
+ // Return to variable pool
+ project->variables()["PRECOMPILED_OBJECT"] = precompObj;
+ project->variables()["PRECOMPILED_PCH"] = precompPch;
+ }
+
if ( !project->variables()["VERSION"].isEmpty()) {
QStringList l = QStringList::split('.', project->first("VERSION"));
project->variables()["VER_MAJ"].append(l[0]);
@@ -558,5 +762,26 @@ NmakeMakefileGenerator::init()
project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".pdb");
project->variables()["QMAKE_CLEAN"].append(project->first("DESTDIR") + project->first("TARGET") + version + ".ilk");
project->variables()["QMAKE_CLEAN"].append("vc*.pdb");
+ project->variables()["QMAKE_CLEAN"].append("vc*.idb");
+ }
+
+ QStringList &quc = project->variables()["QMAKE_EXTRA_WIN_COMPILERS"];
+ for(it = quc.begin(); it != quc.end(); ++it) {
+ QString tmp_out = project->variables()[(*it) + ".output"].first();
+ if(tmp_out.isEmpty())
+ continue;
+ QStringList &tmp = project->variables()[(*it) + ".input"];
+ for(QStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
+ QStringList &inputs = project->variables()[(*it2)];
+ for(QStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
+ QFileInfo fi(Option::fixPathToLocalOS((*input)));
+ QString in = Option::fixPathToTargetOS((*input), FALSE),
+ out = tmp_out;
+ out.replace("${QMAKE_FILE_BASE}", fi.baseName());
+ out.replace("${QMAKE_FILE_NAME}", fi.fileName());
+ if(project->variables()[(*it) + ".CONFIG"].findIndex("no_link") == -1)
+ project->variables()["OBJCOMP"] += out;
+ }
+ }
}
}