summaryrefslogtreecommitdiff
path: root/qmake/generators/unix/unixmake2.cpp
Side-by-side diff
Diffstat (limited to 'qmake/generators/unix/unixmake2.cpp') (more/less context) (show whitespace changes)
-rw-r--r--qmake/generators/unix/unixmake2.cpp149
1 files changed, 104 insertions, 45 deletions
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 9bb6f6b..7fbb9f4 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -82,5 +82,4 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
!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;
@@ -109,5 +108,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "LEXFLAGS = " << var("QMAKE_LEXFLAGS") << endl;
t << "YACCFLAGS= " << var("QMAKE_YACCFLAGS") << endl;
- t << "INCPATH = " << varGlue("INCLUDEPATH","-I", " -I", "") << " -I" << specdir() << endl;
+ t << "INCPATH = " << "-I" << specdir();
+ if(!project->isActiveConfig("no_include_pwd")) {
+ QString pwd = fileFixify(QDir::currentDirPath());
+ if(pwd.isEmpty())
+ pwd = ".";
+ t << " -I" << pwd;
+ }
+ t << varGlue("INCLUDEPATH"," -I", " -I", "") << endl;
if(!project->isActiveConfig("staticlib")) {
@@ -137,5 +143,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "DEL_DIR = " << var("QMAKE_DEL_DIR") << endl;
t << "MOVE = " << var("QMAKE_MOVE") << endl;
- t << "PRO = " << fileFixify(project->projectFile() )<< endl;
+ t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;
+ t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
t << endl;
@@ -213,6 +220,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if(do_incremental && !moc_incremental && !src_incremental)
do_incremental = FALSE;
- t << "DIST = " << varList("DISTFILES") << endl;
- t << "PRO = " << fileFixify(project->projectFile()) << endl;
+ t << "DIST = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl;
t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl;
t << "DESTDIR = " << var("DESTDIR") << endl;
@@ -222,13 +228,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
} else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
t << "TARGETA = " << var("TARGETA") << endl;
- if (os == "hpux") {
- t << "TARGETD = " << var("TARGET_x") << endl;
- t << "TARGET0 = " << var("TARGET_") << endl;
- }
- else {
+ if (project->isEmpty("QMAKE_HPUX_SHLIB")) {
t << "TARGETD = " << var("TARGET_x.y.z") << endl;
t << "TARGET0 = " << var("TARGET_") << endl;
t << "TARGET1 = " << var("TARGET_x") << endl;
t << "TARGET2 = " << var("TARGET_x.y") << endl;
+ } else {
+ t << "TARGETD = " << var("TARGET_x") << endl;
+ t << "TARGET0 = " << var("TARGET_") << endl;
}
}
@@ -262,5 +267,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if(!project->variables()["OBJECTS_DIR"].isEmpty())
odir = project->first("OBJECTS_DIR");
- t << "###### Dependancies" << endl << endl;
+ t << "###### Dependencies" << endl << endl;
t << odir << ".deps/%.d: %.cpp\n\t"
<< "@echo Creating depend for $<" << "\n\t"
@@ -387,5 +392,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
//real target
- t << var("TARGET") << ": " << " " << incr_deps << " " << var("TARGETDEPS") << "\n\t";
+ t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps
+ << " " << var("POST_TARGETDEPS") << "\n\t";
if(!destdir.isEmpty())
t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
@@ -400,5 +406,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< endl << endl;
- t << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("TARGETDEPS") << "\n\t";
+ t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
+ << var("POST_TARGETDEPS") << "\n\t";
if(!destdir.isEmpty())
t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
@@ -461,11 +468,11 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
//real target
- t << var("DESTDIR_TARGET") << ": " << incr_deps << " $(SUBLIBS) " <<
- var("TARGETDEPS");
+ t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " "
+ << incr_deps << " $(SUBLIBS) " << var("POST_TARGETDEPS");
} else {
t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " <<
var("DESTDIR_TARGET") << endl << endl;
- t << var("DESTDIR_TARGET") << ": $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " <<
- var("TARGETDEPS");
+ t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS")
+ << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << var("POST_TARGETDEPS");
}
if(!destdir.isEmpty())
@@ -484,14 +491,18 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t";
t << endl << endl;
- } else if ( os == "hpux" ) {
+ } else if(project->isEmpty("QMAKE_HPUX_SHLIB")) {
t << "\n\t"
- << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t"
+ << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t"
<< var("QMAKE_LINK_SHLIB_CMD") << "\n\t";
- t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)");
+ t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t"
+ << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t"
+ << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)");
if(!destdir.isEmpty())
t << "\n\t"
<< "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t"
<< "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
- << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR");
+ << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t"
+ << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t"
+ << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR");
if(!project->isEmpty("QMAKE_POST_LINK"))
t << "\n\t" << var("QMAKE_POST_LINK");
@@ -499,16 +510,12 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
} else {
t << "\n\t"
- << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t"
+ << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t"
<< var("QMAKE_LINK_SHLIB_CMD") << "\n\t";
- t << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t"
- << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t"
- << varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)");
+ t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)");
if(!destdir.isEmpty())
t << "\n\t"
<< "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t"
<< "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
- << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t"
- << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t"
- << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR");
+ << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR");
if(!project->isEmpty("QMAKE_POST_LINK"))
t << "\n\t" << var("QMAKE_POST_LINK");
@@ -519,8 +526,8 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if (! project->isActiveConfig("plugin")) {
t << "staticlib: $(TARGETA)" << endl << endl;
- t << "$(TARGETA): $(UICDECLS) $(OBJECTS) $(OBJMOC)";
+ t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC)";
if(do_incremental)
t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
- t << var("TARGETDEPS") << "\n\t"
+ t << var("POST_TARGETDEPS") << "\n\t"
<< "-$(DEL_FILE) $(TARGETA) " << "\n\t"
<< var("QMAKE_AR_CMD");
@@ -536,5 +543,6 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n";
if(project->isEmpty("QMAKE_AR_SUBLIBS")) {
- t << var("DESTDIR") << "$(TARGET): $(UICDECLS) $(OBJECTS) $(OBJMOC) $(TARGETDEPS) " << "\n\t";
+ t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS")
+ << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("POST_TARGETDEPS") << "\n\t";
if(!project->isEmpty("DESTDIR")) {
QString destdir = project->first("DESTDIR");
@@ -551,5 +559,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n";
} else {
- int cnt = 0, max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt();
+ int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt();
QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"],
libs = project->variables()["QMAKE_AR_SUBLIBS"];
@@ -558,10 +566,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
libit != libs.end(); ++libit) {
QStringList build;
- for(cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++)
+ for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++)
build << (*objit);
QString ar;
if((*libit) == "$(TARGET)") {
- t << var("DESTDIR") << "$(TARGET): $(UICDECLS) " << " $(TARGETDEPS) "
- << valList(build) << "\n\t";
+ t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS")
+ << " $(UICDECLS) " << var("POST_TARGETDEPS") << valList(build) << "\n\t";
ar = project->variables()["QMAKE_AR_CMD"].first();
ar = ar.replace("$(OBJMOC)", "").replace("$(OBJECTS)",
@@ -593,5 +601,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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
+ //moc itself shouldn't have this dependency - this is a little kludgy but it is
//better than the alternative for now.
QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET");
@@ -654,5 +662,5 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
<< "$(GZIP) " << var("QMAKE_ORIG_TARGET") << ".tar ) && "
<< "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("QMAKE_ORIG_TARGET") << ".tar.gz . && "
- << "$(DEL_DIR) " << ddir_c
+ << "$(DEL_FILE) -r " << ddir_c
<< endl << endl;
@@ -678,4 +686,43 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << endl;
+ t << "yaccclean:" << "\n";
+ if(!var("YACCSOURCES").isEmpty()) {
+ QStringList clean, &l = project->variables()["YACCSOURCES"];
+ for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ QFileInfo fi((*it));
+ QString dir;
+ if(fi.dirPath() != ".")
+ dir = fi.dirPath() + Option::dir_sep;
+ dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir);
+ if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep)
+ dir += Option::dir_sep;
+ clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first();
+ clean << dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first();
+ }
+ if(!clean.isEmpty()) {
+ t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n";
+ clean_targets += " yaccclean";
+ }
+ }
+
+ t << "lexclean:" << "\n";
+ if(!var("LEXSOURCES").isEmpty()) {
+ QStringList clean, &l = project->variables()["LEXSOURCES"];
+ for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
+ QFileInfo fi((*it));
+ QString dir;
+ if(fi.dirPath() != ".")
+ dir = fi.dirPath() + Option::dir_sep;
+ dir = fileFixify(dir, QDir::currentDirPath(), Option::output_dir);
+ if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep)
+ dir += Option::dir_sep;
+ clean << dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first();
+ }
+ if(!clean.isEmpty()) {
+ t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n";
+ clean_targets += " lexclean";
+ }
+ }
+
if(do_incremental) {
t << "incrclean:" << "\n";
@@ -711,6 +758,10 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep)
destdir += Option::dir_sep;
- t << "distclean: " << "clean\n\t"
- << "-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n";
+ t << "distclean: " << "clean\n";
+ if(project->first("TEMPLATE") == "app" &&
+ project->isActiveConfig("resource_fork") && !project->isActiveConfig("console"))
+ t << "\t-$(DEL_FILE) -r " << destdir.section(Option::dir_sep, 0, -4) << "\n";
+ else
+ t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n";
if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() &&
!project->isActiveConfig("plugin"))
@@ -845,5 +896,5 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
if(project->isEmpty("SUBDIRS")) {
- t << "all qmake_all distclean install uiclean mocclean clean: FORCE" << endl;
+ t << "all qmake_all distclean install uiclean mocclean lexclean yaccclean clean: FORCE" << endl;
} else {
t << "all: $(SUBTARGETS)" << endl;
@@ -863,5 +914,5 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
}
t << endl;
- t << "clean uninstall install uiclean mocclean: qmake_all FORCE";
+ t << "clean uninstall install uiclean mocclean lexclean yaccclean: qmake_all FORCE";
for( it.toFirst(); it.current(); ++it) {
t << "\n\t ( ";
@@ -907,4 +958,6 @@ void UnixMakefileGenerator::init2()
#endif
project->variables()["TARGET"].first().prepend(project->first("DESTDIR"));
+ if ( !project->variables()["QMAKE_CYGWIN_EXE"].isEmpty() )
+ project->variables()["TARGET_EXT"].append(".exe");
} else if ( project->isActiveConfig("staticlib") ) {
project->variables()["TARGET"].first().prepend("lib");
@@ -918,5 +971,4 @@ void UnixMakefileGenerator::init2()
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" +
@@ -934,5 +986,5 @@ void UnixMakefileGenerator::init2()
if(project->isActiveConfig("qt"))
project->variables()["DEFINES"].append("QT_PLUGIN");
- } else if ( os == "hpux" ) {
+ } else if ( !project->isEmpty("QMAKE_HPUX_SHLIB") ) {
project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".sl");
if(project->isActiveConfig("lib_version_first"))
@@ -943,5 +995,5 @@ void UnixMakefileGenerator::init2()
project->first("VER_MAJ"));
project->variables()["TARGET"] = project->variables()["TARGET_x"];
- } else if ( os == "aix" ) {
+ } else if ( !project->isEmpty("QMAKE_AIX_SHLIB") ) {
project->variables()["TARGET_"].append("lib" + project->first("TARGET") + ".a");
if(project->isActiveConfig("lib_version_first")) {
@@ -1012,6 +1064,13 @@ void UnixMakefileGenerator::init2()
if ( !project->variables()["DESTDIR"].isEmpty() )
project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR"));
- if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty() && !project->variables()["TARGET_x"].isEmpty() )
+ if ( !project->variables()["QMAKE_LFLAGS_SONAME"].isEmpty()) {
+ if(project->isActiveConfig("plugin")) {
+ if(!project->variables()["TARGET"].isEmpty() )
+ project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET");
+ } else {
+ if(!project->variables()["TARGET_x"].isEmpty() )
project->variables()["QMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x");
+ }
+ }
if ( project->variables()["QMAKE_LINK_SHLIB_CMD"].isEmpty() )
project->variables()["QMAKE_LINK_SHLIB_CMD"].append(