summaryrefslogtreecommitdiff
path: root/qmake/generators/unix
Side-by-side diff
Diffstat (limited to 'qmake/generators/unix') (more/less context) (ignore whitespace changes)
-rw-r--r--qmake/generators/unix/unixmake.cpp557
-rw-r--r--qmake/generators/unix/unixmake.h24
-rw-r--r--qmake/generators/unix/unixmake2.cpp648
3 files changed, 995 insertions, 234 deletions
diff --git a/qmake/generators/unix/unixmake.cpp b/qmake/generators/unix/unixmake.cpp
index e274481..caaddee 100644
--- a/qmake/generators/unix/unixmake.cpp
+++ b/qmake/generators/unix/unixmake.cpp
@@ -1,22 +1,20 @@
/****************************************************************************
-** $Id$
+**
**
-** Definition of ________ class.
-**
-** Created : 970521
+** Implementation of UnixMakefileGenerator class.
**
** Copyright (C) 1992-2003 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
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition licenses may use this
** file in accordance with the Qt Commercial License Agreement provided
@@ -69,51 +67,64 @@ UnixMakefileGenerator::init()
if(project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].findIndex("qmake_all") == -1)
project->variables()["QMAKE_INTERNAL_QMAKE_DEPS"].append("qmake_all");
return; /* subdirs is done */
}
if( project->isEmpty("QMAKE_EXTENSION_SHLIB") ) {
if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) {
project->variables()["QMAKE_EXTENSION_SHLIB"].append( "so" );
} else {
project->variables()["QMAKE_EXTENSION_SHLIB"].append( "dll" );
}
}
+ if( project->isEmpty("QMAKE_CFLAGS_PRECOMPILE"))
+ project->variables()["QMAKE_CFLAGS_PRECOMPILE"].append("-x c-header -c");
+ if( project->isEmpty("QMAKE_CXXFLAGS_PRECOMPILE"))
+ project->variables()["QMAKE_CXXFLAGS_PRECOMPILE"].append("-x c++-header -c");
+ if( project->isEmpty("QMAKE_CFLAGS_USE_PRECOMPILE"))
+ project->variables()["QMAKE_CFLAGS_USE_PRECOMPILE"].append("-include");
+ if( project->isEmpty("QMAKE_EXTENSION_PLUGIN") )
+ project->variables()["QMAKE_EXTENSION_PLUGIN"].append(project->first("QMAKE_EXTENSION_SHLIB"));
if( project->isEmpty("QMAKE_COPY_FILE") )
- project->variables()["QMAKE_COPY_FILE"].append( "$(COPY) -p" );
+ project->variables()["QMAKE_COPY_FILE"].append( "$(COPY)" );
if( project->isEmpty("QMAKE_COPY_DIR") )
- project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -pR" );
+ project->variables()["QMAKE_COPY_DIR"].append( "$(COPY) -R" );
+ 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)" );
+ if( project->isEmpty("QMAKE_LIBTOOL") )
+ project->variables()["QMAKE_LIBTOOL"].append( "libtool --silent" );
//If the TARGET looks like a path split it into DESTDIR and the resulting TARGET
if(!project->isEmpty("TARGET")) {
QString targ = project->first("TARGET");
int slsh = QMAX(targ.findRev('/'), targ.findRev(Option::dir_sep));
if(slsh != -1) {
if(project->isEmpty("DESTDIR"))
project->values("DESTDIR").append("");
else if(project->first("DESTDIR").right(1) != Option::dir_sep)
project->variables()["DESTDIR"] = project->first("DESTDIR") + Option::dir_sep;
project->variables()["DESTDIR"] = project->first("DESTDIR") + targ.left(slsh+1);
project->variables()["TARGET"] = targ.mid(slsh+1);
}
}
project->variables()["QMAKE_ORIG_TARGET"] = project->variables()["TARGET"];
bool is_qt = (project->first("TARGET") == "qt" || project->first("TARGET") == "qte" ||
project->first("TARGET") == "qt-mt" || project->first("TARGET") == "qte-mt");
bool extern_libs = !project->isEmpty("QMAKE_APP_FLAG") ||
(!project->isEmpty("QMAKE_LIB_FLAG") &&
project->isActiveConfig("dll")) || is_qt;
- if(!project->isActiveConfig("global_init_link_order"))
- project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
+ project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
if ( (!project->isEmpty("QMAKE_LIB_FLAG") && !project->isActiveConfig("staticlib") ) ||
(project->isActiveConfig("qt") && project->isActiveConfig( "plugin" ) )) {
if(configs.findIndex("dll") == -1) configs.append("dll");
} else if ( !project->isEmpty("QMAKE_APP_FLAG") || project->isActiveConfig("dll") ) {
configs.remove("staticlib");
}
if ( project->isActiveConfig("warn_off") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_OFF"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_OFF"];
} else if ( project->isActiveConfig("warn_on") ) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_WARN_ON"];
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_WARN_ON"];
@@ -128,131 +139,163 @@ UnixMakefileGenerator::init()
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_RELEASE"];
}
if(!project->isEmpty("QMAKE_INCREMENTAL"))
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_INCREMENTAL"];
else if(!project->isEmpty("QMAKE_LFLAGS_PREBIND") &&
!project->variables()["QMAKE_LIB_FLAG"].isEmpty() &&
project->isActiveConfig("dll"))
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PREBIND"];
if(!project->isEmpty("QMAKE_INCDIR"))
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR"];
if(!project->isEmpty("QMAKE_LIBDIR")) {
if ( !project->isEmpty("QMAKE_RPATH") )
- project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"),
- " " + var("QMAKE_RPATH"), "");
+ project->variables()["QMAKE_LFLAGS"] += varGlue("QMAKE_LIBDIR", " " + var("QMAKE_RPATH"),
+ " " + var("QMAKE_RPATH"), "");
project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue( "QMAKE_LIBDIR", "-L", " -L", "" );
}
- if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) {
- if(configs.findIndex("x11lib") == -1)
- configs.append("x11lib");
- if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 )
- configs.append("x11inc");
+ if ( project->isActiveConfig("qtopia") ) {
+ if(configs.findIndex("qtopialib") == -1)
+ configs.append("qtopialib");
+ if(configs.findIndex("qtopiainc") == -1)
+ configs.append("qtopiainc");
}
- if ( project->isActiveConfig("x11") ) {
- if(configs.findIndex("x11lib") == -1)
- configs.append("x11lib");
- if(configs.findIndex("x11inc") == -1)
- configs.append("x11inc");
+ 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_FLAGS"] += varGlue("QMAKE_LIBDIR_QTOPIA", "-L", " -L", "");
+ project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QTOPIA"];
}
if ( project->isActiveConfig("qt") ) {
if ( project->isActiveConfig("accessibility" ) )
project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_ACCESSIBILITY_SUPPORT");
if ( project->isActiveConfig("tablet") )
project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_TABLET_SUPPORT");
if(configs.findIndex("moc")) configs.append("moc");
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_QT"];
if ( !project->isActiveConfig("debug") )
project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_NO_DEBUG");
if ( !is_qt ) {
- if ( !project->isEmpty("QMAKE_LIBDIR_QT") ) {
- if ( !project->isEmpty("QMAKE_RPATH") )
- project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"),
- " " + var("QMAKE_RPATH"), "");
- project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", "");
+ if ( !project->isEmpty("QMAKE_RPATH") ) {
+ if ( !project->isEmpty("QMAKE_RTLDIR_QT") )
+ project->variables()["QMAKE_LFLAGS"] += varGlue("QMAKE_RTLDIR_QT", " " + var("QMAKE_RPATH"),
+ " " + var("QMAKE_RPATH"), "");
+ else if ( !project->isEmpty("QMAKE_LIBDIR_QT") )
+ project->variables()["QMAKE_LFLAGS"] += varGlue("QMAKE_LIBDIR_QT", " " + var("QMAKE_RPATH"),
+ " " + var("QMAKE_RPATH"), "");
}
- if (project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD"))
+ if ( !project->isEmpty("QMAKE_LIBDIR_QT") )
+ project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_QT", "-L", " -L", "");
+ if ( project->isActiveConfig("thread") && !project->isEmpty("QMAKE_LIBS_QT_THREAD") )
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT_THREAD"];
else
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_QT"];
}
}
- if ( project->isActiveConfig("opengl") ) {
+ if ( project->isActiveConfig("opengl") && !project->isActiveConfig("dlopen_opengl")) {
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_OPENGL"];
if(!project->isEmpty("QMAKE_LIBDIR_OPENGL"))
project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_OPENGL", "-L", " -L", "");
if ( is_qt )
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL_QT"];
else
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_OPENGL"];
}
- if(project->isActiveConfig("global_init_link_order"))
- project->variables()["QMAKE_LIBS"] += project->variables()["LIBS"];
+ if ( extern_libs && (project->isActiveConfig("qt") || project->isActiveConfig("opengl")) ) {
+ if(configs.findIndex("x11lib") == -1)
+ configs.append("x11lib");
+ if ( project->isActiveConfig("opengl") && configs.findIndex("x11inc") == -1 )
+ configs.append("x11inc");
+ }
+ if ( project->isActiveConfig("x11") ) {
+ if(configs.findIndex("x11lib") == -1)
+ configs.append("x11lib");
+ if(configs.findIndex("x11inc") == -1)
+ configs.append("x11inc");
+ }
if ( project->isActiveConfig("x11inc") )
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_X11"];
if ( project->isActiveConfig("x11lib") ) {
if(!project->isEmpty("QMAKE_LIBDIR_X11"))
project->variables()["QMAKE_LIBDIR_FLAGS"] += varGlue("QMAKE_LIBDIR_X11", "-L", " -L", "");
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11"];
}
if ( project->isActiveConfig("x11sm") )
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_X11SM"];
if ( project->isActiveConfig("dylib") )
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_DYNLOAD"];
if ( project->isActiveConfig("thread") ) {
if(project->isActiveConfig("qt"))
project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("QT_THREAD_SUPPORT");
- if ( !project->isEmpty("QMAKE_CFLAGS_THREAD"))
+ if ( !project->isEmpty("QMAKE_CFLAGS_THREAD")) {
project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"];
- if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD"))
+ project->variables()["PRL_EXPORT_CFLAGS"] += project->variables()["QMAKE_CFLAGS_THREAD"];
+ }
+ if( !project->isEmpty("QMAKE_CXXFLAGS_THREAD")) {
project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"];
+ project->variables()["PRL_EXPORT_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_THREAD"];
+ }
project->variables()["INCLUDEPATH"] += project->variables()["QMAKE_INCDIR_THREAD"];
project->variables()["QMAKE_LIBS"] += project->variables()["QMAKE_LIBS_THREAD"];
if(!project->isEmpty("QMAKE_LFLAGS_THREAD"))
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_THREAD"];
}
if ( project->isActiveConfig("moc") )
setMocAware(TRUE);
- if ( project->isEmpty("QMAKE_RUN_CC") )
- project->variables()["QMAKE_RUN_CC"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src");
- if ( project->isEmpty("QMAKE_RUN_CC_IMP") )
- project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<");
- if ( project->isEmpty("QMAKE_RUN_CXX") )
- project->variables()["QMAKE_RUN_CXX"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src");
- if ( project->isEmpty("QMAKE_RUN_CXX_IMP") )
- project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<");
- project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " ");
- if ( !project->isEmpty("PRECOMPH") ) {
- initOutPaths(); // Need to fix MOC_DIR since we do this before init()
+ QString compile_flag = var("QMAKE_COMPILE_FLAG");
+ if(compile_flag.isEmpty())
+ compile_flag = "-c";
+ if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) {
+ QString prefix_flags = project->first("QMAKE_CFLAGS_PREFIX_INCLUDE");
+ if(prefix_flags.isEmpty())
+ prefix_flags = "-include";
+ compile_flag += " " + prefix_flags + " " + project->first("QMAKE_ORIG_TARGET");
+ }
+ if(!project->isEmpty("ALLMOC_HEADER")) {
+ initOutPaths(); // Need to fix outdirs since we do this before init() (because we could add to SOURCES et al)
QString allmoc = fileFixify(project->first("MOC_DIR") + "/allmoc.cpp", QDir::currentDirPath(), Option::output_dir);
project->variables()["SOURCES"].prepend(allmoc);
project->variables()["HEADERS_ORIG"] = project->variables()["HEADERS"];
project->variables()["HEADERS"].clear();
}
+ if ( project->isEmpty("QMAKE_RUN_CC") )
+ project->variables()["QMAKE_RUN_CC"].append("$(CC) " + compile_flag + " $(CFLAGS) $(INCPATH) -o $obj $src");
+ if ( project->isEmpty("QMAKE_RUN_CC_IMP") )
+ project->variables()["QMAKE_RUN_CC_IMP"].append("$(CC) " + compile_flag + " $(CFLAGS) $(INCPATH) -o $@ $<");
+ if ( project->isEmpty("QMAKE_RUN_CXX") )
+ project->variables()["QMAKE_RUN_CXX"].append("$(CXX) " + compile_flag + " $(CXXFLAGS) $(INCPATH) -o $obj $src");
+ if ( project->isEmpty("QMAKE_RUN_CXX_IMP") )
+ project->variables()["QMAKE_RUN_CXX_IMP"].append("$(CXX) " + compile_flag + " $(CXXFLAGS) $(INCPATH) -o $@ $<");
+ project->variables()["QMAKE_FILETAGS"] += QStringList::split("HEADERS SOURCES TARGET DESTDIR", " ");
if( project->isActiveConfig("GNUmake") && !project->isEmpty("QMAKE_CFLAGS_DEPS"))
include_deps = TRUE; //do not generate deps
+ if(project->isActiveConfig("compile_libtool"))
+ Option::obj_ext = ".lo"; //override the .o
MakefileGenerator::init();
if ( project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) {
if(!project->isEmpty("QMAKE_APP_FLAG")) {
if(project->isEmpty("DESTDIR"))
project->values("DESTDIR").append("");
project->variables()["DESTDIR"].first() += project->variables()["TARGET"].first() +
".app/Contents/MacOS/";
project->variables()["QMAKE_PKGINFO"].append(project->first("DESTDIR") + "../PkgInfo");
project->variables()["ALL_DEPS"] += project->first("QMAKE_PKGINFO");
- QString plist = specdir() + QDir::separator() + "Info.plist." +
- project->first("TEMPLATE");
+ QString plist = fileFixify(project->first("QMAKE_INFO_PLIST"));
+ if(plist.isEmpty())
+ plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
if(QFile::exists(Option::fixPathToLocalOS(plist))) {
- project->variables()["QMAKE_INFO_PLIST"].append(plist);
+ if(project->isEmpty("QMAKE_INFO_PLIST"))
+ project->variables()["QMAKE_INFO_PLIST"].append(plist);
project->variables()["QMAKE_INFO_PLIST_OUT"].append(project->first("DESTDIR") +
"../Info.plist");
project->variables()["ALL_DEPS"] += project->first("QMAKE_INFO_PLIST_OUT");
if(!project->isEmpty("RC_FILE"))
project->variables()["ALL_DEPS"] += project->first("DESTDIR") +
"../Resources/application.icns";
}
}
}
if(!project->isEmpty("QMAKE_INTERNAL_INCLUDED_FILES"))
project->variables()["DISTFILES"] += project->variables()["QMAKE_INTERNAL_INCLUDED_FILES"];
@@ -274,97 +317,231 @@ UnixMakefileGenerator::init()
ar_sublibs << lib;
obj_cnt = 0;
}
lib_cnt++;
}
}
}
if(!ar_sublibs.isEmpty()) {
project->variables()["QMAKE_AR_SUBLIBS"] = ar_sublibs;
project->variables()["QMAKE_INTERNAL_PRL_LIBS"] << "QMAKE_AR_SUBLIBS";
}
}
+
+ if(project->isActiveConfig("compile_libtool")) {
+ const QString libtoolify[] = { "QMAKE_RUN_CC", "QMAKE_RUN_CC_IMP",
+ "QMAKE_RUN_CXX", "QMAKE_RUN_CXX_IMP",
+ "QMAKE_LINK_THREAD", "QMAKE_LINK", "QMAKE_AR_CMD", "QMAKE_LINK_SHLIB_CMD",
+ QString::null };
+ for(int i = 0; !libtoolify[i].isNull(); i++) {
+ QStringList &l = project->variables()[libtoolify[i]];
+ if(!l.isEmpty()) {
+ QString libtool_flags, comp_flags;
+ if(libtoolify[i].startsWith("QMAKE_LINK") || libtoolify[i] == "QMAKE_AR_CMD") {
+ libtool_flags += " --mode=link";
+ if(project->isActiveConfig("staticlib")) {
+ libtool_flags += " -static";
+ } else {
+ if(!project->isEmpty("QMAKE_LIB_FLAG")) {
+ int maj = project->first("VER_MAJ").toInt();
+ int min = project->first("VER_MIN").toInt();
+ int pat = project->first("VER_PAT").toInt();
+ comp_flags += " -version-info " + QString::number(10*maj + min) +
+ ":" + QString::number(pat) + ":0";
+ if(libtoolify[i] != "QMAKE_AR_CMD") {
+ QString rpath = Option::output_dir;
+ if(!project->isEmpty("DESTDIR")) {
+ rpath = project->first("DESTDIR");
+ if(QDir::isRelativePath(rpath))
+ rpath.prepend(Option::output_dir + Option::dir_sep);
+ }
+ comp_flags += " -rpath " + Option::fixPathToTargetOS(rpath, FALSE);
+ }
+ }
+ }
+ if(project->isActiveConfig("plugin"))
+ libtool_flags += " -module";
+ } else {
+ libtool_flags += " --mode=compile";
+ }
+ l.first().prepend("$(LIBTOOL)" + libtool_flags + " ");
+ if(!comp_flags.isEmpty())
+ l.first() += comp_flags;
+ }
+ }
+ }
}
QStringList
-UnixMakefileGenerator::uniqueSetLFlags(const QStringList &list1, QStringList &list2)
+UnixMakefileGenerator::combineSetLFlags(const QStringList &list1, const QStringList &list2)
{
+ if(project->isActiveConfig("no_smart_library_merge"))
+ return list1 + list2;
+
QStringList ret;
- for(QStringList::ConstIterator it = list1.begin(); it != list1.end(); ++it) {
- bool unique = TRUE;
- if((*it).startsWith("-")) {
- if((*it).startsWith("-l") || (*it).startsWith("-L")) {
- unique = list2.findIndex((*it)) == -1;
- } else if(project->isActiveConfig("macx") && (*it).startsWith("-framework")) {
- int as_one = TRUE;
- QString framework_in;
- if((*it).length() > 11) {
- framework_in = (*it).mid(11);
- } else {
- if(it != list1.end()) {
- ++it;
- as_one = FALSE;
- framework_in = (*it);
+ for(int i = 0; i < 2; i++) {
+ const QStringList *lst = i ? &list2 : &list1;
+ for(QStringList::ConstIterator it = lst->begin(); it != lst->end(); ++it) {
+ if((*it).startsWith("-")) {
+ if((*it).startsWith("-L")) {
+ if(ret.findIndex((*it)) == -1)
+ ret.append((*it));
+ } else if((*it).startsWith("-l")) {
+ while(1) {
+ QStringList::Iterator idx = ret.find((*it));
+ if(idx == ret.end())
+ break;
+ ret.remove(idx);
}
- }
- if(!framework_in.isEmpty()) {
- for(QStringList::ConstIterator outit = list2.begin(); outit != list2.end(); ++outit) {
- if((*outit).startsWith("-framework")) {
- QString framework_out;
- if((*outit).length() > 11) {
- framework_out = (*outit).mid(11);
- } else {
- if(it != list2.end()) {
- ++outit;
- framework_out = (*outit);
+ ret.append((*it));
+ } else if(project->isActiveConfig("macx") && (*it).startsWith("-framework")) {
+ int as_one = TRUE;
+ QString framework_in;
+ if((*it).length() > 11) {
+ framework_in = (*it).mid(11);
+ } else {
+ if(it != lst->end()) {
+ ++it;
+ as_one = FALSE;
+ framework_in = (*it);
+ }
+ }
+ if(!framework_in.isEmpty()) {
+ for(QStringList::Iterator outit = ret.begin(); outit != ret.end(); ++outit) {
+ if((*outit).startsWith("-framework")) {
+ int found = 0;
+ if((*outit).length() > 11) {
+ if(framework_in == (*outit).mid(11))
+ found = 1;
+ } else {
+ if(it != lst->end()) {
+ ++outit;
+ if(framework_in == (*outit)) {
+ --outit;
+ found = 2;
+ }
+ }
}
- }
- if(framework_out == framework_in) {
- unique = FALSE;
- break;
+ for(int i = 0; i < found; i++)
+ outit = ret.remove(outit);
}
}
- }
- if(unique) {
- unique = FALSE; //because I'm about to just insert it myself
if(as_one) {
ret.append("-framework " + framework_in);
} else {
ret.append("-framework");
ret.append(framework_in);
}
}
+ } else {
+#if 1
+ while(1) {
+ QStringList::Iterator idx = ret.find((*it));
+ if(idx == ret.end())
+ break;
+ ret.remove(idx);
+ }
+#endif
+ ret.append((*it));
}
- } else {
- unique = (list2.findIndex((*it)) == -1);
+ } else /*if(QFile::exists((*it)))*/ {
+ while(1) {
+ QStringList::Iterator idx = ret.find((*it));
+ if(idx == ret.end())
+ break;
+ ret.remove(idx);
+ }
+ ret.append((*it));
}
- } else if(QFile::exists((*it))) {
- unique = (list2.findIndex((*it)) == -1);
}
- if(unique)
- ret.append((*it));
}
return ret;
}
-
void
UnixMakefileGenerator::processPrlVariable(const QString &var, const QStringList &l)
{
if(var == "QMAKE_PRL_LIBS")
- project->variables()["QMAKE_CURRENT_PRL_LIBS"] += uniqueSetLFlags(l, project->variables()["QMAKE_LIBS"]);
+ project->variables()["QMAKE_CURRENT_PRL_LIBS"] = combineSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"] +
+ project->variables()["QMAKE_LIBS"], l);
else
MakefileGenerator::processPrlVariable(var, l);
}
+QString
+UnixMakefileGenerator::findDependency(const QString &dep)
+{
+ QStringList::Iterator it;
+ {
+ QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"];
+ for(it = qut.begin(); it != qut.end(); ++it) {
+ QString targ = var((*it) + ".target");
+ if(targ.isEmpty())
+ targ = (*it);
+ if(targ.endsWith(dep))
+ return targ;
+ }
+ }
+ {
+ QStringList &quc = project->variables()["QMAKE_EXTRA_UNIX_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(" ");
+ 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) {
+ QString out = tmp_out;
+ QFileInfo fi(Option::fixPathToLocalOS((*input)));
+ out.replace("${QMAKE_FILE_BASE}", fi.baseName());
+ out.replace("${QMAKE_FILE_NAME}", fi.fileName());
+ if(out.endsWith(dep))
+ return out;
+ }
+ }
+ }
+ }
+ return MakefileGenerator::findDependency(dep);
+}
+
+QStringList
+&UnixMakefileGenerator::findDependencies(const QString &file)
+{
+ QStringList &ret = MakefileGenerator::findDependencies(file);
+ // Note: The QMAKE_IMAGE_COLLECTION file have all images
+ // as dependency, so don't add precompiled header then
+ if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")
+ && file != project->first("QMAKE_IMAGE_COLLECTION")) {
+ QString header_prefix = project->first("QMAKE_ORIG_TARGET") + ".gch" + Option::dir_sep;
+ header_prefix += project->first("QMAKE_PRECOMP_PREFIX");
+ if(file.endsWith(".c")) {
+ QString precomp_h = header_prefix + "c";
+ if(!ret.contains(precomp_h))
+ ret += precomp_h;
+ } else {
+ for(QStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) {
+ if(file.endsWith(*it)) {
+ QString precomp_h = header_prefix + "c++";
+ if(!ret.contains(precomp_h))
+ ret += precomp_h;
+ break;
+ }
+ }
+ }
+ }
+ return ret;
+}
+
bool
UnixMakefileGenerator::findLibraries()
{
QPtrList<MakefileDependDir> libdirs;
libdirs.setAutoDelete(TRUE);
const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null };
for(int i = 0; !lflags[i].isNull(); i++) {
QStringList &l = project->variables()[lflags[i]];
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
QString stub, dir, extn, opt = (*it).stripWhiteSpace();
if(opt.startsWith("-")) {
if(opt.startsWith("-L")) {
@@ -391,25 +568,25 @@ UnixMakefileGenerator::findLibraries()
int slsh = opt.findRev(Option::dir_sep);
if(slsh != -1) {
dir = opt.left(slsh);
stub = opt.mid(slsh+1);
}
QRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$");
if(stub_reg.exactMatch(stub)) {
stub = stub_reg.cap(1);
extn = stub_reg.cap(2);
}
}
if(!stub.isEmpty()) {
- const QString modifs[] = { "-mt", QString::null };
+ const QString modifs[] = { "", "-mt", QString::null };
for(int modif = 0; !modifs[modif].isNull(); modif++) {
bool found = FALSE;
QStringList extens;
if(!extn.isNull())
extens << extn;
else
extens << project->variables()["QMAKE_EXTENSION_SHLIB"].first() << "a";
for(QStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
if(dir.isNull()) {
QString lib_stub;
for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub +
@@ -422,93 +599,122 @@ UnixMakefileGenerator::findLibraries()
(*it) = "-l" + lib_stub;
found = TRUE;
break;
}
} else {
if(QFile::exists("lib" + stub + modifs[modif] + "." + (*extit))) {
(*it) = "lib" + stub + modifs[modif] + "." + (*extit);
found = TRUE;
break;
}
}
}
+ if(!found && project->isActiveConfig("compile_libtool")) {
+ for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
+ if(QFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub + modifs[modif] + Option::libtool_ext)) {
+ (*it) = mdd->real_dir + Option::dir_sep + "lib" + stub + modifs[modif] + Option::libtool_ext;
+ found = TRUE;
+ break;
+ }
+ }
+ }
if(found)
break;
+
}
}
}
}
return FALSE;
}
+QString linkLib(const QString &file, const QString &libName) {
+ QString ret;
+ QRegExp reg("^.*lib(" + libName + "[^./=]*).*$");
+ if(reg.exactMatch(file))
+ ret = "-l" + reg.cap(1);
+ return ret;
+}
+
void
UnixMakefileGenerator::processPrlFiles()
{
QDict<void> processed;
QPtrList<MakefileDependDir> libdirs;
libdirs.setAutoDelete(TRUE);
const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_LIBS", QString::null };
for(int i = 0; !lflags[i].isNull(); i++) {
for(bool ret = FALSE; TRUE; ret = FALSE) {
QStringList l_out;
QStringList &l = project->variables()[lflags[i]];
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
project->variables()["QMAKE_CURRENT_PRL_LIBS"].clear();
- QString opt = (*it).stripWhiteSpace();;
+ QString opt = (*it).stripWhiteSpace();
if(opt.startsWith("-")) {
if(opt.startsWith("-L")) {
QString r = opt.right(opt.length() - 2), l = r;
fixEnvVariables(l);
libdirs.append(new MakefileDependDir(r.replace("\"",""),
l.replace("\"","")));
} else if(opt.startsWith("-l") && !processed[opt]) {
- QString lib = opt.right(opt.length() - 2), prl;
+ QString lib = opt.right(opt.length() - 2);
for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
- prl = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::prl_ext;
+ if(!project->isActiveConfig("compile_libtool")) { //give them the .libs..
+ QString la = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::libtool_ext;
+ if(QFile::exists(la) && QFile::exists(mdd->local_dir + Option::dir_sep + ".libs")) {
+ l_out.append("-L" + mdd->real_dir + Option::dir_sep + ".libs");
+ libdirs.append(new MakefileDependDir(mdd->real_dir + Option::dir_sep + ".libs",
+ mdd->local_dir + Option::dir_sep + ".libs"));
+ }
+ }
+
+ QString prl = mdd->local_dir + Option::dir_sep + "lib" + lib;
if(processPrlFile(prl)) {
if(prl.startsWith(mdd->local_dir))
prl.replace(0, mdd->local_dir.length(), mdd->real_dir);
- QRegExp reg("^.*lib(" + lib + "[^./=]*)\\..*$");
- if(reg.exactMatch(prl))
- prl = "-l" + reg.cap(1);
- opt = prl;
+ opt = linkLib(prl, lib);
processed.insert(opt, (void*)1);
ret = TRUE;
break;
}
}
} else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) {
if(opt.length() > 11) {
opt = opt.mid(11);
} else {
++it;
opt = (*it);
}
QString prl = "/System/Library/Frameworks/" + opt +
- ".framework/" + opt + Option::prl_ext;
+ ".framework/" + opt;
if(processPrlFile(prl))
ret = TRUE;
l_out.append("-framework");
}
if(!opt.isEmpty())
l_out.append(opt);
- l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out);
+ l_out = combineSetLFlags(l_out, project->variables()["QMAKE_CURRENT_PRL_LIBS"]);
} else {
- if(!processed[opt] && processPrlFile(opt)) {
- processed.insert(opt, (void*)1);
- ret = TRUE;
+ QString lib = opt;
+ if(!processed[lib] && processPrlFile(lib)) {
+ processed.insert(lib, (void*)1);
+ ret = TRUE;
}
+#if 0
+ if(ret)
+ opt = linkLib(lib, "");
+#endif
if(!opt.isEmpty())
- l_out.append(opt);
- l_out += uniqueSetLFlags(project->variables()["QMAKE_CURRENT_PRL_LIBS"], l_out);
+ l_out.append(opt);
+ l_out = combineSetLFlags(l_out, project->variables()["QMAKE_CURRENT_PRL_LIBS"]);
}
}
if(ret && l != l_out)
l = l_out;
else
break;
}
}
}
QString
UnixMakefileGenerator::defaultInstall(const QString &t)
@@ -528,77 +734,144 @@ UnixMakefileGenerator::defaultInstall(const QString &t)
targetdir += Option::dir_sep;
QStringList links;
QString target="$(TARGET)";
if(project->first("TEMPLATE") == "app") {
target = "$(QMAKE_TARGET)";
if(project->isActiveConfig("resource_fork") && !project->isActiveConfig("console")) {
destdir += "../../../";
target += ".app";
resource = TRUE;
}
} else if(project->first("TEMPLATE") == "lib") {
- if(project->isActiveConfig("create_prl") && !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) {
+ if(project->isActiveConfig("create_prl") && !project->isActiveConfig("no_install_prl") &&
+ !project->isEmpty("QMAKE_INTERNAL_PRL_FILE")) {
QString dst_prl = project->first("QMAKE_INTERNAL_PRL_FILE");
int slsh = dst_prl.findRev('/');
if(slsh != -1)
dst_prl = dst_prl.right(dst_prl.length() - slsh - 1);
dst_prl = root + targetdir + dst_prl;
- ret += "-$(COPY) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\"";
+ ret += "-$(INSTALL_FILE) \"" + project->first("QMAKE_INTERNAL_PRL_FILE") + "\" \"" + dst_prl + "\"";
if(!uninst.isEmpty())
uninst.append("\n\t");
uninst.append("-$(DEL_FILE) \"" + dst_prl + "\"");
}
+ if(project->isActiveConfig("create_libtool") && !project->isActiveConfig("compile_libtool")) {
+ QString src_lt = var("QMAKE_ORIG_TARGET");
+ int slsh = src_lt.findRev(Option::dir_sep);
+ if(slsh != -1)
+ src_lt = src_lt.right(src_lt.length() - slsh);
+ int dot = src_lt.find('.');
+ if(dot != -1)
+ src_lt = src_lt.left(dot);
+ src_lt += Option::libtool_ext;
+ src_lt.prepend("lib");
+ QString dst_lt = root + targetdir + src_lt;
+ if(!project->isEmpty("DESTDIR")) {
+ src_lt.prepend(var("DESTDIR"));
+ src_lt = Option::fixPathToLocalOS(fileFixify(src_lt,
+ QDir::currentDirPath(), Option::output_dir));
+ }
+ if(!ret.isEmpty())
+ ret += "\n\t";
+ ret += "-$(INSTALL_FILE) \"" + src_lt + "\" \"" + dst_lt + "\"";
+ if(!uninst.isEmpty())
+ uninst.append("\n\t");
+ uninst.append("-$(DEL_FILE) \"" + dst_lt + "\"");
+ }
+ if(project->isActiveConfig("create_pc")) {
+ QString src_pc = var("QMAKE_ORIG_TARGET");
+ int slsh = src_pc.findRev(Option::dir_sep);
+ if(slsh != -1)
+ src_pc = src_pc.right(src_pc.length() - slsh);
+ int dot = src_pc.find('.');
+ if(dot != -1)
+ src_pc = src_pc.left(dot);
+ src_pc += ".pc";
+ QString d = root + targetdir + "pkgconfig" + Option::dir_sep;
+ QString dst_pc = d + src_pc;
+ if(!project->isEmpty("DESTDIR")) {
+ src_pc.prepend(var("DESTDIR"));
+ src_pc = Option::fixPathToLocalOS(fileFixify(src_pc,
+ QDir::currentDirPath(), Option::output_dir));
+ }
+ if(!ret.isEmpty())
+ ret += "\n\t";
+ ret += mkdir_p_asstring(d) + "\n\t";
+ ret += "-$(INSTALL_FILE) \"" + src_pc + "\" \"" + dst_pc + "\"";
+ if(!uninst.isEmpty())
+ uninst.append("\n\t");
+ uninst.append("-$(DEL_FILE) \"" + dst_pc + "\"");
+ }
if ( project->isEmpty("QMAKE_CYGWIN_SHLIB") ) {
if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) {
if ( project->isEmpty("QMAKE_HPUX_SHLIB") ) {
links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)";
} else {
links << "$(TARGET0)";
}
}
}
}
- QString src_targ = target;
- if(!destdir.isEmpty())
- src_targ = Option::fixPathToTargetOS(destdir + target, FALSE);
- QString dst_targ = root + fileFixify(targetdir + target);
- if(!ret.isEmpty())
- ret += "\n\t";
- ret += QString(resource ? "-$(COPY_DIR)" : "-$(COPY)") + " \"" +
- src_targ + "\" \"" + dst_targ + "\"";
- if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP")) {
- ret += "\n\t-" + var("QMAKE_STRIP");
- if(!project->isEmpty("QMAKE_STRIPFLAGS_LIB") && project->first("TEMPLATE") == "lib")
- ret += " " + var("QMAKE_STRIPFLAGS_LIB");
+
+ if(!resource && project->isActiveConfig("compile_libtool")) {
+ QString src_targ = target;
+ if(src_targ == "$(TARGET)")
+ src_targ = "$(TARGETL)";
+ QString dst_dir = fileFixify(targetdir);
+ if(QDir::isRelativePath(dst_dir))
+ dst_dir = Option::fixPathToTargetOS(Option::output_dir + Option::dir_sep + dst_dir);
+ ret = "-$(LIBTOOL) --mode=install cp \"" + src_targ + "\" \"" + root + dst_dir + "\"";
+ uninst.append("-$(LIBTOOL) --mode=uninstall \"" + src_targ + "\"");
+ } else {
+ QString src_targ = target;
+ if(!destdir.isEmpty())
+ src_targ = Option::fixPathToTargetOS(destdir + target, FALSE);
+ QString dst_targ = root + fileFixify(targetdir + target,
+ QDir::currentDirPath(), Option::output_dir);
+ if(!ret.isEmpty())
+ ret += "\n\t";
if(resource)
- ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\"";
+ ret += "$(DEL_FILE) -r \"" + dst_targ + "\"" + "\n\t";
+ if(!ret.isEmpty())
+ ret += "\n\t";
+ ret += QString(resource ? "-$(INSTALL_DIR)" : "-$(INSTALL_FILE)") + " \"" +
+ src_targ + "\" \"" + dst_targ + "\"";
+ if(!project->isActiveConfig("debug") && !project->isEmpty("QMAKE_STRIP") &&
+ (project->first("TEMPLATE") != "lib" || !project->isActiveConfig("staticlib"))) {
+ ret += "\n\t-" + var("QMAKE_STRIP");
+ if(project->first("TEMPLATE") == "lib" && !project->isEmpty("QMAKE_STRIPFLAGS_LIB"))
+ ret += " " + var("QMAKE_STRIPFLAGS_LIB");
+ else if(project->first("TEMPLATE") == "app" && !project->isEmpty("QMAKE_STRIPFLAGS_APP"))
+ ret += " " + var("QMAKE_STRIPFLAGS_APP");
+ if(resource)
+ ret = " \"" + dst_targ + "/Contents/MacOS/$(QMAKE_TARGET)\"";
+ else
+ ret += " \"" + dst_targ + "\"";
+ }
+ if(!uninst.isEmpty())
+ uninst.append("\n\t");
+ if(resource)
+ uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\"");
else
- ret += " \"" + dst_targ + "\"";
- }
- if(!uninst.isEmpty())
- uninst.append("\n\t");
- if(resource)
- uninst.append("-$(DEL_FILE) -r \"" + dst_targ + "\"");
- else
- uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");
- if(!links.isEmpty()) {
- for(QStringList::Iterator it = links.begin(); it != links.end(); it++) {
- if(Option::target_mode == Option::TARG_WIN_MODE ||
- Option::target_mode == Option::TARG_MAC9_MODE) {
- } else if(Option::target_mode == Option::TARG_UNIX_MODE ||
- Option::target_mode == Option::TARG_MACX_MODE) {
- QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE);
- int lslash = link.findRev(Option::dir_sep);
- if(lslash != -1)
- link = link.right(link.length() - (lslash + 1));
- QString dst_link = root + fileFixify(targetdir + link);
- ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\"";
- if(!uninst.isEmpty())
- uninst.append("\n\t");
- uninst.append("-$(DEL_FILE) \"" + dst_link + "\"");
+ uninst.append("-$(DEL_FILE) \"" + dst_targ + "\"");
+ if(!links.isEmpty()) {
+ for(QStringList::Iterator it = links.begin(); it != links.end(); it++) {
+ if(Option::target_mode == Option::TARG_WIN_MODE ||
+ Option::target_mode == Option::TARG_MAC9_MODE) {
+ } else if(Option::target_mode == Option::TARG_UNIX_MODE ||
+ Option::target_mode == Option::TARG_MACX_MODE) {
+ QString link = Option::fixPathToTargetOS(destdir + (*it), FALSE);
+ int lslash = link.findRev(Option::dir_sep);
+ if(lslash != -1)
+ link = link.right(link.length() - (lslash + 1));
+ QString dst_link = root + targetdir + link;
+ ret += "\n\t-$(SYMLINK) \"$(TARGET)\" \"" + dst_link + "\"";
+ if(!uninst.isEmpty())
+ uninst.append("\n\t");
+ uninst.append("-$(DEL_FILE) \"" + dst_link + "\"");
+ }
}
}
}
return ret;
}
-
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h
index 3d00214..91ec3b1 100644
--- a/qmake/generators/unix/unixmake.h
+++ b/qmake/generators/unix/unixmake.h
@@ -1,22 +1,20 @@
/****************************************************************************
-** $Id$
+**
**
-** Definition of ________ class.
+** Definition of UnixMakefileGenerator class.
**
-** Created : 970521
+** Copyright (C) 1992-2003 Trolltech AS. All rights reserved.
**
-** Copyright (C) 1992-2000 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
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition licenses may use this
** file in accordance with the Qt Commercial License Agreement provided
@@ -25,46 +23,58 @@
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
+
#ifndef __UNIXMAKE_H__
#define __UNIXMAKE_H__
#include "makefile.h"
class UnixMakefileGenerator : public MakefileGenerator
{
bool init_flag, include_deps;
bool writeMakefile(QTextStream &);
- QStringList uniqueSetLFlags(const QStringList &list1, QStringList &list2);
+ void writeExtraVariables(QTextStream &);
+ QString libtoolFileName();
+ void writeLibtoolFile(); // for libtool
+ QString pkgConfigPrefix() const;
+ QString pkgConfigFileName();
+ QString pkgConfigFixPath(QString) const;
+ void writePkgConfigFile(); // for pkg-config
+ QStringList combineSetLFlags(const QStringList &list1, const QStringList &list2);
+ void writePrlFile(QTextStream &);
public:
UnixMakefileGenerator(QMakeProject *p);
~UnixMakefileGenerator();
protected:
+ virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); }
virtual bool doDepends() const { return !include_deps && MakefileGenerator::doDepends(); }
virtual QString defaultInstall(const QString &);
virtual void processPrlVariable(const QString &, const QStringList &);
virtual void processPrlFiles();
virtual bool findLibraries();
+ virtual QString findDependency(const QString &);
+ virtual QStringList &findDependencies(const QString &);
virtual void init();
void writeMakeParts(QTextStream &);
void writeSubdirs(QTextStream &, bool=TRUE);
private:
void init2();
};
inline UnixMakefileGenerator::~UnixMakefileGenerator()
{ }
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index d8a4a0d..21348a6 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1,22 +1,20 @@
/****************************************************************************
-** $Id$
**
-** Definition of ________ class.
**
-** Created : 970521
+** Implementation of UnixMakefileGenerator class.
**
-** Copyright (C) 1992-2002 Trolltech AS. All rights reserved.
+** Copyright (C) 1992-2003 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
** LICENSE.QPL included in the packaging of this file.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** Licensees holding valid Qt Enterprise Edition licenses may use this
** file in accordance with the Qt Commercial License Agreement provided
@@ -28,67 +26,115 @@
** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
** information about Qt Commercial License Agreements.
** See http://www.trolltech.com/qpl/ for QPL licensing information.
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include "unixmake.h"
#include "option.h"
+#include "meta.h"
#include <qregexp.h>
#include <qfile.h>
#include <qdir.h>
#include <time.h>
+QString mkdir_p_asstring(const QString &dir);
UnixMakefileGenerator::UnixMakefileGenerator(QMakeProject *p) : MakefileGenerator(p), init_flag(FALSE), include_deps(FALSE)
{
}
+void
+UnixMakefileGenerator::writePrlFile(QTextStream &t)
+{
+ MakefileGenerator::writePrlFile(t);
+ // libtool support
+ if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib") { //write .la
+ if(project->isActiveConfig("compile_libtool"))
+ warn_msg(WarnLogic, "create_libtool specified with compile_libtool can lead to conflicting .la\n"
+ "formats, create_libtool has been disabled\n");
+ else
+ writeLibtoolFile();
+ }
+ // pkg-config support
+ if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")
+ writePkgConfigFile();
+}
+
bool
UnixMakefileGenerator::writeMakefile(QTextStream &t)
{
+
writeHeader(t);
if(!project->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) {
- t << "all clean:" << "\n\t"
+ t << "QMAKE = " << (project->isEmpty("QMAKE_QMAKE") ? QString("qmake") : var("QMAKE_QMAKE")) << endl;
+ { //write the extra unix targets..
+ QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"];
+ for(QStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
+ t << *it << " ";
+ }
+ t << "all clean install distclean mocables uninstall uicables:" << "\n\t"
<< "@echo \"Some of the required modules ("
<< var("QMAKE_FAILED_REQUIREMENTS") << ") are not available.\"" << "\n\t"
<< "@echo \"Skipped.\"" << endl << endl;
writeMakeQmake(t);
return TRUE;
}
if (project->variables()["TEMPLATE"].first() == "app" ||
project->variables()["TEMPLATE"].first() == "lib") {
writeMakeParts(t);
return MakefileGenerator::writeMakefile(t);
} else if(project->variables()["TEMPLATE"].first() == "subdirs") {
writeSubdirs(t);
return TRUE;
}
return FALSE;
}
void
+UnixMakefileGenerator::writeExtraVariables(QTextStream &t)
+{
+ bool first = TRUE;
+ QMap<QString, QStringList> &vars = project->variables();
+ QStringList &exports = project->variables()["QMAKE_EXTRA_UNIX_VARIABLES"];
+ for(QMap<QString, QStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) {
+ for(QStringList::Iterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) {
+ QRegExp rx((*exp_it), FALSE, TRUE);
+ if(rx.exactMatch(it.key())) {
+ if(first) {
+ t << "\n####### Custom Variables" << endl;
+ first = FALSE;
+ }
+ t << "EXPORT_" << it.key() << " = " << it.data().join(" ") << endl;
+ }
+ }
+ }
+ if(!first)
+ t << endl;
+}
+
+void
UnixMakefileGenerator::writeMakeParts(QTextStream &t)
{
- QString deps = fileFixify(Option::output.name()), prl;
+ QString deps = fileFixify(Option::output.name()), target_deps, 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;
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") &&
@@ -126,27 +172,32 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl;
t << "LIBS = " << "$(SUBLIBS) " << var("QMAKE_LIBDIR_FLAGS") << " " << var("QMAKE_LIBS") << endl;
}
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;
+ if(project->isActiveConfig("compile_libtool"))
+ t << "LIBTOOL = " << var("QMAKE_LIBTOOL") << 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_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;
t << "PRO = " << fileFixify(project->projectFile() )<< endl;
t << "CHK_DIR_EXISTS= " << var("QMAKE_CHK_DIR_EXISTS") << endl;
t << "MKDIR = " << var("QMAKE_MKDIR") << endl;
t << endl;
t << "####### Output directory" << endl << endl;
if (! project->variables()["OBJECTS_DIR"].isEmpty())
t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl;
@@ -211,138 +262,154 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
} else if(!incrs_out.count()) {
t << endl;
} else {
moc_incremental = TRUE;
t << endl;
t << "INCREMENTAL_OBJMOC = " << incrs_out.join(" \\\n\t\t") << endl;
}
} else {
t << "OBJMOC = " << objMoc << endl;
}
if(do_incremental && !moc_incremental && !src_incremental)
do_incremental = FALSE;
+ if(!project->isEmpty("QMAKE_EXTRA_UNIX_COMPILERS")) {
+ t << "OBJCOMP = " << varList("OBJCOMP") << endl;
+ target_deps += " $(OBJCOMP)";
+
+ QStringList &comps = project->variables()["QMAKE_EXTRA_UNIX_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 = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl;
t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl;
t << "DESTDIR = " << var("DESTDIR") << endl;
+ if(project->isActiveConfig("compile_libtool"))
+ t << "TARGETL = " << var("TARGET_la") << endl;
t << "TARGET = " << var("TARGET") << endl;
if(project->isActiveConfig("plugin") ) {
t << "TARGETD = " << var("TARGET") << endl;
} else if (!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
t << "TARGETA = " << var("TARGETA") << endl;
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;
}
}
+ writeExtraVariables(t);
t << endl;
- // blasted incldues
+ // blasted includes
QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"];
QStringList::Iterator it;
for( it = qeui.begin(); it != qeui.end(); ++it)
t << "include " << (*it) << endl;
/* rules */
t << "first: all" << endl;
t << "####### Implicit rules" << endl << endl;
- t << ".SUFFIXES: .c";
+ t << ".SUFFIXES: .c " << Option::obj_ext;
QStringList::Iterator cppit;
for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
t << " " << (*cppit);
t << endl << endl;
for(cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
- t << (*cppit) << ".o:\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
- t << ".c.o:\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
+ t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
+ t << ".c" << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
if(include_deps) {
QString cmd=var("QMAKE_CFLAGS_DEPS") + " ";
cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D","");
if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH"))
cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " ";
cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", "");
QString odir;
if(!project->variables()["OBJECTS_DIR"].isEmpty())
odir = project->first("OBJECTS_DIR");
t << "###### Dependencies" << endl << endl;
t << odir << ".deps/%.d: %.cpp\n\t"
<< "@echo Creating depend for $<" << "\n\t"
<< "@test -d $(@D) || mkdir -p $(@D)" << "\n\t"
<< "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl;
t << odir << ".deps/%.d: %.c\n\t"
<< "@echo Creating depend for $<" << "\n\t"
<< "@test -d $(@D) || mkdir -p $(@D)" << "\n\t"
<< "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@" << endl << endl;
-
QString src[] = { "SOURCES", "UICIMPLS", "SRCMOC", QString::null };
for(int x = 0; !src[x].isNull(); x++) {
QStringList &l = project->variables()[src[x]];
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it) {
if(!(*it).isEmpty()) {
QString d_file;
if((*it).endsWith(".c")) {
d_file = (*it).left((*it).length() - 2);
} else {
for(QStringList::Iterator cppit = Option::cpp_ext.begin();
cppit != Option::cpp_ext.end(); ++cppit) {
if((*it).endsWith((*cppit))) {
d_file = (*it).left((*it).length() - (*cppit).length());
break;
}
}
}
if(!d_file.isEmpty()) {
d_file = odir + ".deps/" + d_file + ".d";
- QStringList deps = findDependencies((*it)).grep(QRegExp(Option::moc_ext + "$"));
+ QStringList deps = findDependencies((*it)).grep(QRegExp(Option::cpp_moc_ext + "$"));
if(!deps.isEmpty())
t << d_file << ": " << deps.join(" ") << endl;
- t << "-include " << d_file << endl;
+ t << var("QMAKE_CFLAGS_USE_PRECOMPILE") << " " << d_file << endl;
}
}
}
}
}
t << "####### Build rules" << endl << endl;
if(!project->variables()["SUBLIBS"].isEmpty()) {
QString libdir = "tmp/";
if(!project->isEmpty("SUBLIBS_DIR"))
libdir = project->first("SUBLIBS_DIR");
t << "SUBLIBS= ";
QStringList &l = project->variables()["SUBLIBS"];
for(QStringList::Iterator it = l.begin(); it != l.end(); ++it)
t << libdir << "lib" << (*it) << ".a ";
t << endl << endl;
}
if(project->isActiveConfig("depend_prl") && !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) {
QStringList &l = project->variables()["QMAKE_PRL_INTERNAL_FILES"];
QStringList::Iterator it;
for(it = l.begin(); it != l.end(); ++it) {
- QMakeProject proj;
- if(proj.read((*it), QDir::currentDirPath()) && !proj.isEmpty("QMAKE_PRL_BUILD_DIR")) {
+ QMakeMetaInfo libinfo;
+ if(libinfo.readLib((*it)) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) {
QString dir;
int slsh = (*it).findRev(Option::dir_sep);
if(slsh != -1)
dir = (*it).left(slsh + 1);
- QString targ = dir + proj.first("QMAKE_PRL_TARGET");
+ QString targ = dir + libinfo.first("QMAKE_PRL_TARGET");
deps += " " + targ;
t << targ << ":" << "\n\t"
<< "@echo \"Creating '" << targ << "'\"" << "\n\t"
- << "(cd " << proj.first("QMAKE_PRL_BUILD_DIR") << ";"
+ << "(cd " << libinfo.first("QMAKE_PRL_BUILD_DIR") << ";"
<< "$(MAKE) )" << endl;
}
}
}
if(!project->variables()["QMAKE_APP_FLAG"].isEmpty()) {
QString destdir = project->first("DESTDIR");
if(do_incremental) {
//incremental target
QString incr_target = var("TARGET") + "_incremental";
if(incr_target.find(Option::dir_sep) != -1)
incr_target = incr_target.right(incr_target.length() -
(incr_target.findRev(Option::dir_sep) + 1));
@@ -383,45 +450,45 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
incr_objs += "-L" + QDir::currentDirPath();
}
if(!incr_objs.isEmpty())
incr_objs += " ";
incr_objs += " -l" + incr_target;
deps.prepend(incr_target_dir + " ");
incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)";
}
t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)"
<< endl << endl;
//real target
- t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps
+ t << var("TARGET") << ": " << var("PRE_TARGETDEPS") << " " << incr_deps << " " << target_deps
<< " " << var("POST_TARGETDEPS") << "\n\t";
if(!destdir.isEmpty())
t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
if(!project->isEmpty("QMAKE_PRE_LINK"))
t << var("QMAKE_PRE_LINK") << "\n\t";
- t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(LIBS)";
+ t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(OBJCOMP) $(LIBS)";
if(!project->isEmpty("QMAKE_POST_LINK"))
t << "\n\t" << var("QMAKE_POST_LINK");
t << endl << endl;
} else {
t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)"
<< endl << endl;
- t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
- << var("POST_TARGETDEPS") << "\n\t";
+ t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) "
+ << target_deps << " " << var("POST_TARGETDEPS") << "\n\t";
if(!destdir.isEmpty())
t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
if(!project->isEmpty("QMAKE_PRE_LINK"))
t << var("QMAKE_PRE_LINK") << "\n\t";
- t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)";
+ t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(OBJCOMP) $(LIBS)";
if(!project->isEmpty("QMAKE_POST_LINK"))
t << "\n\t" << var("QMAKE_POST_LINK");
t << endl << endl;
}
} else if(!project->isActiveConfig("staticlib")) {
QString destdir = project->first("DESTDIR"), incr_deps;
if(do_incremental) {
QString s_ext = project->variables()["QMAKE_EXTENSION_SHLIB"].first();
QString incr_target = var("QMAKE_ORIG_TARGET").replace(
QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental";
if(incr_target.find(Option::dir_sep) != -1)
incr_target = incr_target.right(incr_target.length() -
@@ -459,38 +526,42 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
QStringList &cmd = project->variables()["QMAKE_LINK_SHLIB_CMD"];
if(!destdir.isEmpty())
cmd.append(" -L" + destdir);
cmd.append(" -l" + incr_target);
deps.prepend(incr_target_dir + " ");
incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJMOC)";
}
t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","")
<< " " << var("DESTDIR_TARGET") << endl << endl;
//real target
- t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " "
- << incr_deps << " $(SUBLIBS) " << var("POST_TARGETDEPS");
+ t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS") << " "
+ << incr_deps << " $(SUBLIBS) " << target_deps << " " << var("POST_TARGETDEPS");
} else {
t << "all: " << deps << " " << varGlue("ALL_DEPS",""," ","") << " " <<
var("DESTDIR_TARGET") << endl << endl;
- t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS")
- << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) " << var("POST_TARGETDEPS");
+ t << var("DESTDIR_TARGET") << ": " << var("PRE_TARGETDEPS")
+ << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(SUBLIBS) $(OBJCOMP) " << target_deps
+ << " " << var("POST_TARGETDEPS");
}
if(!destdir.isEmpty())
t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir;
if(!project->isEmpty("QMAKE_PRE_LINK"))
t << "\n\t" << var("QMAKE_PRE_LINK");
- if(project->isActiveConfig("plugin")) {
+ if(project->isActiveConfig("compile_libtool")) {
+ t << "\n\t"
+ << var("QMAKE_LINK_SHLIB_CMD");
+ } else if(project->isActiveConfig("plugin")) {
t << "\n\t"
<< "-$(DEL_FILE) $(TARGET)" << "\n\t"
<< var("QMAKE_LINK_SHLIB_CMD");
if(!destdir.isEmpty())
t << "\n\t"
<< "-$(MOVE) $(TARGET) " << var("DESTDIR");
if(!project->isEmpty("QMAKE_POST_LINK"))
t << "\n\t" << var("QMAKE_POST_LINK") << "\n\t";
t << endl << endl;
} else if(project->isEmpty("QMAKE_HPUX_SHLIB")) {
t << "\n\t"
<< "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t"
@@ -517,166 +588,194 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
t << "\n\t"
<< "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t"
<< "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
<< "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR");
if(!project->isEmpty("QMAKE_POST_LINK"))
t << "\n\t" << var("QMAKE_POST_LINK");
t << endl << endl;
}
t << endl << endl;
if (! project->isActiveConfig("plugin")) {
t << "staticlib: $(TARGETA)" << endl << endl;
- t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC)";
+ t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP)";
if(do_incremental)
t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJMOC)";
t << var("POST_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): " << var("PRE_TARGETDEPS")
- << " $(UICDECLS) $(OBJECTS) $(OBJMOC) " << var("POST_TARGETDEPS") << "\n\t";
+ t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS")
+ << " $(UICDECLS) $(OBJECTS) $(OBJMOC) $(OBJCOMP) " << var("POST_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 max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt();
- QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"],
+ QStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJMOC"] +
+ project->variables()["OBJCOMP"],
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(int 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): " << var("PRE_TARGETDEPS")
+ 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)",
+ 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;
+ t << "mocables: $(SRCMOC)" << endl
+ << "uicables: $(UICDECLS) $(UICIMPLS)" << 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 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");
+ QString moc = project->first("QMAKE_MOC"), target = project->first("TARGET"),
+ moc_dir = "$(QTDIR)/src/moc";
+ if(!project->isEmpty("QMAKE_MOC_SRC"))
+ moc_dir = project->first("QMAKE_MOC_SRC");
fixEnvVariables(target);
fixEnvVariables(moc);
- if(target != moc)
+ if(target != moc)
t << "$(MOC): \n\t"
- << "( cd $(QTDIR)/src/moc ; $(MAKE) )" << endl << endl;
+ << "( cd " << moc_dir << " && $(MAKE) )" << endl << endl;
}
writeMakeQmake(t);
+ if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isActiveConfig("no_autoqmake")) {
+ QString meta_files;
+ if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib" &&
+ !project->isActiveConfig("compile_libtool")) { //libtool
+ if(!meta_files.isEmpty())
+ meta_files += " ";
+ meta_files += libtoolFileName();
+ }
+ if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") { //pkg-config
+ if(!meta_files.isEmpty())
+ meta_files += " ";
+ meta_files += pkgConfigFileName();
+ }
+ if(!meta_files.isEmpty()) {
+ QStringList files = fileFixify(Option::mkfile::project_files);
+ t << meta_files << ": " << "\n\t"
+ << "@$(QMAKE) -prl " << buildArgs() << " " << files.join(" ") << endl;
+ }
+ }
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()) {
QString info_plist = project->first("QMAKE_INFO_PLIST"),
- info_plist_out = project->first("QMAKE_INFO_PLIST_OUT");
+ info_plist_out = project->first("QMAKE_INFO_PLIST_OUT");
QString destdir = project->first("DESTDIR");
t << info_plist_out << ": " << "\n\t";
if(!destdir.isEmpty())
t << "@test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
- << "@cp \"" << info_plist << "\" \"" << info_plist_out << "\"" << endl;
+ << "@sed -e \"s,@ICON@,application.icns,g\" -e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET")
+ << ",g\" \"" << info_plist << "\" >\"" << info_plist_out << "\"" << endl;
if(!project->first("RC_FILE").isEmpty()) {
QString dir = destdir + "../Resources/";
- t << dir << "application.icns:" << "\n\t"
+ t << dir << "application.icns: " << var("RC_FILE") << "\n\t"
<< "@test -d " << dir << " || mkdir -p " << dir << "\n\t"
- << "@cp " << var("RC_FILE") << " " << dir << "application.icns" << endl;
+ << "@$(DEL_FILE) " << dir << "application.icns" << "\n\t"
+ << "@$(COPY_FILE) " << var("RC_FILE") << " " << dir << "application.icns" << endl;
}
}
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("IMAGES"))
+ t << "$(COPY_FILE) --parents " << var("IMAGES") << " " << 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_FILE) -r " << ddir_c
<< endl << endl;
QString clean_targets;
+ t << "mocclean:" << "\n";
if(mocAware()) {
- t << "mocclean:" << "\n";
if(!objMoc.isEmpty() || !srcMoc.isEmpty() || moc_incremental) {
if(!objMoc.isEmpty())
t << "\t-$(DEL_FILE) $(OBJMOC)" << '\n';
if(!srcMoc.isEmpty())
t << "\t-$(DEL_FILE) $(SRCMOC)" << '\n';
if(moc_incremental)
t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n';
clean_targets += " mocclean";
}
t << endl;
}
t << "uiclean:" << "\n";
@@ -688,64 +787,74 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
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();
+ 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();
+ 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";
if(src_incremental)
t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n";
if(moc_incremental)
t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJMOC)" << '\n';
t << endl;
}
t << "clean:" << clean_targets << "\n\t";
- if(!project->isEmpty("OBJECTS"))
- t << "-$(DEL_FILE) $(OBJECTS) " << "\n\t";
+ if(!project->isEmpty("OBJECTS")) {
+ if(project->isActiveConfig("compile_libtool"))
+ t << "-$(LIBTOOL) --mode=clean $(DEL_FILE) $(OBJECTS)" << "\n\t";
+ else
+ t << "-$(DEL_FILE) $(OBJECTS)" << "\n\t";
+ }
+ if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) {
+ QString header_prefix = project->first("QMAKE_PRECOMP_PREFIX");
+ QString precomph_out_dir = project->first("QMAKE_ORIG_TARGET") + ".gch" + Option::dir_sep;
+ t << "-$(DEL_FILE) " << precomph_out_dir << header_prefix + "c "
+ << precomph_out_dir << header_prefix << "c++" << "\n\t";
+ }
if(!project->isEmpty("IMAGES"))
t << varGlue("QMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t";
if(src_incremental)
t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n\t";
t << varGlue("QMAKE_CLEAN","-$(DEL_FILE) "," ","\n\t")
<< "-$(DEL_FILE) *~ core *.core" << "\n"
<< varGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl;
t << "####### Sub-libraries" << endl << endl;
if ( !project->variables()["SUBLIBS"].isEmpty() ) {
QString libdir = "tmp/";
if(!project->isEmpty("SUBLIBS_DIR"))
libdir = project->first("SUBLIBS_DIR");
@@ -753,94 +862,176 @@ UnixMakefileGenerator::writeMakeParts(QTextStream &t)
for(it = l.begin(); it != l.end(); ++it)
t << libdir << "lib" << (*it) << ".a" << ":\n\t"
<< var(QString("MAKELIB") + (*it)) << endl << endl;
}
QString destdir = project->first("DESTDIR");
if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep)
destdir += Option::dir_sep;
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 if(project->isActiveConfig("compile_libtool"))
+ t << "\t-$(LIBTOOL) --mode=clean $(DEL_FILE) " << "$(TARGET)" << "\n";
else
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)" << " " << "$(TARGET)" << "\n";
if(!project->isActiveConfig("staticlib") && project->variables()["QMAKE_APP_FLAG"].isEmpty() &&
- !project->isActiveConfig("plugin"))
+ !project->isActiveConfig("plugin") && !project->isActiveConfig("compile_libtool"))
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) "
<< destdir << "$(TARGET2) $(TARGETA)" << "\n";
t << endl << endl;
- if ( !project->isEmpty("PRECOMPH") ) {
+ if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER") ) {
+ QString precomph = fileFixify(project->first("PRECOMPILED_HEADER"));
+ t << "###### Prefix headers" << endl;
+ QString comps[] = { "C", "CXX", QString::null };
+ for(int i = 0; !comps[i].isNull(); i++) {
+ QString flags = var("QMAKE_" + comps[i] + "FLAGS_PRECOMPILE");
+ flags += " $(" + comps[i] + "FLAGS)";
+
+ QString header_prefix = project->first("QMAKE_PRECOMP_PREFIX");
+ QString outdir = project->first("QMAKE_ORIG_TARGET") + ".gch" + Option::dir_sep, outfile = outdir;
+ QString compiler;
+ if(comps[i] == "C") {
+ outfile += header_prefix + "c";
+ compiler = "$(CC) ";
+ } else {
+ outfile += header_prefix + "c++";
+ compiler = "$(CXX) ";
+ }
+ t << outfile << ": " << precomph << " " << findDependencies(precomph).join(" \\\n\t\t")
+ << "\n\t" << "test -d " << outdir << " || mkdir -p " << outdir
+ << "\n\t" << compiler << flags << " $(INCPATH) " << precomph << " -o " << outfile << endl << endl;
+ }
+ }
+ if(!project->isEmpty("ALLMOC_HEADER")) {
QString outdir = project->first("MOC_DIR");
- QString qt_dot_h = Option::fixPathToLocalOS(project->first("PRECOMPH"));
- t << "###### Combined headers" << endl << endl;
- //XXX
- t << outdir << "allmoc.cpp: " << qt_dot_h << " "
+ QString precomph = fileFixify(project->first("ALLMOC_HEADER"));
+ t << "###### Combined headers" << endl << endl
+ << outdir << "allmoc.cpp: " << precomph << " "
<< varList("HEADERS_ORIG") << "\n\t"
- << "echo '#include \"" << qt_dot_h << "\"' >" << outdir << "allmoc.cpp" << "\n\t"
+ << "echo '#include \"" << precomph << "\"' >" << outdir << "allmoc.cpp" << "\n\t"
<< "$(CXX) -E -DQT_MOC_CPP -DQT_NO_STL $(CXXFLAGS) $(INCPATH) >" << outdir << "allmoc.h "
- << outdir << "allmoc.cpp" << "\n\t"
+ << outdir << "allmoc.cpp" << "\n\t"
<< "$(MOC) -o " << outdir << "allmoc.cpp " << outdir << "allmoc.h" << "\n\t"
<< "perl -pi -e 's{#include \"allmoc.h\"}{#define QT_H_CPP\\n#include \""
- << qt_dot_h << "\"}' " << outdir << "allmoc.cpp" << "\n\t"
+ << precomph << "\"}' " << outdir << "allmoc.cpp" << "\n\t"
<< "$(DEL_FILE) " << outdir << "allmoc.h" << endl << endl;
}
- // blasted user defined targets
+ // user defined targets
QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"];
for(it = qut.begin(); it != qut.end(); ++it) {
QString targ = var((*it) + ".target"),
cmd = var((*it) + ".commands"), deps;
if(targ.isEmpty())
targ = (*it);
QStringList &deplist = project->variables()[(*it) + ".depends"];
for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
QString dep = var((*dep_it) + ".target");
if(dep.isEmpty())
dep = (*dep_it);
deps += " " + dep;
}
+ if(project->variables()[(*it) + ".CONFIG"].findIndex("phony") != -1)
+ deps += QString(" ") + "FORCE";
t << targ << ":" << deps << "\n\t"
<< cmd << endl << endl;
}
+ // user defined compilers
+ QStringList &quc = project->variables()["QMAKE_EXTRA_UNIX_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 <<"FORCE:" << endl << endl;
}
struct SubDir
{
QString directory, profile, target, makefile;
};
void
UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
{
+ // blasted includes
+ QStringList &qeui = project->variables()["QMAKE_EXTRA_UNIX_INCLUDES"];
+ for(QStringList::Iterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it)
+ t << "include " << (*qeui_it) << endl;
+ writeExtraVariables(t);
+
QPtrList<SubDir> subdirs;
{
QStringList subdirs_in = project->variables()["SUBDIRS"];
for(QStringList::Iterator it = subdirs_in.begin(); it != subdirs_in.end(); ++it) {
QString file = (*it);
fileFixify(file);
SubDir *sd = new SubDir;
subdirs.append(sd);
sd->makefile = "$(MAKEFILE)";
if((*it).right(4) == ".pro") {
int slsh = file.findRev(Option::dir_sep);
if(slsh != -1) {
sd->directory = file.left(slsh+1);
sd->profile = file.mid(slsh+1);
} else {
sd->profile = file;
}
} else {
+ if(!file.isEmpty())
+ sd->profile = file.section(Option::dir_sep, -1) + ".pro";
sd->directory = file;
}
while(sd->directory.right(1) == Option::dir_sep)
sd->directory = sd->directory.left(sd->directory.length() - 1);
if(!sd->profile.isEmpty()) {
QString basename = sd->directory;
int new_slsh = basename.findRev(Option::dir_sep);
if(new_slsh != -1)
basename = basename.mid(new_slsh+1);
if(sd->profile != basename + ".pro")
sd->makefile += "." + sd->profile.left(sd->profile.length() - 4); //no need for the .pro
}
@@ -848,98 +1039,147 @@ UnixMakefileGenerator::writeSubdirs(QTextStream &t, bool direct)
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 << "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 << "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;
+ t << mkdir_p_asstring((*it)->directory) << "\n\t"
+ << "cd " << (*it)->directory << " && ";
+ QString profile = fileFixify((*it)->profile, (*it)->directory, (*it)->directory);
+ t << "$(QMAKE) " << 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 lexclean yaccclean clean: FORCE" << endl;
+ t << "all qmake_all distclean uicables mocables install_subdirs uninstall_subdirs"
+ << " uiclean mocclean lexclean yaccclean clean " << var("SUBDIR_TARGETS") << ": 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 lexclean yaccclean: qmake_all FORCE";
+ t << "clean uicables mocables uiclean mocclean lexclean yaccclean "
+ << var("SUBDIR_TARGETS") << ": 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 << "uninstall_subdirs: 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 << " uninstall" << "; ) || true";
+ }
+ t << endl;
+ t << "install_subdirs: 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 << " install" << "; ) || 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 << " ; ";
t << "$(MAKE) -f " << (*it)->makefile << " $@; $(DEL_FILE) " << (*it)->makefile << "; ) || true";
}
t << endl << endl;
}
+
+ //installations
+ project->variables()["INSTALLDEPS"] += "install_subdirs";
+ project->variables()["UNINSTALLDEPS"] += "uninstall_subdirs";
+ writeInstalls(t, "INSTALLS");
+
+ // user defined targets
+ QStringList &qut = project->variables()["QMAKE_EXTRA_UNIX_TARGETS"];
+ for(QStringList::Iterator qut_it = qut.begin(); qut_it != qut.end(); ++qut_it) {
+ QString targ = var((*qut_it) + ".target"),
+ cmd = var((*qut_it) + ".commands"), deps;
+ if(targ.isEmpty())
+ targ = (*qut_it);
+ QStringList &deplist = project->variables()[(*qut_it) + ".depends"];
+ for(QStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
+ QString dep = var((*dep_it) + ".target");
+ if(dep.isEmpty())
+ dep = (*dep_it);
+ deps += " " + dep;
+ }
+ if(project->variables()[(*qut_it) + ".CONFIG"].findIndex("phony") != -1)
+ deps += QString(" ") + "FORCE";
+ t << targ << ":" << deps << "\n\t"
+ << cmd << endl << endl;
+ }
t <<"FORCE:" << endl << endl;
}
void UnixMakefileGenerator::init2()
{
//version handling
if(project->variables()["VERSION"].isEmpty())
project->variables()["VERSION"].append("1.0." +
(project->isEmpty("VER_PAT") ? QString("0") :
project->first("VER_PAT")) );
QStringList l = QStringList::split('.', project->first("VERSION"));
l << "0" << "0"; //make sure there are three
@@ -958,50 +1198,56 @@ 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");
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->isActiveConfig("compile_libtool") )
+ project->variables()["TARGET_la"] = project->first("DESTDIR") + "lib" + project->first("TARGET") + Option::libtool_ext;
+
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)");
- if( project->isActiveConfig("plugin") ) {
+ if( project->isActiveConfig("compile_libtool") ) {
+ project->variables()["TARGET"] = project->variables()["TARGET_la"];
+ } else if( project->isActiveConfig("plugin") ) {
project->variables()["TARGET_x.y.z"].append("lib" +
- project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_SHLIB"));
+ project->first("TARGET") + "." +
+ project->first("QMAKE_EXTENSION_PLUGIN"));
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->first("VER_MAJ") + "." +
+ project->first("QMAKE_EXTENSION_PLUGIN"));
else
project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
- project->first("QMAKE_EXTENSION_SHLIB") +
+ project->first("QMAKE_EXTENSION_PLUGIN") +
"." + 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 ( !project->isEmpty("QMAKE_HPUX_SHLIB") ) {
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 ( !project->isEmpty("QMAKE_AIX_SHLIB") ) {
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"));
@@ -1066,45 +1312,277 @@ void UnixMakefileGenerator::init2()
project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR"));
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(
- "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS)");
+ "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJMOC) $(LIBS) $(OBJCOMP)");
}
if(project->isEmpty("QMAKE_SYMBOLIC_LINK"))
project->variables()["QMAKE_SYMBOLIC_LINK"].append("ln -sf");
if ( !project->variables()["QMAKE_APP_FLAG"].isEmpty() ) {
- project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHAPP"];
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_APP"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_APP"];
+ project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_APP"];
} else if ( project->isActiveConfig("dll") ) {
- project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"];
- project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"];
+ if( !project->isActiveConfig("plugin") || !project->isActiveConfig("plugin_no_share_shlib_cflags")) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_SHLIB"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_SHLIB"];
+ }
if ( project->isActiveConfig("plugin") ) {
+ project->variables()["QMAKE_CFLAGS"] += project->variables()["QMAKE_CFLAGS_PLUGIN"];
+ project->variables()["QMAKE_CXXFLAGS"] += project->variables()["QMAKE_CXXFLAGS_PLUGIN"];
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_PLUGIN"];
- if( !project->isActiveConfig("plugin_no_soname") )
+ if( project->isActiveConfig("plugin_with_soname") && !project->isActiveConfig("compile_libtool"))
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"];
} else {
project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SHLIB"];
- project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"];
+ if(!project->isEmpty("QMAKE_LFLAGS_COMPAT_VERSION")) {
+ if(project->isEmpty("COMPAT_VERSION"))
+ project->variables()["QMAKE_LFLAGS"] += QString(project->first("QMAKE_LFLAGS_COMPAT_VERSION") +
+ project->first("VER_MAJ") + "." +
+ project->first("VER_MIN"));
+ else
+ project->variables()["QMAKE_LFLAGS"] += QString(project->first("QMAKE_LFLAGS_COMPAT_VERSION") +
+ project->first("COMPATIBILITY_VERSION"));
+ }
+ if(!project->isEmpty("QMAKE_LFLAGS_VERSION")) {
+ project->variables()["QMAKE_LFLAGS"] += QString(project->first("QMAKE_LFLAGS_VERSION") +
+ project->first("VER_MAJ") + "." +
+ project->first("VER_MIN") + "." +
+ project->first("VER_PAT"));
+ }
+ if(!project->isActiveConfig("compile_libtool"))
+ project->variables()["QMAKE_LFLAGS"] += project->variables()["QMAKE_LFLAGS_SONAME"];
}
QString destdir = project->first("DESTDIR");
if ( !destdir.isEmpty() && !project->variables()["QMAKE_RPATH"].isEmpty() ) {
QString rpath_destdir = destdir;
if(QDir::isRelativePath(rpath_destdir)) {
QFileInfo fi(Option::fixPathToLocalOS(rpath_destdir));
if(fi.convertToAbs()) //strange, shouldn't really happen
rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE);
else
rpath_destdir = fi.filePath();
} else {
rpath_destdir = Option::fixPathToTargetOS(rpath_destdir, FALSE);
}
project->variables()["QMAKE_LFLAGS"] += project->first("QMAKE_RPATH") + rpath_destdir;
}
}
+ QStringList &quc = project->variables()["QMAKE_EXTRA_UNIX_COMPILERS"];
+ for(QStringList::Iterator 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;
+ }
+ }
+ }
+}
+
+QString
+UnixMakefileGenerator::libtoolFileName()
+{
+ QString ret = var("TARGET");
+ int slsh = ret.findRev(Option::dir_sep);
+ if(slsh != -1)
+ ret = ret.right(ret.length() - slsh);
+ int dot = ret.find('.');
+ if(dot != -1)
+ ret = ret.left(dot);
+ ret += Option::libtool_ext;
+ if(!project->isEmpty("DESTDIR"))
+ ret.prepend(var("DESTDIR"));
+ return ret;
+}
+
+void
+UnixMakefileGenerator::writeLibtoolFile()
+{
+ QString fname = libtoolFileName(), lname = fname;
+ int slsh = lname.findRev(Option::dir_sep);
+ if(slsh != -1)
+ lname = lname.right(lname.length() - slsh - 1);
+ QFile ft(fname);
+ if(!ft.open(IO_WriteOnly))
+ return;
+ project->variables()["ALL_DEPS"].append(fname);
+
+ QTextStream t(&ft);
+ t << "# " << lname << " - a libtool library file\n";
+ time_t now = time(NULL);
+ t << "# Generated by qmake/libtool (" << qmake_version() << ") (Qt "
+ << QT_VERSION_STR << ") on: " << ctime(&now) << "\n";
+
+ t << "# The name that we can dlopen(3).\n"
+ << "dlname='" << var(project->isActiveConfig("plugin") ? "TARGET" : "TARGET_x")
+ << "'\n\n";
+
+ t << "# Names of this library.\n";
+ t << "library_names='";
+ if(project->isActiveConfig("plugin")) {
+ t << var("TARGET");
+ } else {
+ if (project->isEmpty("QMAKE_HPUX_SHLIB"))
+ t << var("TARGET_x.y.z") << " ";
+ t << var("TARGET_x") << " " << var("TARGET_");
+ }
+ t << "'\n\n";
+
+ t << "# The name of the static archive.\n"
+ << "old_library='" << lname.left(lname.length()-Option::libtool_ext.length()) << ".a'\n\n";
+
+ t << "# Libraries that this one depends upon.\n";
+ QStringList libs;
+ if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
+ libs = project->variables()["QMAKE_INTERNAL_PRL_LIBS"];
+ else
+ libs << "QMAKE_LIBS"; //obvious one
+ t << "dependency_libs='";
+ for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it)
+ t << project->variables()[(*it)].join(" ") << " ";
+ t << "'\n\n";
+
+ t << "# Version information for " << lname << "\n";
+ int maj = project->first("VER_MAJ").toInt();
+ int min = project->first("VER_MIN").toInt();
+ int pat = project->first("VER_PAT").toInt();
+ t << "current=" << (10*maj + min) << "\n" // best I can think of
+ << "age=0\n"
+ << "revision=" << pat << "\n\n";
+
+ t << "# Is this an already installed library.\n"
+ "installed=yes\n\n"; // ###
+
+ t << "# Files to dlopen/dlpreopen.\n"
+ "dlopen=''\n"
+ "dlpreopen=''\n\n";
+
+ QString install_dir = project->first("target.path");
+ if(install_dir.isEmpty())
+ install_dir = project->first("DESTDIR");
+ t << "# Directory that this library needs to be installed in:\n"
+ "libdir='" << Option::fixPathToTargetOS(install_dir, FALSE) << "'\n";
+}
+
+QString
+UnixMakefileGenerator::pkgConfigFileName()
+{
+ QString ret = var("TARGET");
+ int slsh = ret.findRev(Option::dir_sep);
+ if(slsh != -1)
+ ret = ret.right(ret.length() - slsh);
+ if(ret.startsWith("lib"))
+ ret = ret.mid(3);
+ int dot = ret.find('.');
+ if(dot != -1)
+ ret = ret.left(dot);
+ ret += Option::pkgcfg_ext;
+ if(!project->isEmpty("DESTDIR")) {
+ ret.prepend(var("DESTDIR"));
+ ret = Option::fixPathToLocalOS(fileFixify(ret,QDir::currentDirPath(), Option::output_dir));
+ }
+ return ret;
+}
+
+QString
+UnixMakefileGenerator::pkgConfigPrefix() const
+{
+ if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX"))
+ return project->first("QMAKE_PKGCONFIG_PREFIX");
+ return qInstallPath();
+}
+
+QString
+UnixMakefileGenerator::pkgConfigFixPath(QString path) const
+{
+ QString prefix = pkgConfigPrefix();
+ if(path.startsWith(prefix))
+ path = path.replace(prefix, "${prefix}");
+ return path;
+}
+
+void
+UnixMakefileGenerator::writePkgConfigFile() // ### does make sense only for libqt so far
+{
+ QString fname = pkgConfigFileName(), lname = fname;
+ int slsh = lname.findRev(Option::dir_sep);
+ if(slsh != -1)
+ lname = lname.right(lname.length() - slsh - 1);
+ QFile ft(fname);
+ if(!ft.open(IO_WriteOnly))
+ return;
+ project->variables()["ALL_DEPS"].append(fname);
+ QTextStream t(&ft);
+
+ QString prefix = pkgConfigPrefix();
+ QString libDir = project->first("QMAKE_PKGCONFIG_LIBDIR");
+ if(libDir.isEmpty())
+ libDir = prefix + "/lib";
+ QString includeDir = project->first("QMAKE_PKGCONFIG_INCDIR");
+ if(includeDir.isEmpty())
+ includeDir = prefix + "/include";
+
+ t << "prefix=" << prefix << endl;
+ t << "exec_prefix=${prefix}\n"
+ << "libdir=" << pkgConfigFixPath(libDir) << "\n"
+ << "includedir=" << pkgConfigFixPath(includeDir) << endl;
+ // non-standard entry. Provides useful info normally only
+ // contained in the internal .qmake.cache file
+ t << varGlue("CONFIG", "qt_config=", " ", "") << endl << endl;
+
+ t << "Name: Qt" << endl;
+ QString desc = project->first("QMAKE_PKGCONFIG_DESCRIPTION");
+ if(desc.isEmpty()) {
+ desc = project->first("TARGET").lower();
+ desc.replace(0, 1, desc[0].upper());
+ if(project->first("TEMPLATE") == "lib") {
+ if(project->isActiveConfig("plugin"))
+ desc += " Plugin";
+ else
+ desc += " Library";
+ } else if(project->first("TEMPLATE") == "app") {
+ desc += " Application";
+ }
+ }
+ t << "Description: " << desc << endl;
+ t << "Version: " << project->first("VERSION") << endl;
+
+ // libs
+ QStringList libs;
+ if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
+ libs = project->variables()["QMAKE_INTERNAL_PRL_LIBS"];
+ else
+ libs << "QMAKE_LIBS"; //obvious one
+ if(project->isActiveConfig("thread"))
+ libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
+ t << "Libs: -L${libdir} -l" << lname.left(lname.length()-Option::libtool_ext.length()) << " ";
+ for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it)
+ t << project->variables()[(*it)].join(" ") << " ";
+ t << endl;
+
+ // flags
+ // ### too many
+ t << "Cflags: "
+ // << var("QMAKE_CXXFLAGS") << " "
+ << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
+ << project->variables()["PRL_EXPORT_CXXFLAGS"].join(" ")
+ // << varGlue("DEFINES","-D"," -D"," ")
+ << " -I${includedir}";
}