summaryrefslogtreecommitdiff
path: root/qmake
Side-by-side diff
Diffstat (limited to 'qmake') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/unix/unixmake2.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index cbe2014..9bb6f6b 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -66,33 +66,33 @@ UnixMakefileGenerator::writeMakefile(QTextStream &t)
writeMakeParts(t);
return MakefileGenerator::writeMakefile(t);
} else if(project->variables()["TEMPLATE"].first() == "subdirs") {
writeSubdirs(t);
return TRUE;
}
return FALSE;
}
void
UnixMakefileGenerator::writeMakeParts(QTextStream &t)
{
QString deps = fileFixify(Option::output.name()), prl;
bool do_incremental = (project->isActiveConfig("incremental") &&
!project->variables()["QMAKE_INCREMENTAL"].isEmpty() &&
(!project->variables()["QMAKE_APP_FLAG"].isEmpty() ||
- !project->isActiveConfig("staticlib"))),
+ !project->isActiveConfig("staticlib"))),
src_incremental=FALSE, moc_incremental=FALSE;
QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 );
t << "####### Compiler, tools and options" << endl << endl;
t << "CC = ";
if (project->isActiveConfig("thread") &&
! project->variables()["QMAKE_CC_THREAD"].isEmpty())
t << var("QMAKE_CC_THREAD") << endl;
else
t << var("QMAKE_CC") << endl;
t << "CXX = ";
if (project->isActiveConfig("thread") &&
! project->variables()["QMAKE_CXX_THREAD"].isEmpty())
t << var("QMAKE_CXX_THREAD") << endl;
else
@@ -123,32 +123,33 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
t << "AR = " << var("QMAKE_AR") << endl;
t << "RANLIB = " << var("QMAKE_RANLIB") << endl;
t << "MOC = " << var("QMAKE_MOC") << endl;
t << "UIC = " << var("QMAKE_UIC") << endl;
t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl;
t << "TAR = " << var("QMAKE_TAR") << endl;
t << "GZIP = " << var("QMAKE_GZIP") << endl;
t << "COPY = " << var("QMAKE_COPY") << endl;
t << "COPY_FILE= " << var("QMAKE_COPY_FILE") << endl;
t << "COPY_DIR = " << var("QMAKE_COPY_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;
+ t << "PRO = " << fileFixify(project->projectFile() )<< endl;
t << endl;
t << "####### Output directory" << endl << endl;
if (! project->variables()["OBJECTS_DIR"].isEmpty())
t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl;
else
t << "OBJECTS_DIR = ./" << endl;
t << endl;
/* files */
t << "####### Files" << endl << endl;
t << "HEADERS = " << varList("HEADERS") << endl;
t << "SOURCES = " << varList("SOURCES") << endl;
if(do_incremental) {
QStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["QMAKE_INCREMENTAL"], incrs_out;
t << "OBJECTS = ";
@@ -517,99 +518,99 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (! project->isActiveConfig("plugin")) {
t << "staticlib: $(TARGETA)" << endl << endl;
t << "$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)";
if(do_incremental)
t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
t << var("TARGETDEPS") << "\n\t"
<< "-$(DEL_FILE) $(TARGETA) " << "\n\t"
<< var("QMAKE_AR_CMD");
if(do_incremental)
t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
if(!project->isEmpty("QMAKE_RANLIB"))
t << "\n\t" << "$(RANLIB) $(TARGETA)";
t << endl << endl;
}
} else {
- t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) "
+ t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) "
<< varGlue("QMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n"
<< "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n";
if(project->isEmpty("QMAKE_AR_SUBLIBS")) {
t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t";
if(!project->isEmpty("DESTDIR")) {
QString destdir = project->first("DESTDIR");
t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
}
t << "-$(DEL_FILE) $(TARGET)" << "\n\t"
<< var("QMAKE_AR_CMD") << "\n";
if(!project->isEmpty("QMAKE_POST_LINK"))
t << "\t" << var("QMAKE_POST_LINK") << "\n";
if(!project->isEmpty("QMAKE_RANLIB"))
t << "\t" << "$(RANLIB) $(TARGET)" << "\n";
- if(!project->isEmpty("DESTDIR"))
+ if(!project->isEmpty("DESTDIR"))
t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n"
<< "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n";
} else {
int cnt = 0, max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt();
QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"],
libs = project->variables()["QMAKE_AR_SUBLIBS"];
libs.prepend("$(TARGET)");
- for(QStringList::Iterator libit = libs.begin(), objit = objs.begin();
+ for(QStringList::Iterator libit = libs.begin(), objit = objs.begin();
libit != libs.end(); ++libit) {
QStringList build;
- for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++)
+ for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++)
build << (*objit);
QString ar;
if((*libit) == "$(TARGET)") {
- t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) "
+ t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) "
<< valList(build) << "\n\t";
ar = project->variables()["QMAKE_AR_CMD"].first();
- ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)",
+ ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)",
build.join(" "));
} else {
t << (*libit) << ": " << valList(build) << "\n\t";
ar = "$(AR) " + (*libit) + " " + build.join(" ");
}
if(!project->isEmpty("DESTDIR")) {
QString destdir = project->first("DESTDIR");
t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
}
t << "-$(DEL_FILE) " << (*libit) << "\n\t"
<< ar << "\n";
if(!project->isEmpty("QMAKE_POST_LINK"))
t << "\t" << var("QMAKE_POST_LINK") << "\n";
if(!project->isEmpty("QMAKE_RANLIB"))
t << "\t" << "$(RANLIB) " << (*libit) << "\n";
- if(!project->isEmpty("DESTDIR"))
+ if(!project->isEmpty("DESTDIR"))
t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n"
<< "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n";
}
}
t << endl << endl;
}
t << "mocables: $(SRCMOC)" << endl << endl;
if(!project->isActiveConfig("no_mocdepend")) {
//this is an implicity depend on moc, so it will be built if necesary, however
//moc itself shouldn't have this dependancy - this is a little kludgy but it is
//better than the alternative for now.
QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET");
fixEnvVariables(target);
fixEnvVariables(moc);
- if(target != moc)
+ if(target != moc)
t << "$(MOC): \n\t"
<< "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl;
}
writeMakeQmake(t);
if(!project->first("QMAKE_PKGINFO").isEmpty()) {
QString pkginfo = project->first("QMAKE_PKGINFO");
QString destdir = project->first("DESTDIR");
t << pkginfo << ": " << "\n\t";
if(!destdir.isEmpty())
t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
t << "@$(DEL_FILE) " << pkginfo << "\n\t"
<< "@echo \"APPL????\" >" << pkginfo << endl;
}
if(!project->first("QMAKE_INFO_PLIST").isEmpty()) {
@@ -629,33 +630,33 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
}
}
QString ddir = project->isEmpty("QMAKE_DISTDIR") ? project->first("QMAKE_ORIG_TARGET") :
project->first("QMAKE_DISTDIR");
QString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? QString(".tmp/") :
project->first("OBJECTS_DIR")) + ddir);
t << "dist: " << "\n\t"
<< "@mkdir -p " << ddir_c << " && "
<< "$(COPY_FILE) --parents $(SOURCES) $(HEADERS) $(FORMS) $(DIST) " << ddir_c << Option::dir_sep << " && ";
if(!project->isEmpty("TRANSLATIONS"))
t << "$(COPY_FILE) --parents " << var("TRANSLATIONS") << " " << ddir_c << Option::dir_sep << " && ";
if(!project->isEmpty("FORMS")) {
QStringList &forms = project->variables()["FORMS"], ui_headers;
for(QStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) {
QString ui_h = fileFixify((*formit) + Option::h_ext.first());
- if(QFile::exists(ui_h) )
+ if(QFile::exists(ui_h) )
ui_headers << ui_h;
}
if(!ui_headers.isEmpty())
t << "$(COPY_FILE) --parents " << val(ui_headers) << " " << ddir_c << Option::dir_sep << " && ";
}
t << "( cd `dirname " << ddir_c << "` && "
<< "$(TAR) " << var("QMAKE_ORIG_TARGET") << ".tar " << ddir << " && "
<< "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && "
<< "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && "
<< "$(DEL_DIR) " << ddir_c
<< endl << endl;
QString clean_targets;
if(mocAware()) {
t << "mocclean:" << "\n";
if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) {
@@ -792,85 +793,85 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro
}
sd->target = "sub-" + (*it);
sd->target.replace('/', '-');
sd->target.replace('.', '_');
}
}
QPtrListIterator<SubDir> it(subdirs);
QString ofile = Option::output.name();
if(ofile.findRev(Option::dir_sep) != -1)
ofile = ofile.right(ofile.length() - ofile.findRev(Option::dir_sep) -1);
t << "MAKEFILE = " << var("MAKEFILE") << endl;
t << "QMAKE = " << var("QMAKE") << endl;
t << "DEL_FILE = " << var("QMAKE_DEL_FILE") << endl;
t << "SUBTARGETS = "; // subdirectory targets are sub-directory
- for( it.toFirst(); it.current(); ++it)
+ for( it.toFirst(); it.current(); ++it)
t << " \\\n\t\t" << it.current()->target;
t << endl << endl;
t << "first: all\n\nall: " << ofile << " $(SUBTARGETS)" << endl << endl;
// generate target rules
for( it.toFirst(); it.current(); ++it) {
bool have_dir = !(*it)->directory.isEmpty();
QString mkfile = (*it)->makefile, out;
if(have_dir)
mkfile.prepend((*it)->directory + Option::dir_sep);
if(direct || (*it)->makefile != "$(MAKEFILE)")
out = " -o " + (*it)->makefile;
//qmake it
t << mkfile << ": " << "\n\t";
if(have_dir)
t << "cd " << (*it)->directory << " && ";
t << "$(QMAKE) " << (*it)->profile << buildArgs() << out << endl;
//actually compile
t << (*it)->target << ": " << mkfile << " FORCE" << "\n\t";
if(have_dir)
t << "cd " << (*it)->directory << " && ";
t << "$(MAKE) -f " << (*it)->makefile << endl << endl;
}
if (project->isActiveConfig("ordered")) { // generate dependencies
for( it.toFirst(); it.current(); ) {
QString tar = it.current()->target;
++it;
- if (it.current())
+ if (it.current())
t << it.current()->target << ": " << tar << endl;
}
t << endl;
}
writeMakeQmake(t);
if(project->isEmpty("SUBDIRS")) {
t << "all qmake_all distclean install uiclean mocclean clean: FORCE" << endl;
} else {
t << "all: $(SUBTARGETS)" << endl;
t << "qmake_all:";
for( it.toFirst(); it.current(); ++it) {
t << " ";
if(!(*it)->directory.isEmpty())
t << (*it)->directory << Option::dir_sep;
t << (*it)->makefile;
}
for( it.toFirst(); it.current(); ++it) {
t << "\n\t ( ";
if(!(*it)->directory.isEmpty())
t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; ";
- t << "grep \"^qmake_all:\" " << (*it)->makefile
+ t << "grep \"^qmake_all:\" " << (*it)->makefile
<< " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true";
}
t << endl;
t << "clean uninstall install uiclean mocclean: qmake_all FORCE";
for( it.toFirst(); it.current(); ++it) {
t << "\n\t ( ";
if(!(*it)->directory.isEmpty())
t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; ";
t << "$(MAKE) -f " << (*it)->makefile << " $@" << "; ) || true";
}
t << endl;
t << "distclean: qmake_all FORCE";
for( it.toFirst(); it.current(); ++it) {
t << "\n\t ( ";
if(!(*it)->directory.isEmpty())
t << "[ -d " << (*it)->directory << " ] && cd " << (*it)->directory << " ; ";
@@ -909,49 +910,49 @@ void UnixMakefileGenerator::init2()
project->variables()["TARGET"].first().prepend("lib");
project->variables()["TARGET"].first() += ".a";
if(project->variables()["QMAKE_AR_CMD"].isEmpty())
project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJMOC)");
} else {
project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a");
if ( !project->variables()["QMAKE_AR_CMD"].isEmpty() )
project->variables()["QMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)");
else
project->variables()["QMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJMOC)");
QString os = project->variables()["QMAKESPEC"].first().section( '-', 0, 0 );
if( project->isActiveConfig("plugin") ) {
project->variables()["TARGET_x.y.z"].append("lib" +
project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB"));
if(project->isActiveConfig("lib_version_first"))
project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
- project->first("VER_MAJ") + "." +
+ project->first("VER_MAJ") + "." +
project->first("QMAKE_EXTENSION_SHLIB"));
else
project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
project->first("QMAKE_EXTENSION_SHLIB") +
"." + project->first("VER_MAJ"));
project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"];
if(project->isActiveConfig("qt"))
project->variables()["DEFINES"].append("QT_PLUGIN");
} else if ( os == "hpux" ) {
project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl");
if(project->isActiveConfig("lib_version_first"))
- project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." +
+ project->variables()["TARGET_x"].append("lib" + project->first("VER_MAJ") + "." +
project->first("TARGET"));
else
- project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
+ project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
project->first("VER_MAJ"));
project->variables()["TARGET"] = project->variables()["TARGET_x"];
} else if ( os == "aix" ) {
project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a");
if(project->isActiveConfig("lib_version_first")) {
project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
project->first("VER_MAJ") + "." +
project->first("QMAKE_EXTENSION_SHLIB"));
project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." +
project->first("VER_MAJ") +
"." + project->first("VER_MIN") + "." +
project->first("QMAKE_EXTENSION_SHLIB"));
project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." +
project->first("VER_MAJ") + "." +
project->first("VER_MIN") + "." +
project->first("VER_PAT") + "." +