summaryrefslogtreecommitdiffstats
path: root/tqtinterface/qt4/qmake/generators/unix
diff options
context:
space:
mode:
Diffstat (limited to 'tqtinterface/qt4/qmake/generators/unix')
-rw-r--r--tqtinterface/qt4/qmake/generators/unix/unixmake.cpp901
-rw-r--r--tqtinterface/qt4/qmake/generators/unix/unixmake.h89
-rw-r--r--tqtinterface/qt4/qmake/generators/unix/unixmake2.cpp1703
3 files changed, 0 insertions, 2693 deletions
diff --git a/tqtinterface/qt4/qmake/generators/unix/unixmake.cpp b/tqtinterface/qt4/qmake/generators/unix/unixmake.cpp
deleted file mode 100644
index 82d7ef6..0000000
--- a/tqtinterface/qt4/qmake/generators/unix/unixmake.cpp
+++ /dev/null
@@ -1,901 +0,0 @@
-/****************************************************************************
-**
-** Implementation of UnixMakefileGenerator class.
-**
-** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
-**
-** This file is part of qmake.
-**
-** This file may be used under the terms of the GNU General
-** Public License versions 2.0 or 3.0 as published by the Free
-** Software Foundation and appearing in the files LICENSE.GPL2
-** and LICENSE.GPL3 included in the packaging of this file.
-** Alternatively you may (at your option) use any later version
-** of the GNU General Public License if such license has been
-** publicly approved by Trolltech ASA (or its successors, if any)
-** and the KDE Free TQt Foundation.
-**
-** Please review the following information to ensure GNU General
-** Public Licensing requirements will be met:
-** http://trolltech.com/products/qt/licenses/licensing/opensource/.
-** If you are unsure which license is appropriate for your use, please
-** review the following information:
-** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
-** or contact the sales department at sales@trolltech.com.
-**
-** This file may be used under the terms of the Q Public License as
-** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
-** included in the packaging of this file. Licensees holding valid TQt
-** Commercial licenses may use this file in accordance with the TQt
-** Commercial License Agreement provided with the Software.
-**
-** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
-** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
-** herein.
-**
-**********************************************************************/
-
-#include "unixmake.h"
-#include "option.h"
-#include <tqregexp.h>
-#include <tqfile.h>
-#include <tqdict.h>
-#include <tqdir.h>
-#include <time.h>
-
-
-void
-UnixMakefileGenerator::init()
-{
- if(init_flag)
- return;
- init_flag = TRUE;
-
- if(!project->isEmpty("TQMAKE_FAILED_RETQUIREMENTS")) /* no point */
- return;
-
- TQStringList &configs = project->variables()["CONFIG"];
- /* this should probably not be here, but I'm using it to wrap the .t files */
- if(project->first("TEMPLATE") == "app")
- project->variables()["TQMAKE_APP_FLAG"].append("1");
- else if(project->first("TEMPLATE") == "lib")
- project->variables()["TQMAKE_LIB_FLAG"].append("1");
- else if(project->first("TEMPLATE") == "subdirs") {
- MakefileGenerator::init();
- if(project->isEmpty("MAKEFILE"))
- project->variables()["MAKEFILE"].append("Makefile");
- if(project->isEmpty("TQMAKE"))
- project->variables()["TQMAKE"].append("qmake");
- if(project->variables()["TQMAKE_INTERNAL_TQMAKE_DEPS"].findIndex("qmake_all") == -1)
- project->variables()["TQMAKE_INTERNAL_TQMAKE_DEPS"].append("qmake_all");
- return; /* subdirs is done */
- }
-
- if( project->isEmpty("TQMAKE_EXTENSION_SHLIB") ) {
- if ( project->isEmpty("TQMAKE_CYGWIN_SHLIB") ) {
- project->variables()["TQMAKE_EXTENSION_SHLIB"].append( "so" );
- } else {
- project->variables()["TQMAKE_EXTENSION_SHLIB"].append( "dll" );
- }
- }
- if( project->isEmpty("TQMAKE_CFLAGS_PRECOMPILE"))
- project->variables()["TQMAKE_CFLAGS_PRECOMPILE"].append("-x c-header -c");
- if( project->isEmpty("TQMAKE_CXXFLAGS_PRECOMPILE"))
- project->variables()["TQMAKE_CXXFLAGS_PRECOMPILE"].append("-x c++-header -c");
- if( project->isEmpty("TQMAKE_CFLAGS_USE_PRECOMPILE"))
- project->variables()["TQMAKE_CFLAGS_USE_PRECOMPILE"].append("-include");
- if( project->isEmpty("TQMAKE_EXTENSION_PLUGIN") )
- project->variables()["TQMAKE_EXTENSION_PLUGIN"].append(project->first("TQMAKE_EXTENSION_SHLIB"));
- if( project->isEmpty("TQMAKE_COPY_FILE") )
- project->variables()["TQMAKE_COPY_FILE"].append( "$(COPY)" );
- if( project->isEmpty("TQMAKE_COPY_DIR") )
- project->variables()["TQMAKE_COPY_DIR"].append( "$(COPY) -R" );
- if( project->isEmpty("TQMAKE_INSTALL_FILE") )
- project->variables()["TQMAKE_INSTALL_FILE"].append( "$(COPY_FILE)" );
- if( project->isEmpty("TQMAKE_INSTALL_DIR") )
- project->variables()["TQMAKE_INSTALL_DIR"].append( "$(COPY_DIR)" );
- if( project->isEmpty("TQMAKE_LIBTOOL") )
- project->variables()["TQMAKE_LIBTOOL"].append( "libtool --silent" );
- //If the TARGET looks like a path split it into DESTDIR and the resulting TARGET
- if(!project->isEmpty("TARGET")) {
- TQString targ = project->first("TARGET");
- int slsh = TQMAX(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"] = TQString(project->first("DESTDIR") + Option::dir_sep);
- project->variables()["DESTDIR"] = TQString(project->first("DESTDIR") + targ.left(slsh+1));
- project->variables()["TARGET"] = TQString(targ.mid(slsh+1));
- }
- }
-
- project->variables()["TQMAKE_ORIG_TARGET"] = project->variables()["TARGET"];
- project->variables()["TQMAKE_ORIG_DESTDIR"] = project->variables()["DESTDIR"];
-
- bool is_qt = (project->first("TARGET") == "tqt" || project->first("TARGET") == "tqte" ||
- project->first("TARGET") == "tqt-mt" || project->first("TARGET") == "tqte-mt");
- bool extern_libs = !project->isEmpty("TQMAKE_APP_FLAG") ||
- (!project->isEmpty("TQMAKE_LIB_FLAG") &&
- project->isActiveConfig("dll")) || is_qt;
- project->variables()["TQMAKE_LIBS"] += project->variables()["LIBS"];
- if ( (!project->isEmpty("TQMAKE_LIB_FLAG") && !project->isActiveConfig("staticlib") ) ||
- (project->isActiveConfig("qt") && project->isActiveConfig( "plugin" ) )) {
- if(configs.findIndex("dll") == -1) configs.append("dll");
- } else if ( !project->isEmpty("TQMAKE_APP_FLAG") || project->isActiveConfig("dll") ) {
- configs.remove("staticlib");
- }
- if ( project->isActiveConfig("warn_off") ) {
- project->variables()["TQMAKE_CFLAGS"] += project->variables()["TQMAKE_CFLAGS_WARN_OFF"];
- project->variables()["TQMAKE_CXXFLAGS"] += project->variables()["TQMAKE_CXXFLAGS_WARN_OFF"];
- } else if ( project->isActiveConfig("warn_on") ) {
- project->variables()["TQMAKE_CFLAGS"] += project->variables()["TQMAKE_CFLAGS_WARN_ON"];
- project->variables()["TQMAKE_CXXFLAGS"] += project->variables()["TQMAKE_CXXFLAGS_WARN_ON"];
- }
- if ( project->isActiveConfig("debug") ) {
- project->variables()["TQMAKE_CFLAGS"] += project->variables()["TQMAKE_CFLAGS_DEBUG"];
- project->variables()["TQMAKE_CXXFLAGS"] += project->variables()["TQMAKE_CXXFLAGS_DEBUG"];
- project->variables()["TQMAKE_LFLAGS"] += project->variables()["TQMAKE_LFLAGS_DEBUG"];
- } else {
- project->variables()["TQMAKE_CFLAGS"] += project->variables()["TQMAKE_CFLAGS_RELEASE"];
- project->variables()["TQMAKE_CXXFLAGS"] += project->variables()["TQMAKE_CXXFLAGS_RELEASE"];
- project->variables()["TQMAKE_LFLAGS"] += project->variables()["TQMAKE_LFLAGS_RELEASE"];
- }
- if(!project->isEmpty("TQMAKE_INCREMENTAL"))
- project->variables()["TQMAKE_LFLAGS"] += project->variables()["TQMAKE_LFLAGS_INCREMENTAL"];
- else if(!project->isEmpty("TQMAKE_LFLAGS_PREBIND") &&
- !project->variables()["TQMAKE_LIB_FLAG"].isEmpty() &&
- project->isActiveConfig("dll"))
- project->variables()["TQMAKE_LFLAGS"] += project->variables()["TQMAKE_LFLAGS_PREBIND"];
- if(!project->isEmpty("TQMAKE_INCDIR"))
- project->variables()["INCLUDEPATH"] += project->variables()["TQMAKE_INCDIR"];
- if(!project->isEmpty("TQMAKE_LIBDIR")) {
- if ( !project->isEmpty("TQMAKE_RPATH") )
- project->variables()["TQMAKE_LFLAGS"] += varGlue("TQMAKE_LIBDIR", " " + var("TQMAKE_RPATH"),
- " " + var("TQMAKE_RPATH"), "");
- project->variables()["TQMAKE_LIBDIR_FLAGS"] += varGlue( "TQMAKE_LIBDIR", "-L", " -L", "" );
- }
- if ( project->isActiveConfig("qtopia") ) {
- if(configs.findIndex("qtopialib") == -1)
- configs.append("qtopialib");
- if(configs.findIndex("qtopiainc") == -1)
- configs.append("qtopiainc");
- }
- if ( project->isActiveConfig("qtopiainc") )
- project->variables()["INCLUDEPATH"] += project->variables()["TQMAKE_INCDIR_TQTOPIA"];
- if ( project->isActiveConfig("qtopialib") ) {
- if(!project->isEmpty("TQMAKE_LIBDIR_TQTOPIA"))
- project->variables()["TQMAKE_LIBDIR_FLAGS"] += varGlue("TQMAKE_LIBDIR_TQTOPIA", "-L", " -L", "");
- project->variables()["TQMAKE_LIBS"] += project->variables()["TQMAKE_LIBS_TQTOPIA"];
- }
- if ( project->isActiveConfig("qt") ) {
- if ( project->isActiveConfig("accessibility" ) )
- project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("TQT_ACCESSIBILITY_SUPPORT");
- if ( project->isActiveConfig("tablet") )
- project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("TQT_TABLET_SUPPORT");
- if(configs.findIndex("tqmoc")) configs.append("tqmoc");
- project->variables()["INCLUDEPATH"] += project->variables()["TQMAKE_INCDIR_QT"];
- if ( !project->isActiveConfig("debug") )
- project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("TQT_NO_DEBUG");
- if ( !is_qt ) {
- if ( !project->isEmpty("TQMAKE_RPATH") ) {
- if ( !project->isEmpty("TQMAKE_RTLDIR_QT") )
- project->variables()["TQMAKE_LFLAGS"] += varGlue("TQMAKE_RTLDIR_QT", " " + var("TQMAKE_RPATH"),
- " " + var("TQMAKE_RPATH"), "");
- else if ( !project->isEmpty("TQMAKE_LIBDIR_QT") )
- project->variables()["TQMAKE_LFLAGS"] += varGlue("TQMAKE_LIBDIR_QT", " " + var("TQMAKE_RPATH"),
- " " + var("TQMAKE_RPATH"), "");
- }
- if ( !project->isEmpty("TQMAKE_LIBDIR_QT") )
- project->variables()["TQMAKE_LIBDIR_FLAGS"] += varGlue("TQMAKE_LIBDIR_QT", "-L", " -L", "");
- if ( project->isActiveConfig("thread") && !project->isEmpty("TQMAKE_LIBS_TQT_THREAD") )
- project->variables()["TQMAKE_LIBS"] += project->variables()["TQMAKE_LIBS_TQT_THREAD"];
- else
- project->variables()["TQMAKE_LIBS"] += project->variables()["TQMAKE_LIBS_QT"];
- }
- }
- if ( project->isActiveConfig("opengl") && !project->isActiveConfig("dlopen_opengl")) {
- project->variables()["INCLUDEPATH"] += project->variables()["TQMAKE_INCDIR_OPENGL"];
- if(!project->isEmpty("TQMAKE_LIBDIR_OPENGL"))
- project->variables()["TQMAKE_LIBDIR_FLAGS"] += varGlue("TQMAKE_LIBDIR_OPENGL", "-L", " -L", "");
- if ( is_qt )
- project->variables()["TQMAKE_LIBS"] += project->variables()["TQMAKE_LIBS_OPENGL_QT"];
- else
- project->variables()["TQMAKE_LIBS"] += project->variables()["TQMAKE_LIBS_OPENGL"];
- }
- 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()["TQMAKE_INCDIR_X11"];
- if ( project->isActiveConfig("x11lib") ) {
- if(!project->isEmpty("TQMAKE_LIBDIR_X11"))
- project->variables()["TQMAKE_LIBDIR_FLAGS"] += varGlue("TQMAKE_LIBDIR_X11", "-L", " -L", "");
- project->variables()["TQMAKE_LIBS"] += project->variables()["TQMAKE_LIBS_X11"];
- }
- if ( project->isActiveConfig("x11sm") )
- project->variables()["TQMAKE_LIBS"] += project->variables()["TQMAKE_LIBS_X11SM"];
- if ( project->isActiveConfig("dylib") )
- project->variables()["TQMAKE_LIBS"] += project->variables()["TQMAKE_LIBS_DYNLOAD"];
- if ( project->isActiveConfig("thread") ) {
- if(project->isActiveConfig("qt"))
- project->variables()[is_qt ? "PRL_EXPORT_DEFINES" : "DEFINES"].append("TQT_THREAD_SUPPORT");
- if ( !project->isEmpty("TQMAKE_CFLAGS_THREAD")) {
- project->variables()["TQMAKE_CFLAGS"] += project->variables()["TQMAKE_CFLAGS_THREAD"];
- project->variables()["PRL_EXPORT_CFLAGS"] += project->variables()["TQMAKE_CFLAGS_THREAD"];
- }
- if( !project->isEmpty("TQMAKE_CXXFLAGS_THREAD")) {
- project->variables()["TQMAKE_CXXFLAGS"] += project->variables()["TQMAKE_CXXFLAGS_THREAD"];
- project->variables()["PRL_EXPORT_CXXFLAGS"] += project->variables()["TQMAKE_CXXFLAGS_THREAD"];
- }
- project->variables()["INCLUDEPATH"] += project->variables()["TQMAKE_INCDIR_THREAD"];
- project->variables()["TQMAKE_LIBS"] += project->variables()["TQMAKE_LIBS_THREAD"];
- if(!project->isEmpty("TQMAKE_LFLAGS_THREAD"))
- project->variables()["TQMAKE_LFLAGS"] += project->variables()["TQMAKE_LFLAGS_THREAD"];
- }
- if ( project->isActiveConfig("tqmoc") )
- setMocAware(TRUE);
- TQString compile_flag = var("TQMAKE_COMPILE_FLAG");
- if(compile_flag.isEmpty())
- compile_flag = "-c";
- if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) {
- TQString prefix_flags = project->first("TQMAKE_CFLAGS_PREFIX_INCLUDE");
- if(prefix_flags.isEmpty())
- prefix_flags = "-include";
- compile_flag += " " + prefix_flags + " " + project->first("TQMAKE_ORIG_TARGET");
- }
- if(!project->isEmpty("ALLTQMOC_HEADER")) {
- initOutPaths(); // Need to fix outdirs since we do this before init() (because we could add to SOURCES et al)
- TQString alltqmoc = fileFixify(project->first("TQMOC_DIR") + "/alltqmoc.cpp", TQDir::currentDirPath(), Option::output_dir);
- project->variables()["SOURCES"].prepend(alltqmoc);
- project->variables()["HEADERS_ORIG"] = project->variables()["HEADERS"];
- project->variables()["HEADERS"].clear();
- }
- if ( project->isEmpty("TQMAKE_RUN_CC") )
- project->variables()["TQMAKE_RUN_CC"].append("$(CC) " + compile_flag + " $(CFLAGS) $(INCPATH) -o $obj $src");
- if ( project->isEmpty("TQMAKE_RUN_CC_IMP") )
- project->variables()["TQMAKE_RUN_CC_IMP"].append("$(CC) " + compile_flag + " $(CFLAGS) $(INCPATH) -o $@ $<");
- if ( project->isEmpty("TQMAKE_RUN_CXX") )
- project->variables()["TQMAKE_RUN_CXX"].append("$(CXX) " + compile_flag + " $(CXXFLAGS) $(INCPATH) -o $obj $src");
- if ( project->isEmpty("TQMAKE_RUN_CXX_IMP") )
- project->variables()["TQMAKE_RUN_CXX_IMP"].append("$(CXX) " + compile_flag + " $(CXXFLAGS) $(INCPATH) -o $@ $<");
- project->variables()["TQMAKE_FILETAGS"] += TQStringList::split("HEADERS SOURCES TARGET DESTDIR", " ");
- if( project->isActiveConfig("GNUmake") && !project->isEmpty("TQMAKE_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("TQMAKE_APP_FLAG")) {
- if(project->isEmpty("DESTDIR"))
- project->values("DESTDIR").append("");
- project->variables()["DESTDIR"].first() += project->variables()["TARGET"].first() +
- ".app/Contents/MacOS/";
- project->variables()["TQMAKE_PKGINFO"].append(project->first("DESTDIR") + "../PkgInfo");
- project->variables()["ALL_DEPS"] += project->first("TQMAKE_PKGINFO");
-
- TQString plist = fileFixify(project->first("TQMAKE_INFO_PLIST"));
- if(plist.isEmpty())
- plist = specdir() + TQDir::separator() + "Info.plist." + project->first("TEMPLATE");
- if(TQFile::exists(Option::fixPathToLocalOS(plist))) {
- if(project->isEmpty("TQMAKE_INFO_PLIST"))
- project->variables()["TQMAKE_INFO_PLIST"].append(plist);
- project->variables()["TQMAKE_INFO_PLIST_OUT"].append(project->first("DESTDIR") +
- "../Info.plist");
- project->variables()["ALL_DEPS"] += project->first("TQMAKE_INFO_PLIST_OUT");
- if(!project->isEmpty("RC_FILE"))
- project->variables()["ALL_DEPS"] += project->first("DESTDIR") +
- "../Resources/application.icns";
- }
- }
- }
-
- if(!project->isEmpty("TQMAKE_INTERNAL_INCLUDED_FILES"))
- project->variables()["DISTFILES"] += project->variables()["TQMAKE_INTERNAL_INCLUDED_FILES"];
- project->variables()["DISTFILES"] += Option::mkfile::project_files;
-
- init2();
- project->variables()["TQMAKE_INTERNAL_PRL_LIBS"] << "TQMAKE_LIBDIR_FLAGS" << "TQMAKE_LIBS";
- if(!project->isEmpty("TQMAKE_MAX_FILES_PER_AR")) {
- bool ok;
- int max_files = project->first("TQMAKE_MAX_FILES_PER_AR").toInt(&ok);
- TQStringList ar_sublibs, objs = project->variables()["OBJECTS"] + project->variables()["OBJTQMOC"];
- if(ok && max_files > 5 && max_files < (int)objs.count()) {
- int obj_cnt = 0, lib_cnt = 0;
- TQString lib;
- for(TQStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) {
- if((++obj_cnt) >= max_files) {
- if(lib_cnt) {
- lib.sprintf("lib%s-tmp%d.a", project->first("TQMAKE_ORIG_TARGET").latin1(), lib_cnt);
- ar_sublibs << lib;
- obj_cnt = 0;
- }
- lib_cnt++;
- }
- }
- }
- if(!ar_sublibs.isEmpty()) {
- project->variables()["TQMAKE_AR_SUBLIBS"] = ar_sublibs;
- project->variables()["TQMAKE_INTERNAL_PRL_LIBS"] << "TQMAKE_AR_SUBLIBS";
- }
- }
-
- if(project->isActiveConfig("compile_libtool")) {
- const TQString libtoolify[] = { "TQMAKE_RUN_CC", "TQMAKE_RUN_CC_IMP",
- "TQMAKE_RUN_CXX", "TQMAKE_RUN_CXX_IMP",
- "TQMAKE_LINK_THREAD", "TQMAKE_LINK", "TQMAKE_AR_CMD", "TQMAKE_LINK_SHLIB_CMD",
- TQString::null };
- for(int i = 0; !libtoolify[i].isNull(); i++) {
- TQStringList &l = project->variables()[libtoolify[i]];
- if(!l.isEmpty()) {
- TQString libtool_flags, comp_flags;
- if(libtoolify[i].startsWith("TQMAKE_LINK") || libtoolify[i] == "TQMAKE_AR_CMD") {
- libtool_flags += " --mode=link";
- if(project->isActiveConfig("staticlib")) {
- libtool_flags += " -static";
- } else {
- if(!project->isEmpty("TQMAKE_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 " + TQString::number(10*maj + min) +
- ":" + TQString::number(pat) + ":0";
- if(libtoolify[i] != "TQMAKE_AR_CMD") {
- TQString rpath = Option::output_dir;
- if(!project->isEmpty("DESTDIR")) {
- rpath = project->first("DESTDIR");
- if(TQDir::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;
- }
- }
- }
-}
-
-TQStringList
-UnixMakefileGenerator::combineSetLFlags(const TQStringList &list1, const TQStringList &list2)
-{
- if(project->isActiveConfig("no_smart_library_merge"))
- return list1 + list2;
-
- TQStringList ret;
- for(int i = 0; i < 2; i++) {
- const TQStringList *lst = i ? &list2 : &list1;
- for(TQStringList::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) {
- TQStringList::Iterator idx = ret.find((*it));
- if(idx == ret.end())
- break;
- ret.remove(idx);
- }
- ret.append((*it));
- } else if(project->isActiveConfig("macx") && (*it).startsWith("-framework")) {
- int as_one = TRUE;
- TQString 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(TQStringList::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;
- }
- }
- }
- for(int i = 0; i < found; i++)
- outit = ret.remove(outit);
- }
- }
- if(as_one) {
- ret.append("-framework " + framework_in);
- } else {
- ret.append("-framework");
- ret.append(framework_in);
- }
- }
- } else {
-#if 1
- while(1) {
- TQStringList::Iterator idx = ret.find((*it));
- if(idx == ret.end())
- break;
- ret.remove(idx);
- }
-#endif
- ret.append((*it));
- }
- } else /*if(TQFile::exists((*it)))*/ {
- while(1) {
- TQStringList::Iterator idx = ret.find((*it));
- if(idx == ret.end())
- break;
- ret.remove(idx);
- }
- ret.append((*it));
- }
- }
- }
- return ret;
-}
-
-void
-UnixMakefileGenerator::processPrlVariable(const TQString &var, const TQStringList &l)
-{
- if(var == "TQMAKE_PRL_LIBS")
- project->variables()["TQMAKE_CURRENT_PRL_LIBS"] = combineSetLFlags(project->variables()["TQMAKE_CURRENT_PRL_LIBS"] +
- project->variables()["TQMAKE_LIBS"], l);
- else
- MakefileGenerator::processPrlVariable(var, l);
-}
-
-TQString
-UnixMakefileGenerator::findDependency(const TQString &dep)
-{
- TQStringList::Iterator it;
- {
- TQStringList &qut = project->variables()["TQMAKE_EXTRA_UNIX_TARGETS"];
- for(it = qut.begin(); it != qut.end(); ++it) {
- TQString targ = var((*it) + ".target");
- if(targ.isEmpty())
- targ = (*it);
- if(targ.endsWith(dep))
- return targ;
- }
- }
- {
- TQStringList &quc = project->variables()["TQMAKE_EXTRA_UNIX_COMPILERS"];
- for(it = quc.begin(); it != quc.end(); ++it) {
- TQString tmp_out = project->variables()[(*it) + ".output"].first();
- TQString tmp_cmd = project->variables()[(*it) + ".commands"].join(" ");
- if(tmp_out.isEmpty() || tmp_cmd.isEmpty())
- continue;
- TQStringList &tmp = project->variables()[(*it) + ".input"];
- for(TQStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
- TQStringList &inputs = project->variables()[(*it2)];
- for(TQStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
- TQString out = tmp_out;
- TQFileInfo fi(Option::fixPathToLocalOS((*input)));
- out.replace("${TQMAKE_FILE_BASE}", fi.baseName());
- out.replace("${TQMAKE_FILE_NAME}", fi.filePath());
- if(out.endsWith(dep))
- return out;
- }
- }
- }
- }
- return MakefileGenerator::findDependency(dep);
-}
-
-TQStringList
-&UnixMakefileGenerator::findDependencies(const TQString &file)
-{
- TQStringList &ret = MakefileGenerator::findDependencies(file);
- // Note: The TQMAKE_IMAGE_COLLECTION file have all images
- // as dependency, so don't add precompiled header then
- if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")
- && file != project->first("TQMAKE_IMAGE_COLLECTION")) {
- TQString header_prefix = project->first("TQMAKE_ORIG_TARGET") + ".gch" + Option::dir_sep;
- header_prefix += project->first("TQMAKE_PRECOMP_PREFIX");
- if(file.endsWith(".c")) {
- TQString precomp_h = header_prefix + "c";
- if(!ret.contains(precomp_h))
- ret += precomp_h;
- } else {
- for(TQStringList::Iterator it = Option::cpp_ext.begin(); it != Option::cpp_ext.end(); ++it) {
- if(file.endsWith(*it)) {
- TQString precomp_h = header_prefix + "c++";
- if(!ret.contains(precomp_h))
- ret += precomp_h;
- break;
- }
- }
- }
- }
- return ret;
-}
-
-bool
-UnixMakefileGenerator::findLibraries()
-{
- TQPtrList<MakefileDependDir> libdirs;
- libdirs.setAutoDelete(TRUE);
- const TQString lflags[] = { "TQMAKE_LIBDIR_FLAGS", "TQMAKE_LIBS", TQString::null };
- for(int i = 0; !lflags[i].isNull(); i++) {
- TQStringList &l = project->variables()[lflags[i]];
- for(TQStringList::Iterator it = l.begin(); it != l.end(); ++it) {
- TQString stub, dir, extn, opt = (*it).stripWhiteSpace();
- if(opt.startsWith("-")) {
- if(opt.startsWith("-L")) {
- TQString r = opt.right(opt.length() - 2), l = r;
- fixEnvVariables(l);
- libdirs.append(new MakefileDependDir(r.replace("\"",""),
- l.replace("\"","")));
- } else if(opt.startsWith("-l")) {
- stub = opt.mid(2);
- } else if(project->isActiveConfig("macx") && opt.startsWith("-framework")) {
- if(opt.length() > 11) {
- opt = opt.mid(11);
- } else {
- ++it;
- opt = (*it);
- }
- extn = "";
- dir = "/System/Library/Frameworks/" + opt + ".framework/";
- stub = opt;
- }
- } else {
- extn = dir = "";
- stub = opt;
- int slsh = opt.findRev(Option::dir_sep);
- if(slsh != -1) {
- dir = opt.left(slsh);
- stub = opt.mid(slsh+1);
- }
- TQRegExp stub_reg("^.*lib(" + stub + "[^./=]*)\\.(.*)$");
- if(stub_reg.exactMatch(stub)) {
- stub = stub_reg.cap(1);
- extn = stub_reg.cap(2);
- }
- }
- if(!stub.isEmpty()) {
- const TQString modifs[] = { "", "-mt", TQString::null };
- for(int modif = 0; !modifs[modif].isNull(); modif++) {
- bool found = FALSE;
- TQStringList extens;
- if(!extn.isNull())
- extens << extn;
- else
- extens << project->variables()["TQMAKE_EXTENSION_SHLIB"].first() << "a";
- for(TQStringList::Iterator extit = extens.begin(); extit != extens.end(); ++extit) {
- if(dir.isNull()) {
- TQString lib_stub;
- for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
- if(TQFile::exists(mdd->local_dir + Option::dir_sep + "lib" + stub +
- modifs[modif] + "." + (*extit))) {
- lib_stub = stub + modifs[modif];
- break;
- }
- }
- if(!lib_stub.isNull()) {
- (*it) = "-l" + lib_stub;
- found = TRUE;
- break;
- }
- } else {
- if(TQFile::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(TQFile::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;
-}
-
-TQString linkLib(const TQString &file, const TQString &libName) {
- TQString ret;
- TQRegExp reg("^.*lib(" + libName + "[^./=]*).*$");
- if(reg.exactMatch(file))
- ret = "-l" + reg.cap(1);
- return ret;
-}
-
-void
-UnixMakefileGenerator::processPrlFiles()
-{
- TQDict<void> processed;
- TQPtrList<MakefileDependDir> libdirs;
- libdirs.setAutoDelete(TRUE);
- const TQString lflags[] = { "TQMAKE_LIBDIR_FLAGS", "TQMAKE_LIBS", TQString::null };
- for(int i = 0; !lflags[i].isNull(); i++) {
- for(bool ret = FALSE; TRUE; ret = FALSE) {
- TQStringList l_out;
- TQStringList &l = project->variables()[lflags[i]];
- for(TQStringList::Iterator it = l.begin(); it != l.end(); ++it) {
- project->variables()["TQMAKE_CURRENT_PRL_LIBS"].clear();
- TQString opt = (*it).stripWhiteSpace();
- if(opt.startsWith("-")) {
- if(opt.startsWith("-L")) {
- TQString 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]) {
- TQString lib = opt.right(opt.length() - 2);
- for(MakefileDependDir *mdd = libdirs.first(); mdd; mdd = libdirs.next() ) {
- if(!project->isActiveConfig("compile_libtool")) { //give them the .libs..
- TQString la = mdd->local_dir + Option::dir_sep + "lib" + lib + Option::libtool_ext;
- if(TQFile::exists(la) && TQFile::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"));
- }
- }
-
- TQString 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);
- 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);
- }
- TQString prl = "/System/Library/Frameworks/" + opt +
- ".framework/" + opt;
- if(processPrlFile(prl))
- ret = TRUE;
- l_out.append("-framework");
- }
- if(!opt.isEmpty())
- l_out.append(opt);
- l_out = combineSetLFlags(l_out, project->variables()["TQMAKE_CURRENT_PRL_LIBS"]);
- } else {
- TQString 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 = combineSetLFlags(l_out, project->variables()["TQMAKE_CURRENT_PRL_LIBS"]);
- }
- }
- if(ret && l != l_out)
- l = l_out;
- else
- break;
- }
- }
-}
-
-TQString
-UnixMakefileGenerator::defaultInstall(const TQString &t)
-{
- if(t != "target" || project->first("TEMPLATE") == "subdirs")
- return TQString();
-
- bool resource = FALSE;
- const TQString root = "$(INSTALL_ROOT)";
- TQStringList &uninst = project->variables()[t + ".uninstall"];
- TQString ret, destdir=project->first("DESTDIR");
- TQString targetdir = Option::fixPathToTargetOS(project->first("target.path"), FALSE);
- if(!destdir.isEmpty() && destdir.right(1) != Option::dir_sep)
- destdir += Option::dir_sep;
- targetdir = fileFixify(targetdir);
- if(targetdir.right(1) != Option::dir_sep)
- targetdir += Option::dir_sep;
-
- TQStringList links;
- TQString target="$(TARGET)";
- if(project->first("TEMPLATE") == "app") {
- target = "$(TQMAKE_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->isActiveConfig("no_install_prl") &&
- !project->isEmpty("TQMAKE_INTERNAL_PRL_FILE")) {
- TQString dst_prl = project->first("TQMAKE_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 += "-$(INSTALL_FILE) \"" + project->first("TQMAKE_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")) {
- TQString src_lt = var("TQMAKE_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");
- TQString dst_lt = root + targetdir + src_lt;
- if(!project->isEmpty("DESTDIR")) {
- src_lt.prepend(var("DESTDIR"));
- src_lt = Option::fixPathToLocalOS(fileFixify(src_lt,
- TQDir::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")) {
- TQString src_pc = var("TQMAKE_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";
- TQString d = root + targetdir + "pkgconfig" + Option::dir_sep;
- TQString dst_pc = d + src_pc;
- if(!project->isEmpty("DESTDIR")) {
- src_pc.prepend(var("DESTDIR"));
- src_pc = Option::fixPathToLocalOS(fileFixify(src_pc,
- TQDir::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(1==1) { // install tmoc and tqt-replace-stream files
- TQString src_pc = "";
- TQString d = root + Option::dir_sep + "usr" + Option::dir_sep + "bin";
- TQString dst_pc = d;
- if(!project->isEmpty("DESTDIR")) {
- src_pc.prepend(var("DESTDIR"));
- src_pc = Option::fixPathToLocalOS(fileFixify(src_pc,
- TQDir::currentDirPath(), Option::output_dir));
- }
- if(!ret.isEmpty())
- ret += "\n\t";
- ret += mkdir_p_asstring(d) + "\n\t";
- ret += "-$(INSTALL_FILE) \"" + src_pc + "/tmoc" + "\" \"" + dst_pc + "/tmoc" + "\"" + "\n\t";
- ret += "chmod +x \"" + dst_pc + "/tmoc" + "\"" + "\n\t";
- ret += "-$(INSTALL_FILE) \"" + src_pc + "/tqt-replace-stream" + "\" \"" + dst_pc + "/tqt-replace-stream" + "\"" + "\n\t";
- ret += "chmod +x \"" + dst_pc + "/tqt-replace-stream" + "\"" + "\n\t";
- if(!uninst.isEmpty())
- uninst.append("\n\t");
- uninst.append("-$(DEL_FILE) \"" + dst_pc + "/tmoc" + "\"");
- uninst.append("-$(DEL_FILE) \"" + dst_pc + "/tqt-replace-stream" + "\"");
- }
- if ( project->isEmpty("TQMAKE_CYGWIN_SHLIB") ) {
- if ( !project->isActiveConfig("staticlib") && !project->isActiveConfig("plugin") ) {
- if ( project->isEmpty("TQMAKE_HPUX_SHLIB") ) {
- links << "$(TARGET0)" << "$(TARGET1)" << "$(TARGET2)";
- } else {
- links << "$(TARGET0)";
- }
- }
- }
- }
-
- if(!resource && project->isActiveConfig("compile_libtool")) {
- TQString src_targ = target;
- if(src_targ == "$(TARGET)")
- src_targ = "$(TARGETL)";
- TQString dst_dir = fileFixify(targetdir);
- if(TQDir::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 {
- TQString src_targ = target;
- if(!destdir.isEmpty())
- src_targ = Option::fixPathToTargetOS(destdir + target, FALSE);
- TQString dst_targ = root + targetdir + target;
- if(!ret.isEmpty())
- ret += "\n\t";
- if(resource)
- ret += "$(DEL_FILE) -r \"" + dst_targ + "\"" + "\n\t";
- if(!ret.isEmpty())
- ret += "\n\t";
- ret += TQString(resource ? "-$(INSTALL_DIR)" : "-$(INSTALL_FILE)") + " \"" +
- src_targ + "\" \"" + dst_targ + "\"";
- if(!project->isActiveConfig("debug") && !project->isEmpty("TQMAKE_STRIP") &&
- (project->first("TEMPLATE") != "lib" || !project->isActiveConfig("staticlib"))) {
- ret += "\n\t-" + var("TQMAKE_STRIP");
- if(project->first("TEMPLATE") == "lib" && !project->isEmpty("TQMAKE_STRIPFLAGS_LIB"))
- ret += " " + var("TQMAKE_STRIPFLAGS_LIB");
- else if(project->first("TEMPLATE") == "app" && !project->isEmpty("TQMAKE_STRIPFLAGS_APP"))
- ret += " " + var("TQMAKE_STRIPFLAGS_APP");
- if(resource)
- ret = " \"" + dst_targ + "/Contents/MacOS/$(TQMAKE_TARGET)\"";
- 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(TQStringList::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) {
- TQString link = Option::fixPathToTargetOS(destdir + (*it), FALSE);
- int lslash = link.findRev(Option::dir_sep);
- if(lslash != -1)
- link = link.right(link.length() - (lslash + 1));
- TQString 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/tqtinterface/qt4/qmake/generators/unix/unixmake.h b/tqtinterface/qt4/qmake/generators/unix/unixmake.h
deleted file mode 100644
index a3a76de..0000000
--- a/tqtinterface/qt4/qmake/generators/unix/unixmake.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/****************************************************************************
-**
-** Definition of UnixMakefileGenerator class.
-**
-** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
-**
-** This file is part of qmake.
-**
-** This file may be used under the terms of the GNU General
-** Public License versions 2.0 or 3.0 as published by the Free
-** Software Foundation and appearing in the files LICENSE.GPL2
-** and LICENSE.GPL3 included in the packaging of this file.
-** Alternatively you may (at your option) use any later version
-** of the GNU General Public License if such license has been
-** publicly approved by Trolltech ASA (or its successors, if any)
-** and the KDE Free TQt Foundation.
-**
-** Please review the following information to ensure GNU General
-** Public Licensing requirements will be met:
-** http://trolltech.com/products/qt/licenses/licensing/opensource/.
-** If you are unsure which license is appropriate for your use, please
-** review the following information:
-** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
-** or contact the sales department at sales@trolltech.com.
-**
-** This file may be used under the terms of the Q Public License as
-** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
-** included in the packaging of this file. Licensees holding valid TQt
-** Commercial licenses may use this file in accordance with the TQt
-** Commercial License Agreement provided with the Software.
-**
-** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
-** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
-** herein.
-**
-**********************************************************************/
-
-#ifndef __UNIXMAKE_H__
-#define __UNIXMAKE_H__
-
-#include "makefile.h"
-
-class UnixMakefileGenerator : public MakefileGenerator
-{
- bool init_flag, include_deps;
- bool writeMakefile(TQTextStream &);
- void writeExtraVariables(TQTextStream &);
- TQString libtoolFileName();
- void writeLibtoolFile(); // for libtool
- TQString pkgConfigPrefix() const;
- TQString pkgConfigFileName();
- TQString TMOCFileName();
- TQString TMOCFileName2();
- TQString pkgConfigFixPath(TQString) const;
- void writePkgConfigFile(); // for pkg-config
- void writeTMOCFile();
- void writeTMOCFile2();
- TQStringList combineSetLFlags(const TQStringList &list1, const TQStringList &list2);
- void writePrlFile(TQTextStream &);
-
-public:
- UnixMakefileGenerator(TQMakeProject *p);
- ~UnixMakefileGenerator();
-
-protected:
- virtual bool doPrecompiledHeaders() const { return project->isActiveConfig("precompile_header"); }
- virtual bool doDepends() const { return !include_deps && MakefileGenerator::doDepends(); }
- virtual TQString defaultInstall(const TQString &);
- virtual void processPrlVariable(const TQString &, const TQStringList &);
- virtual void processPrlFiles();
-
- virtual bool findLibraries();
- virtual TQString findDependency(const TQString &);
- virtual TQStringList &findDependencies(const TQString &);
- virtual void init();
-
- void writeMakeParts(TQTextStream &);
- void writeSubdirs(TQTextStream &, bool=TRUE);
-
-private:
- void init2();
-};
-
-inline UnixMakefileGenerator::~UnixMakefileGenerator()
-{ }
-
-
-#endif /* __UNIXMAKE_H__ */
diff --git a/tqtinterface/qt4/qmake/generators/unix/unixmake2.cpp b/tqtinterface/qt4/qmake/generators/unix/unixmake2.cpp
deleted file mode 100644
index b4a8a8b..0000000
--- a/tqtinterface/qt4/qmake/generators/unix/unixmake2.cpp
+++ /dev/null
@@ -1,1703 +0,0 @@
-/****************************************************************************
-**
-** Implementation of UnixMakefileGenerator class.
-**
-** Copyright (C) 2010 Timothy Pearson and (C) 1992-2008 Trolltech ASA.
-**
-** This file is part of qmake.
-**
-** This file may be used under the terms of the GNU General
-** Public License versions 2.0 or 3.0 as published by the Free
-** Software Foundation and appearing in the files LICENSE.GPL2
-** and LICENSE.GPL3 included in the packaging of this file.
-** Alternatively you may (at your option) use any later version
-** of the GNU General Public License if such license has been
-** publicly approved by Trolltech ASA (or its successors, if any)
-** and the KDE Free TQt Foundation.
-**
-** Please review the following information to ensure GNU General
-** Public Licensing requirements will be met:
-** http://trolltech.com/products/qt/licenses/licensing/opensource/.
-** If you are unsure which license is appropriate for your use, please
-** review the following information:
-** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
-** or contact the sales department at sales@trolltech.com.
-**
-** This file may be used under the terms of the Q Public License as
-** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
-** included in the packaging of this file. Licensees holding valid TQt
-** Commercial licenses may use this file in accordance with the TQt
-** Commercial License Agreement provided with the Software.
-**
-** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
-** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
-** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
-** herein.
-**
-**********************************************************************/
-
-#include "unixmake.h"
-#include "option.h"
-#include "meta.h"
-#include <tqregexp.h>
-#include <tqfile.h>
-#include <tqdir.h>
-#include <time.h>
-
-TQString mkdir_p_asstring(const TQString &dir);
-
-UnixMakefileGenerator::UnixMakefileGenerator(TQMakeProject *p) : MakefileGenerator(p), init_flag(FALSE), include_deps(FALSE)
-{
-
-}
-
-void
-UnixMakefileGenerator::writePrlFile(TQTextStream &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();
-
- // tmoc
- writeTMOCFile();
- writeTMOCFile2();
-}
-
-bool
-UnixMakefileGenerator::writeMakefile(TQTextStream &t)
-{
-
- writeHeader(t);
- if(!project->variables()["TQMAKE_FAILED_RETQUIREMENTS"].isEmpty()) {
- t << "TQMAKE = " << (project->isEmpty("TQMAKE_TQMAKE") ? TQString("qmake") : var("TQMAKE_TQMAKE")) << endl;
- { //write the extra unix targets..
- TQStringList &qut = project->variables()["TQMAKE_EXTRA_UNIX_TARGETS"];
- for(TQStringList::ConstIterator it = qut.begin(); it != qut.end(); ++it)
- t << *it << " ";
- }
- t << "all clean install distclean tqmocables uninstall uicables:" << "\n\t"
- << "@echo \"Some of the required modules ("
- << var("TQMAKE_FAILED_RETQUIREMENTS") << ") 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(TQTextStream &t)
-{
- bool first = TRUE;
- TQMap<TQString, TQStringList> &vars = project->variables();
- TQStringList &exports = project->variables()["TQMAKE_EXTRA_UNIX_VARIABLES"];
- for(TQMap<TQString, TQStringList>::Iterator it = vars.begin(); it != vars.end(); ++it) {
- for(TQStringList::Iterator exp_it = exports.begin(); exp_it != exports.end(); ++exp_it) {
- TQRegExp 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(TQTextStream &t)
-{
- TQString deps = fileFixify(Option::output.name()), target_deps, prl;
- bool do_incremental = (project->isActiveConfig("incremental") &&
- !project->variables()["TQMAKE_INCREMENTAL"].isEmpty() &&
- (!project->variables()["TQMAKE_APP_FLAG"].isEmpty() ||
- !project->isActiveConfig("staticlib"))),
- src_incremental=FALSE, tqmoc_incremental=FALSE;
-
- t << "####### Compiler, tools and options" << endl << endl;
- t << "CC = ";
- if (project->isActiveConfig("thread") &&
- ! project->variables()["TQMAKE_CC_THREAD"].isEmpty())
- t << var("TQMAKE_CC_THREAD") << endl;
- else
- t << var("TQMAKE_CC") << endl;
-
- t << "CXX = ";
- if (project->isActiveConfig("thread") &&
- ! project->variables()["TQMAKE_CXX_THREAD"].isEmpty())
- t << var("TQMAKE_CXX_THREAD") << endl;
- else
- t << var("TQMAKE_CXX") << endl;
-
- t << "LEX = " << var("TQMAKE_LEX") << endl;
- t << "YACC = " << var("TQMAKE_YACC") << endl;
- t << "CFLAGS = " << var("TQMAKE_CFLAGS") << " "
- << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
- << varGlue("DEFINES","-D"," -D","") << endl;
- t << "CXXFLAGS = " << var("TQMAKE_CXXFLAGS") << " "
- << varGlue("PRL_EXPORT_DEFINES","-D"," -D","") << " "
- << varGlue("DEFINES","-D"," -D","") << endl;
- t << "LEXFLAGS = " << var("TQMAKE_LEXFLAGS") << endl;
- t << "YACCFLAGS= " << var("TQMAKE_YACCFLAGS") << endl;
- t << "INCPATH = " << "-I" << specdir();
- if(!project->isActiveConfig("no_include_pwd")) {
- TQString pwd = fileFixify(TQDir::currentDirPath());
- if(pwd.isEmpty())
- pwd = ".";
- t << " -I" << pwd;
- }
- t << varGlue("INCLUDEPATH"," -I", " -I", "") << endl;
-
- if(!project->isActiveConfig("staticlib")) {
- t << "LINK = ";
- if (project->isActiveConfig("thread") &&
- ! project->variables()["TQMAKE_LINK_THREAD"].isEmpty())
- t << var("TQMAKE_LINK_THREAD") << endl;
- else
- t << var("TQMAKE_LINK") << endl;
-
- t << "LFLAGS = " << var("TQMAKE_LFLAGS") << endl;
- t << "LIBS = " << "$(SUBLIBS) " << var("TQMAKE_LIBDIR_FLAGS") << " " << var("TQMAKE_LIBS") << endl;
- }
-
- t << "AR = " << var("TQMAKE_AR") << endl;
- t << "RANLIB = " << var("TQMAKE_RANLIB") << endl;
- t << "TQMOC = " << var("TQMAKE_TQMOC") << endl;
- t << "UIC = " << var("TQMAKE_UIC") << endl;
- t << "TQMAKE = " << (project->isEmpty("TQMAKE_TQMAKE") ? TQString("qmake") : var("TQMAKE_TQMAKE")) << endl;
- t << "TAR = " << var("TQMAKE_TAR") << endl;
- t << "GZIP = " << var("TQMAKE_GZIP") << endl;
- if(project->isActiveConfig("compile_libtool"))
- t << "LIBTOOL = " << var("TQMAKE_LIBTOOL") << endl;
- t << "COPY = " << var("TQMAKE_COPY") << endl;
- t << "COPY_FILE= " << var("TQMAKE_COPY_FILE") << endl;
- t << "COPY_DIR = " << var("TQMAKE_COPY_DIR") << endl;
- t << "INSTALL_FILE= " << var("TQMAKE_INSTALL_FILE") << endl;
- t << "INSTALL_DIR = " << var("TQMAKE_INSTALL_DIR") << endl;
-
- t << "DEL_FILE = " << var("TQMAKE_DEL_FILE") << endl;
- t << "SYMLINK = " << var("TQMAKE_SYMBOLIC_LINK") << endl;
- t << "DEL_DIR = " << var("TQMAKE_DEL_DIR") << endl;
- t << "MOVE = " << var("TQMAKE_MOVE") << endl;
- t << "CHK_DIR_EXISTS= " << var("TQMAKE_CHK_DIR_EXISTS") << endl;
- t << "MKDIR = " << var("TQMAKE_MKDIR") << endl;
- t << endl;
-
- t << "####### Output directory" << endl << endl;
- if (! project->variables()["OBJECTS_DIR"].isEmpty())
- t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl;
- else
- t << "OBJECTS_DIR = ./" << endl;
- t << endl;
-
- /* files */
- t << "####### Files" << endl << endl;
- t << "HEADERS = " << varList("HEADERS") << endl;
- t << "SOURCES = " << varList("SOURCES") << endl;
- if(do_incremental) {
- TQStringList &objs = project->variables()["OBJECTS"], &incrs = project->variables()["TQMAKE_INCREMENTAL"], incrs_out;
- t << "OBJECTS = ";
- for(TQStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) {
- bool increment = FALSE;
- for(TQStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) {
- if((*objit).find(TQRegExp((*incrit), TRUE, TRUE)) != -1) {
- increment = TRUE;
- incrs_out.append((*objit));
- break;
- }
- }
- if(!increment)
- t << "\\\n\t\t" << (*objit);
- }
- if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done!
- t << incrs_out.join(" \\\n\t\t") << endl;
- } else if(!incrs_out.count()) {
- t << endl;
- } else {
- src_incremental = TRUE;
- t << endl;
- t << "INCREMENTAL_OBJECTS = " << incrs_out.join(" \\\n\t\t") << endl;
- }
- } else {
- t << "OBJECTS = " << varList("OBJECTS") << endl;
- }
- t << "FORMS = " << varList("FORMS") << endl;
- t << "UICDECLS = " << varList("UICDECLS") << endl;
- t << "UICIMPLS = " << varList("UICIMPLS") << endl;
- TQString srcMoc = varList("SRCTQMOC"), objMoc = varList("OBJTQMOC");
- t << "SRCTQMOC = " << srcMoc << endl;
- if(do_incremental) {
- TQStringList &objs = project->variables()["OBJTQMOC"],
- &incrs = project->variables()["TQMAKE_INCREMENTAL"], incrs_out;
- t << "OBJTQMOC = ";
- for(TQStringList::Iterator objit = objs.begin(); objit != objs.end(); ++objit) {
- bool increment = FALSE;
- for(TQStringList::Iterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) {
- if((*objit).find(TQRegExp((*incrit), TRUE, TRUE)) != -1) {
- increment = TRUE;
- incrs_out.append((*objit));
- break;
- }
- }
- if(!increment)
- t << "\\\n\t\t" << (*objit);
- }
- if(incrs_out.count() == objs.count()) { //we just switched places, no real incrementals to be done!
- t << incrs_out.join(" \\\n\t\t") << endl;
- } else if(!incrs_out.count()) {
- t << endl;
- } else {
- tqmoc_incremental = TRUE;
- t << endl;
- t << "INCREMENTAL_OBJTQMOC = " << incrs_out.join(" \\\n\t\t") << endl;
- }
- } else {
- t << "OBJTQMOC = " << objMoc << endl;
- }
- if(do_incremental && !tqmoc_incremental && !src_incremental)
- do_incremental = FALSE;
- if(!project->isEmpty("TQMAKE_EXTRA_UNIX_COMPILERS")) {
- t << "OBJCOMP = " << varList("OBJCOMP") << endl;
- target_deps += " $(OBJCOMP)";
-
- TQStringList &comps = project->variables()["TQMAKE_EXTRA_UNIX_COMPILERS"];
- for(TQStringList::Iterator compit = comps.begin(); compit != comps.end(); ++compit) {
- TQStringList &vars = project->variables()[(*compit) + ".variables"];
- for(TQStringList::Iterator varit = vars.begin(); varit != vars.end(); ++varit) {
- TQStringList vals = project->variables()[(*varit)];
- if(!vals.isEmpty())
- t << "TQMAKE_COMP_" << (*varit) << " = " << valList(vals) << endl;
- }
- }
- }
- t << "DIST = " << valList(fileFixify(project->variables()["DISTFILES"])) << endl;
- t << "TQMAKE_TARGET = " << var("TQMAKE_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()["TQMAKE_APP_FLAG"].isEmpty()) {
- t << "TARGETA = " << var("TARGETA") << endl;
- if (project->isEmpty("TQMAKE_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 includes
- TQStringList &qeui = project->variables()["TQMAKE_EXTRA_UNIX_INCLUDES"];
- TQStringList::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 " << Option::obj_ext;
- TQStringList::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) << Option::obj_ext << ":\n\t" << var("TQMAKE_RUN_CXX_IMP") << endl << endl;
- t << ".c" << Option::obj_ext << ":\n\t" << var("TQMAKE_RUN_CC_IMP") << endl << endl;
-
- if(include_deps) {
- TQString cmd=var("TQMAKE_CFLAGS_DEPS") + " ";
- cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D","");
- if(!project->isEmpty("TQMAKE_ABSOLUTE_SOURCE_PATH"))
- cmd += " -I" + project->first("TQMAKE_ABSOLUTE_SOURCE_PATH") + " ";
- cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", "");
- TQString 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;
-
- TQString src[] = { "SOURCES", "UICIMPLS", "SRCTQMOC", TQString::null };
- for(int x = 0; !src[x].isNull(); x++) {
- TQStringList &l = project->variables()[src[x]];
- for(TQStringList::Iterator it = l.begin(); it != l.end(); ++it) {
- if(!(*it).isEmpty()) {
- TQString d_file;
- if((*it).endsWith(".c")) {
- d_file = (*it).left((*it).length() - 2);
- } else {
- for(TQStringList::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";
- TQStringList deps = findDependencies((*it)).grep(TQRegExp(Option::cpp_tqmoc_ext + "$"));
- if(!deps.isEmpty())
- t << d_file << ": " << deps.join(" ") << endl;
- t << var("TQMAKE_CFLAGS_USE_PRECOMPILE") << " " << d_file << endl;
- }
- }
- }
- }
- }
-
- t << "####### Build rules" << endl << endl;
- if(!project->variables()["SUBLIBS"].isEmpty()) {
- TQString libdir = "tmp/";
- if(!project->isEmpty("SUBLIBS_DIR"))
- libdir = project->first("SUBLIBS_DIR");
- t << "SUBLIBS= ";
- TQStringList &l = project->variables()["SUBLIBS"];
- for(TQStringList::Iterator it = l.begin(); it != l.end(); ++it)
- t << libdir << "lib" << (*it) << ".a ";
- t << endl << endl;
- }
- if(project->isActiveConfig("depend_prl") && !project->isEmpty("TQMAKE_PRL_INTERNAL_FILES")) {
- TQStringList &l = project->variables()["TQMAKE_PRL_INTERNAL_FILES"];
- TQStringList::Iterator it;
- for(it = l.begin(); it != l.end(); ++it) {
- TQMakeMetaInfo libinfo;
- if(libinfo.readLib((*it)) && !libinfo.isEmpty("TQMAKE_PRL_BUILD_DIR")) {
- TQString dir;
- int slsh = (*it).findRev(Option::dir_sep);
- if(slsh != -1)
- dir = (*it).left(slsh + 1);
- TQString targ = dir + libinfo.first("TQMAKE_PRL_TARGET");
- deps += " " + targ;
- t << targ << ":" << "\n\t"
- << "@echo \"Creating '" << targ << "'\"" << "\n\t"
- << "(cd " << libinfo.first("TQMAKE_PRL_BUILD_DIR") << ";"
- << "$(MAKE) )" << endl;
- }
- }
- }
- if(!project->variables()["TQMAKE_APP_FLAG"].isEmpty()) {
- TQString destdir = project->first("DESTDIR");
- if(do_incremental) {
- //incremental target
- TQString 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));
- TQString incr_deps, incr_objs;
- if(project->first("TQMAKE_INCREMENTAL_STYLE") == "ld") {
- TQString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext;
- //actual target
- t << incr_target_dir << ": $(OBJECTS)" << "\n\t"
- << "ld -r -o "<< incr_target_dir << " $(OBJECTS)" << endl;
- //communicated below
- deps.prepend(incr_target_dir + " ");
- incr_deps = "$(UICDECLS) $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJTQMOC) $(OBJTQMOC)";
- if(!incr_objs.isEmpty())
- incr_objs += " ";
- incr_objs += incr_target_dir;
- } else {
- //actual target
- TQString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." +
- project->variables()["TQMAKE_EXTENSION_SHLIB"].first();
- TQString incr_lflags = var("TQMAKE_LFLAGS_SHLIB") + " ";
- if(project->isActiveConfig("debug"))
- incr_lflags += var("TQMAKE_LFLAGS_DEBUG");
- else
- incr_lflags += var("TQMAKE_LFLAGS_RELEASE");
- t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJTQMOC)" << "\n\t";
- if(!destdir.isEmpty())
- t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
- t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir <<
- " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJTQMOC)" << endl;
- //communicated below
- if(!destdir.isEmpty()) {
- if(!incr_objs.isEmpty())
- incr_objs += " ";
- incr_objs += "-L" + destdir;
- } else {
- if(!incr_objs.isEmpty())
- incr_objs += " ";
- incr_objs += "-L" + TQDir::currentDirPath();
- }
- if(!incr_objs.isEmpty())
- incr_objs += " ";
- incr_objs += " -l" + incr_target;
- deps.prepend(incr_target_dir + " ");
- incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJTQMOC)";
- }
- t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)"
- << endl << endl;
-
- //real target
- 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("TQMAKE_PRE_LINK"))
- t << var("TQMAKE_PRE_LINK") << "\n\t";
- t << "$(LINK) $(LFLAGS) -o $(TARGET) " << incr_deps << " " << incr_objs << " $(OBJCOMP) $(LIBS)";
- if(!project->isEmpty("TQMAKE_POST_LINK"))
- t << "\n\t" << var("TQMAKE_POST_LINK");
- t << endl << endl;
- } else {
- t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << "$(TARGET)"
- << endl << endl;
-
- t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJTQMOC) "
- << target_deps << " " << var("POST_TARGETDEPS") << "\n\t";
- if(!destdir.isEmpty())
- t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
- if(!project->isEmpty("TQMAKE_PRE_LINK"))
- t << var("TQMAKE_PRE_LINK") << "\n\t";
- t << "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJTQMOC) $(OBJCOMP) $(LIBS)";
- if(!project->isEmpty("TQMAKE_POST_LINK"))
- t << "\n\t" << var("TQMAKE_POST_LINK");
- t << endl << endl;
- }
- } else if(!project->isActiveConfig("staticlib")) {
- TQString destdir = project->first("DESTDIR"), incr_deps;
- if(do_incremental) {
- TQString s_ext = project->variables()["TQMAKE_EXTENSION_SHLIB"].first();
- TQString incr_target = TQT_TQSTRING(var("TQMAKE_ORIG_TARGET").replace(
- TQRegExp("\\." + s_ext), "")).replace(TQRegExp("^lib"), "") + "_incremental";
- if(incr_target.find(Option::dir_sep) != -1)
- incr_target = incr_target.right(incr_target.length() -
- (incr_target.findRev(Option::dir_sep) + 1));
-
- if(project->first("TQMAKE_INCREMENTAL_STYLE") == "ld") {
- TQString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext;
- //actual target
- const TQString link_deps = "$(UICDECLS) $(OBJECTS) $(OBJTQMOC)";
- t << incr_target_dir << ": " << link_deps << "\n\t"
- << "ld -r -o " << incr_target_dir << " " << link_deps << endl;
- //communicated below
- TQStringList &cmd = project->variables()["TQMAKE_LINK_SHLIB_CMD"];
- cmd.first().replace("$(OBJECTS) $(OBJTQMOC)",
- "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJTQMOC)"); //ick
- cmd.append(incr_target_dir);
- deps.prepend(incr_target_dir + " ");
- incr_deps = "$(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJTQMOC)";
- } else {
- //actual target
- TQString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." + s_ext;
- TQString incr_lflags = var("TQMAKE_LFLAGS_SHLIB") + " ";
- if(!project->isEmpty("TQMAKE_LFLAGS_INCREMENTAL"))
- incr_lflags += var("TQMAKE_LFLAGS_INCREMENTAL") + " ";
- if(project->isActiveConfig("debug"))
- incr_lflags += var("TQMAKE_LFLAGS_DEBUG");
- else
- incr_lflags += var("TQMAKE_LFLAGS_RELEASE");
- t << incr_target_dir << ": $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJTQMOC)" << "\n\t";
- if(!destdir.isEmpty())
- t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
- t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir <<
- " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJTQMOC)" << endl;
- //communicated below
- TQStringList &cmd = project->variables()["TQMAKE_LINK_SHLIB_CMD"];
- if(!destdir.isEmpty())
- cmd.append(" -L" + destdir);
- cmd.append(" -l" + incr_target);
- deps.prepend(incr_target_dir + " ");
- incr_deps = "$(UICDECLS) $(OBJECTS) $(OBJTQMOC)";
- }
-
- t << "all: " << " " << deps << " " << varGlue("ALL_DEPS",""," ","")
- << " " << var("DESTDIR_TARGET") << endl << endl;
-
- //real target
- 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) $(OBJTQMOC) $(SUBLIBS) $(OBJCOMP) " << target_deps
- << " " << var("POST_TARGETDEPS");
- }
- if(!destdir.isEmpty())
- t << "\n\t" << "test -d " << destdir << " || mkdir -p " << destdir;
- if(!project->isEmpty("TQMAKE_PRE_LINK"))
- t << "\n\t" << var("TQMAKE_PRE_LINK");
-
- if(project->isActiveConfig("compile_libtool")) {
- t << "\n\t"
- << var("TQMAKE_LINK_SHLIB_CMD");
- } else if(project->isActiveConfig("plugin")) {
- t << "\n\t"
- << "-$(DEL_FILE) $(TARGET)" << "\n\t"
- << var("TQMAKE_LINK_SHLIB_CMD");
- if(!destdir.isEmpty())
- t << "\n\t"
- << "-$(MOVE) $(TARGET) " << var("DESTDIR");
- if(!project->isEmpty("TQMAKE_POST_LINK"))
- t << "\n\t" << var("TQMAKE_POST_LINK") << "\n\t";
- t << endl << endl;
- } else if(project->isEmpty("TQMAKE_HPUX_SHLIB")) {
- t << "\n\t"
- << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)" << "\n\t"
- << var("TQMAKE_LINK_SHLIB_CMD") << "\n\t";
- t << varGlue("TQMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t"
- << varGlue("TQMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t"
- << varGlue("TQMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)");
- if(!destdir.isEmpty())
- t << "\n\t"
- << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t"
- << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
- << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET1)\n\t"
- << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET2)\n\t"
- << "-$(MOVE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2) " << var("DESTDIR");
- if(!project->isEmpty("TQMAKE_POST_LINK"))
- t << "\n\t" << var("TQMAKE_POST_LINK");
- t << endl << endl;
- } else {
- t << "\n\t"
- << "-$(DEL_FILE) $(TARGET) $(TARGET0)" << "\n\t"
- << var("TQMAKE_LINK_SHLIB_CMD") << "\n\t";
- t << varGlue("TQMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)");
- if(!destdir.isEmpty())
- t << "\n\t"
- << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)\n\t"
- << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET0)\n\t"
- << "-$(MOVE) $(TARGET) $(TARGET0) " << var("DESTDIR");
- if(!project->isEmpty("TQMAKE_POST_LINK"))
- t << "\n\t" << var("TQMAKE_POST_LINK");
- t << endl << endl;
- }
- t << endl << endl;
-
- if (! project->isActiveConfig("plugin")) {
- t << "staticlib: $(TARGETA)" << endl << endl;
- t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(UICDECLS) $(OBJECTS) $(OBJTQMOC) $(OBJCOMP)";
- if(do_incremental)
- t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJTQMOC)";
- t << var("POST_TARGETDEPS") << "\n\t"
- << "-$(DEL_FILE) $(TARGETA) " << "\n\t"
- << var("TQMAKE_AR_CMD");
- if(do_incremental)
- t << " $(INCREMENTAL_OBJECTS) $(INCREMENTAL_OBJTQMOC)";
- if(!project->isEmpty("TQMAKE_RANLIB"))
- t << "\n\t" << "$(RANLIB) $(TARGETA)";
- t << endl << endl;
- }
- } else {
- t << "all: " << deps << " " << varGlue("ALL_DEPS",""," "," ") << var("DESTDIR") << "$(TARGET) "
- << varGlue("TQMAKE_AR_SUBLIBS", var("DESTDIR"), " " + var("DESTDIR"), "") << "\n\n"
- << "staticlib: " << var("DESTDIR") << "$(TARGET)" << "\n\n";
- if(project->isEmpty("TQMAKE_AR_SUBLIBS")) {
- t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS")
- << " $(UICDECLS) $(OBJECTS) $(OBJTQMOC) $(OBJCOMP) " << var("POST_TARGETDEPS") << "\n\t";
- if(!project->isEmpty("DESTDIR")) {
- TQString destdir = project->first("DESTDIR");
- t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
- }
- t << "-$(DEL_FILE) $(TARGET)" << "\n\t"
- << var("TQMAKE_AR_CMD") << "\n";
- if(!project->isEmpty("TQMAKE_POST_LINK"))
- t << "\t" << var("TQMAKE_POST_LINK") << "\n";
- if(!project->isEmpty("TQMAKE_RANLIB"))
- t << "\t" << "$(RANLIB) $(TARGET)" << "\n";
- if(!project->isEmpty("DESTDIR"))
- t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << "$(TARGET)" << "\n"
- << "\t" << "-$(MOVE) $(TARGET) " << var("DESTDIR") << "\n";
- } else {
- int max_files = project->first("TQMAKE_MAX_FILES_PER_AR").toInt();
- TQStringList objs = project->variables()["OBJECTS"] + project->variables()["OBJTQMOC"] +
- project->variables()["OBJCOMP"],
- libs = project->variables()["TQMAKE_AR_SUBLIBS"];
- libs.prepend("$(TARGET)");
- for(TQStringList::Iterator libit = libs.begin(), objit = objs.begin();
- libit != libs.end(); ++libit) {
- TQStringList build;
- for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++)
- build << (*objit);
- TQString ar;
- if((*libit) == "$(TARGET)") {
- t << var("DESTDIR") << "$(TARGET): " << var("PRE_TARGETDEPS")
- << " $(UICDECLS) " << var("POST_TARGETDEPS") << valList(build) << "\n\t";
- ar = project->variables()["TQMAKE_AR_CMD"].first();
- ar = TQT_TQSTRING(ar.replace("$(OBJTQMOC)", "")).replace("$(OBJECTS)",
- build.join(" "));
- } else {
- t << (*libit) << ": " << valList(build) << "\n\t";
- ar = "$(AR) " + (*libit) + " " + build.join(" ");
- }
- if(!project->isEmpty("DESTDIR")) {
- TQString destdir = project->first("DESTDIR");
- t << "test -d " << destdir << " || mkdir -p " << destdir << "\n\t";
- }
- t << "-$(DEL_FILE) " << (*libit) << "\n\t"
- << ar << "\n";
- if(!project->isEmpty("TQMAKE_POST_LINK"))
- t << "\t" << var("TQMAKE_POST_LINK") << "\n";
- if(!project->isEmpty("TQMAKE_RANLIB"))
- t << "\t" << "$(RANLIB) " << (*libit) << "\n";
- if(!project->isEmpty("DESTDIR"))
- t << "\t" << "-$(DEL_FILE) " << var("DESTDIR") << (*libit) << "\n"
- << "\t" << "-$(MOVE) " << (*libit) << " " << var("DESTDIR") << "\n";
- }
- }
- t << endl << endl;
- }
-
- t << "tqmocables: $(SRCTQMOC)" << endl
- << "uicables: $(UICDECLS) $(UICIMPLS)" << endl << endl;
-
- if(!project->isActiveConfig("no_tqmocdepend")) {
- //this is an implicity depend on tqmoc, so it will be built if necesary, however
- //tqmoc itself shouldn't have this dependency - this is a little kludgy but it is
- //better than the alternative for now.
- TQString tqmoc = project->first("TQMAKE_TQMOC"), target = project->first("TARGET"),
- tqmoc_dir = "$(TQTDIR)/src/tqmoc";
- if(!project->isEmpty("TQMAKE_TQMOC_SRC"))
- tqmoc_dir = project->first("TQMAKE_TQMOC_SRC");
- fixEnvVariables(target);
- fixEnvVariables(tqmoc);
- if(target != tqmoc)
- t << "$(TQMOC): \n\t"
- << "( cd " << tqmoc_dir << " && $(MAKE) )" << endl << endl;
- }
-
- writeMakeQmake(t);
- if(project->isEmpty("TQMAKE_FAILED_RETQUIREMENTS") && !project->isActiveConfig("no_autoqmake")) {
- TQString 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()) {
- TQStringList files = fileFixify(Option::mkfile::project_files);
- t << meta_files << ": " << "\n\t"
- << "@$(TQMAKE) -prl " << buildArgs() << " " << files.join(" ") << endl;
- }
- }
-
- if(!project->first("TQMAKE_PKGINFO").isEmpty()) {
- TQString pkginfo = project->first("TQMAKE_PKGINFO");
- TQString 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("TQMAKE_INFO_PLIST").isEmpty()) {
- TQString info_plist = project->first("TQMAKE_INFO_PLIST"),
- info_plist_out = project->first("TQMAKE_INFO_PLIST_OUT");
- TQString 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"
- << "@sed -e \"s,@ICON@,application.icns,g\" -e \"s,@EXECUTABLE@," << var("TQMAKE_ORIG_TARGET")
- << ",g\" \"" << info_plist << "\" >\"" << info_plist_out << "\"" << endl;
- if(!project->first("RC_FILE").isEmpty()) {
- TQString dir = destdir + "../Resources/";
- t << dir << "application.icns: " << fileFixify(var("RC_FILE")) << "\n\t"
- << "@test -d " << dir << " || mkdir -p " << dir << "\n\t"
- << "@$(DEL_FILE) " << dir << "application.icns" << "\n\t"
- << "@$(COPY_FILE) " << fileFixify(var("RC_FILE"))
- << " " << dir << "application.icns" << endl;
- }
- }
-
- TQString ddir = project->isEmpty("TQMAKE_DISTDIR") ? project->first("TQMAKE_ORIG_TARGET") :
- project->first("TQMAKE_DISTDIR");
- TQString ddir_c = fileFixify((project->isEmpty("OBJECTS_DIR") ? TQString(".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")) {
- TQStringList &forms = project->variables()["FORMS"], ui_headers;
- for(TQStringList::Iterator formit = forms.begin(); formit != forms.end(); ++formit) {
- TQString ui_h = fileFixify((*formit) + Option::h_ext.first());
- if(TQFile::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("TQMAKE_ORIG_TARGET") << ".tar " << ddir << " && "
- << "$(GZIP) " << var("TQMAKE_ORIG_TARGET") << ".tar ) && "
- << "$(MOVE) `dirname " << ddir_c << "`" << Option::dir_sep << var("TQMAKE_ORIG_TARGET") << ".tar.gz . && "
- << "$(DEL_FILE) -r " << ddir_c
- << endl << endl;
-
- TQString clean_targets;
- t << "tqmocclean:" << "\n";
- if(tqmocAware()) {
- if(!objMoc.isEmpty() || !srcMoc.isEmpty() || tqmoc_incremental) {
- if(!objMoc.isEmpty())
- t << "\t-$(DEL_FILE) $(OBJTQMOC)" << '\n';
- if(!srcMoc.isEmpty())
- t << "\t-$(DEL_FILE) $(SRCTQMOC)" << '\n';
- if(tqmoc_incremental)
- t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJTQMOC)" << '\n';
- clean_targets += " tqmocclean";
- }
- t << endl;
- }
- t << "uiclean:" << "\n";
- if (!var("UICIMPLS").isEmpty() || !var("UICDECLS").isEmpty()) {
- t << "\t-$(DEL_FILE) $(UICIMPLS) $(UICDECLS)" << "\n";
- clean_targets += " uiclean";
- }
- t << endl;
-
- t << "yaccclean:" << "\n";
- if(!var("YACCSOURCES").isEmpty()) {
- TQStringList clean, &l = project->variables()["YACCSOURCES"];
- for(TQStringList::Iterator it = l.begin(); it != l.end(); ++it) {
- TQFileInfo fi((*it));
- TQString dir;
- if(fi.dirPath() != ".")
- dir = fi.dirPath() + Option::dir_sep;
- dir = fileFixify(dir, TQDir::currentDirPath(), Option::output_dir);
- if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep)
- dir += Option::dir_sep;
- clean << ( dir + fi.baseName(TRUE) + Option::yacc_mod + Option::cpp_ext.first() );
- clean << ( dir + fi.baseName(TRUE) + Option::yacc_mod + Option::h_ext.first() );
- }
- if(!clean.isEmpty()) {
- t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n";
- clean_targets += " yaccclean";
- }
- }
-
- t << "lexclean:" << "\n";
- if(!var("LEXSOURCES").isEmpty()) {
- TQStringList clean, &l = project->variables()["LEXSOURCES"];
- for(TQStringList::Iterator it = l.begin(); it != l.end(); ++it) {
- TQFileInfo fi((*it));
- TQString dir;
- if(fi.dirPath() != ".")
- dir = fi.dirPath() + Option::dir_sep;
- dir = fileFixify(dir, TQDir::currentDirPath(), Option::output_dir);
- if(!dir.isEmpty() && dir.right(Option::dir_sep.length()) != Option::dir_sep)
- dir += Option::dir_sep;
- clean << ( dir + fi.baseName(TRUE) + Option::lex_mod + Option::cpp_ext.first() );
- }
- if(!clean.isEmpty()) {
- t << "\t-$(DEL_FILE) " << clean.join(" ") << "\n";
- clean_targets += " lexclean";
- }
- }
-
- if(do_incremental) {
- t << "incrclean:" << "\n";
- if(src_incremental)
- t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n";
- if(tqmoc_incremental)
- t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJTQMOC)" << '\n';
- t << endl;
- }
-
- t << "clean:" << clean_targets << "\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")) {
- TQString header_prefix = project->first("TQMAKE_PRECOMP_PREFIX");
- TQString precomph_out_dir = project->first("TQMAKE_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("TQMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t";
- if(src_incremental)
- t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)" << "\n\t";
- t << varGlue("TQMAKE_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() ) {
- TQString libdir = "tmp/";
- if(!project->isEmpty("SUBLIBS_DIR"))
- libdir = project->first("SUBLIBS_DIR");
- TQStringList &l = project->variables()["SUBLIBS"];
- for(it = l.begin(); it != l.end(); ++it)
- t << libdir << "lib" << (*it) << ".a" << ":\n\t"
- << var(TQString("MAKELIB") + (*it)) << endl << endl;
- }
-
- TQString 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()["TQMAKE_APP_FLAG"].isEmpty() &&
- !project->isActiveConfig("plugin") && !project->isActiveConfig("compile_libtool"))
- t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) "
- << destdir << "$(TARGET2) $(TARGETA)" << "\n";
- t << endl << endl;
-
- if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER") ) {
- TQString precomph = fileFixify(project->first("PRECOMPILED_HEADER"));
- t << "###### Prefix headers" << endl;
- TQString comps[] = { "C", "CXX", TQString::null };
- for(int i = 0; !comps[i].isNull(); i++) {
- TQString flags = var("TQMAKE_" + comps[i] + "FLAGS_PRECOMPILE");
- flags += " $(" + comps[i] + "FLAGS)";
-
- TQString header_prefix = project->first("TQMAKE_PRECOMP_PREFIX");
- TQString outdir = project->first("TQMAKE_ORIG_TARGET") + ".gch" + Option::dir_sep, outfile = outdir;
- TQString 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("ALLTQMOC_HEADER")) {
- TQString outdir = project->first("TQMOC_DIR");
- TQString precomph = fileFixify(project->first("ALLTQMOC_HEADER"));
- t << "###### Combined headers" << endl << endl
- << outdir << "alltqmoc.cpp: " << precomph << " "
- << varList("HEADERS_ORIG") << "\n\t"
- << "echo '#include \"" << precomph << "\"' >" << outdir << "alltqmoc.cpp" << "\n\t"
- << "$(CXX) -E -DTQT_TQMOC_CPP -DTQT_NO_STL $(CXXFLAGS) $(INCPATH) >" << outdir << "alltqmoc.h "
- << outdir << "alltqmoc.cpp" << "\n\t"
- << "$(TQMOC) -o " << outdir << "alltqmoc.cpp " << outdir << "alltqmoc.h" << "\n\t"
- << "perl -pi -e 's{#include \"alltqmoc.h\"}{#define TQT_H_CPP\\n#include \""
- << precomph << "\"}' " << outdir << "alltqmoc.cpp" << "\n\t"
- << "$(DEL_FILE) " << outdir << "alltqmoc.h" << endl << endl;
- }
-
- // user defined targets
- TQStringList &qut = project->variables()["TQMAKE_EXTRA_UNIX_TARGETS"];
- for(it = qut.begin(); it != qut.end(); ++it) {
- TQString targ = var((*it) + ".target"),
- cmd = var((*it) + ".commands"), deps;
- if(targ.isEmpty())
- targ = (*it);
- TQStringList &deplist = project->variables()[(*it) + ".depends"];
- for(TQStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
- TQString dep = var((*dep_it) + ".target");
- if(dep.isEmpty())
- dep = (*dep_it);
- deps += " " + dep;
- }
- if(project->variables()[(*it) + ".CONFIG"].findIndex("phony") != -1)
- deps += TQString(" ") + "FORCE";
- t << targ << ":" << deps << "\n\t"
- << cmd << endl << endl;
- }
- // user defined compilers
- TQStringList &quc = project->variables()["TQMAKE_EXTRA_UNIX_COMPILERS"];
- for(it = quc.begin(); it != quc.end(); ++it) {
- TQString tmp_out = project->variables()[(*it) + ".output"].first();
- TQString tmp_cmd = project->variables()[(*it) + ".commands"].join(" ");
- TQString tmp_dep = project->variables()[(*it) + ".depends"].join(" ");
- TQStringList &vars = project->variables()[(*it) + ".variables"];
- if(tmp_out.isEmpty() || tmp_cmd.isEmpty())
- continue;
- TQStringList &tmp = project->variables()[(*it) + ".input"];
- for(TQStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
- TQStringList &inputs = project->variables()[(*it2)];
- for(TQStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
- TQFileInfo fi(Option::fixPathToLocalOS((*input)));
- TQString in = Option::fixPathToTargetOS((*input), FALSE),
- out = tmp_out, cmd = tmp_cmd, deps;
- out.replace("${TQMAKE_FILE_BASE}", fi.baseName());
- out.replace("${TQMAKE_FILE_NAME}", fi.filePath());
- cmd.replace("${TQMAKE_FILE_BASE}", fi.baseName());
- cmd.replace("${TQMAKE_FILE_OUT}", out);
- cmd.replace("${TQMAKE_FILE_NAME}", fi.filePath());
- for(TQStringList::Iterator it3 = vars.begin(); it3 != vars.end(); ++it3)
- cmd.replace("$(" + (*it3) + ")", "$(TQMAKE_COMP_" + (*it3)+")");
- if(!tmp_dep.isEmpty()) {
- char buff[256];
- TQString dep_cmd = tmp_dep;
- dep_cmd.replace("${TQMAKE_FILE_NAME}", fi.filePath());
- if(FILE *proc = TQT_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 += " " + TQCString(buff+l, (i - l) + 1);
- l = i;
- }
- }
- }
- fclose(proc);
- }
- }
- t << out << ": " << in << deps << "\n\t"
- << cmd << endl << endl;
- }
- }
- }
- t <<"FORCE:" << endl << endl;
-}
-
-struct SubDir
-{
- TQString directory, profile, target, makefile;
-};
-
-void
-UnixMakefileGenerator::writeSubdirs(TQTextStream &t, bool direct)
-{
- // blasted includes
- TQStringList &qeui = project->variables()["TQMAKE_EXTRA_UNIX_INCLUDES"];
- for(TQStringList::Iterator qeui_it = qeui.begin(); qeui_it != qeui.end(); ++qeui_it)
- t << "include " << (*qeui_it) << endl;
- writeExtraVariables(t);
-
- TQPtrList<SubDir> subdirs;
- {
- TQStringList subdirs_in = project->variables()["SUBDIRS"];
- for(TQStringList::Iterator it = subdirs_in.begin(); it != subdirs_in.end(); ++it) {
- TQString 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()) {
- TQString 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
- }
- sd->target = "sub-" + (*it);
- sd->target.replace('/', '-');
- sd->target.replace('.', '_');
- }
- }
- TQPtrListIterator<SubDir> it(subdirs);
-
- TQString 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 << "TQMAKE = " << var("TQMAKE") << endl;
- t << "DEL_FILE = " << var("TQMAKE_DEL_FILE") << endl;
- t << "CHK_DIR_EXISTS= " << var("TQMAKE_CHK_DIR_EXISTS") << endl;
- t << "MKDIR = " << var("TQMAKE_MKDIR") << endl;
- t << "INSTALL_FILE= " << var("TQMAKE_INSTALL_FILE") << endl;
- t << "INSTALL_DIR = " << var("TQMAKE_INSTALL_DIR") << endl;
- t << "SUBTARGETS = "; // subdirectory targets are sub-directory
- 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();
- TQString 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 << mkdir_p_asstring((*it)->directory) << "\n\t"
- << "cd " << (*it)->directory << " && ";
- TQString profile = fileFixify((*it)->profile, (*it)->directory, (*it)->directory);
- t << "$(TQMAKE) " << 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(); ) {
- TQString tar = it.current()->target;
- ++it;
- if (it.current())
- t << it.current()->target << ": " << tar << endl;
- }
- t << endl;
- }
-
- writeMakeQmake(t);
-
- if(project->isEmpty("SUBDIRS")) {
- t << "all qmake_all distclean uicables tqmocables install_subdirs uninstall_subdirs"
- << " uiclean tqmocclean 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
- << " && $(MAKE) -f " << (*it)->makefile << " qmake_all" << "; ) || true";
- }
- t << endl;
- t << "clean uicables tqmocables uiclean tqmocclean 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
- TQStringList &qut = project->variables()["TQMAKE_EXTRA_UNIX_TARGETS"];
- for(TQStringList::Iterator qut_it = qut.begin(); qut_it != qut.end(); ++qut_it) {
- TQString targ = var((*qut_it) + ".target"),
- cmd = var((*qut_it) + ".commands"), deps;
- if(targ.isEmpty())
- targ = (*qut_it);
- TQStringList &deplist = project->variables()[(*qut_it) + ".depends"];
- for(TQStringList::Iterator dep_it = deplist.begin(); dep_it != deplist.end(); ++dep_it) {
- TQString dep = var((*dep_it) + ".target");
- if(dep.isEmpty())
- dep = (*dep_it);
- deps += " " + dep;
- }
- if(project->variables()[(*qut_it) + ".CONFIG"].findIndex("phony") != -1)
- deps += TQString(" ") + "FORCE";
- t << targ << ":" << deps << "\n";
- if(!cmd.isEmpty())
- t << "\t" << cmd << endl;
- t << 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") ? TQString("0") :
- project->first("VER_PAT")) );
- TQStringList l = TQStringList::split('.', project->first("VERSION"));
- l << "0" << "0"; //make sure there are three
- project->variables()["VER_MAJ"].append(l[0]);
- project->variables()["VER_MIN"].append(l[1]);
- project->variables()["VER_PAT"].append(l[2]);
-
- if ( !project->variables()["TQMAKE_APP_FLAG"].isEmpty() ) {
-#if 0
- if ( project->isActiveConfig("dll") ) {
- project->variables()["TARGET"] += project->variables()["TARGET.so"];
- if(project->variables()["TQMAKE_LFLAGS_SHAPP"].isEmpty())
- project->variables()["TQMAKE_LFLAGS_SHAPP"] += project->variables()["TQMAKE_LFLAGS_SHLIB"];
- if(!project->variables()["TQMAKE_LFLAGS_SONAME"].isEmpty())
- project->variables()["TQMAKE_LFLAGS_SONAME"].first() += project->first("TARGET");
- }
-#endif
- project->variables()["TARGET"].first().prepend(project->first("DESTDIR"));
- if ( !project->variables()["TQMAKE_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()["TQMAKE_AR_CMD"].isEmpty())
- project->variables()["TQMAKE_AR_CMD"].append("$(AR) $(TARGET) $(OBJECTS) $(OBJTQMOC)");
- } else {
- project->variables()["TARGETA"].append(project->first("DESTDIR") + "lib" + project->first("TARGET") + ".a");
- if( project->isActiveConfig("compile_libtool") )
- project->variables()["TARGET_la"] = TQT_TQSTRING(project->first("DESTDIR") + "lib" + project->first("TARGET") + Option::libtool_ext);
-
- if ( !project->variables()["TQMAKE_AR_CMD"].isEmpty() )
- project->variables()["TQMAKE_AR_CMD"].first().replace("(TARGET)","(TARGETA)");
- else
- project->variables()["TQMAKE_AR_CMD"].append("$(AR) $(TARGETA) $(OBJECTS) $(OBJTQMOC)");
- 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("TQMAKE_EXTENSION_PLUGIN"));
- if(project->isActiveConfig("lib_version_first"))
- project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
- project->first("VER_MAJ") + "." +
- project->first("TQMAKE_EXTENSION_PLUGIN"));
- else
- project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
- project->first("TQMAKE_EXTENSION_PLUGIN") +
- "." + project->first("VER_MAJ"));
-
- project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"];
- if(project->isActiveConfig("qt"))
- project->variables()["DEFINES"].append("TQT_PLUGIN");
- } else if ( !project->isEmpty("TQMAKE_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->first("TARGET"));
- else
- project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
- project->first("VER_MAJ"));
- project->variables()["TARGET"] = project->variables()["TARGET_x"];
- } else if ( !project->isEmpty("TQMAKE_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("TQMAKE_EXTENSION_SHLIB"));
- project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." +
- project->first("VER_MAJ") +
- "." + project->first("VER_MIN") + "." +
- project->first("TQMAKE_EXTENSION_SHLIB"));
- project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." +
- project->first("VER_MAJ") + "." +
- project->first("VER_MIN") + "." +
- project->first("VER_PAT") + "." +
- project->first("TQMAKE_EXTENSION_SHLIB"));
- } else {
- project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
- project->first("TQMAKE_EXTENSION_SHLIB") +
- "." + project->first("VER_MAJ"));
- project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." +
- project->first("TQMAKE_EXTENSION_SHLIB") +
- "." + project->first("VER_MAJ") +
- "." + project->first("VER_MIN"));
- project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." +
- project->first("TQMAKE_EXTENSION_SHLIB") + "." +
- project->first("VER_MAJ") + "." +
- project->first("VER_MIN") + "." +
- project->first("VER_PAT"));
- }
- project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"];
- } else {
- project->variables()["TARGET_"].append("lib" + project->first("TARGET") + "." +
- project->first("TQMAKE_EXTENSION_SHLIB"));
- if(project->isActiveConfig("lib_version_first")) {
- project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
- project->first("VER_MAJ") + "." +
- project->first("TQMAKE_EXTENSION_SHLIB"));
- project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." +
- project->first("VER_MAJ") +
- "." + project->first("VER_MIN") + "." +
- project->first("TQMAKE_EXTENSION_SHLIB"));
- project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") + "." +
- project->first("VER_MAJ") + "." +
- project->first("VER_MIN") + "." +
- project->first("VER_PAT") + "." +
- project->variables()["TQMAKE_EXTENSION_SHLIB"].first());
- } else {
- project->variables()["TARGET_x"].append("lib" + project->first("TARGET") + "." +
- project->first("TQMAKE_EXTENSION_SHLIB") +
- "." + project->first("VER_MAJ"));
- project->variables()["TARGET_x.y"].append("lib" + project->first("TARGET") + "." +
- project->first("TQMAKE_EXTENSION_SHLIB")
- + "." + project->first("VER_MAJ") +
- "." + project->first("VER_MIN"));
- project->variables()["TARGET_x.y.z"].append("lib" + project->first("TARGET") +
- "." +
- project->variables()[
- "TQMAKE_EXTENSION_SHLIB"].first() + "." +
- project->first("VER_MAJ") + "." +
- project->first("VER_MIN") + "." +
- project->first("VER_PAT"));
- }
- project->variables()["TARGET"] = project->variables()["TARGET_x.y.z"];
- }
- if(project->isEmpty("TQMAKE_LN_SHLIB"))
- project->variables()["TQMAKE_LN_SHLIB"].append("ln -s");
- project->variables()["DESTDIR_TARGET"].append("$(TARGET)");
- if ( !project->variables()["DESTDIR"].isEmpty() )
- project->variables()["DESTDIR_TARGET"].first().prepend(project->first("DESTDIR"));
- if ( !project->variables()["TQMAKE_LFLAGS_SONAME"].isEmpty()) {
- if(project->isActiveConfig("plugin")) {
- if(!project->variables()["TARGET"].isEmpty() )
- project->variables()["TQMAKE_LFLAGS_SONAME"].first() += project->first("TARGET");
- } else {
- if(!project->variables()["TARGET_x"].isEmpty() )
- project->variables()["TQMAKE_LFLAGS_SONAME"].first() += project->first("TARGET_x");
- }
- }
- if ( project->variables()["TQMAKE_LINK_SHLIB_CMD"].isEmpty() )
- project->variables()["TQMAKE_LINK_SHLIB_CMD"].append(
- "$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJTQMOC) $(LIBS) $(OBJCOMP)");
- }
- if(project->isEmpty("TQMAKE_SYMBOLIC_LINK"))
- project->variables()["TQMAKE_SYMBOLIC_LINK"].append("ln -sf");
- if ( !project->variables()["TQMAKE_APP_FLAG"].isEmpty() ) {
- project->variables()["TQMAKE_CFLAGS"] += project->variables()["TQMAKE_CFLAGS_APP"];
- project->variables()["TQMAKE_CXXFLAGS"] += project->variables()["TQMAKE_CXXFLAGS_APP"];
- project->variables()["TQMAKE_LFLAGS"] += project->variables()["TQMAKE_LFLAGS_APP"];
- } else if ( project->isActiveConfig("dll") ) {
- if( !project->isActiveConfig("plugin") || !project->isActiveConfig("plugin_no_share_shlib_cflags")) {
- project->variables()["TQMAKE_CFLAGS"] += project->variables()["TQMAKE_CFLAGS_SHLIB"];
- project->variables()["TQMAKE_CXXFLAGS"] += project->variables()["TQMAKE_CXXFLAGS_SHLIB"];
- }
- if ( project->isActiveConfig("plugin") ) {
- project->variables()["TQMAKE_CFLAGS"] += project->variables()["TQMAKE_CFLAGS_PLUGIN"];
- project->variables()["TQMAKE_CXXFLAGS"] += project->variables()["TQMAKE_CXXFLAGS_PLUGIN"];
- project->variables()["TQMAKE_LFLAGS"] += project->variables()["TQMAKE_LFLAGS_PLUGIN"];
- if( project->isActiveConfig("plugin_with_soname") && !project->isActiveConfig("compile_libtool"))
- project->variables()["TQMAKE_LFLAGS"] += project->variables()["TQMAKE_LFLAGS_SONAME"];
- } else {
- project->variables()["TQMAKE_LFLAGS"] += project->variables()["TQMAKE_LFLAGS_SHLIB"];
- if(!project->isEmpty("TQMAKE_LFLAGS_COMPAT_VERSION")) {
- if(project->isEmpty("COMPAT_VERSION"))
- project->variables()["TQMAKE_LFLAGS"] += TQString(project->first("TQMAKE_LFLAGS_COMPAT_VERSION") +
- project->first("VER_MAJ") + "." +
- project->first("VER_MIN"));
- else
- project->variables()["TQMAKE_LFLAGS"] += TQString(project->first("TQMAKE_LFLAGS_COMPAT_VERSION") +
- project->first("COMPATIBILITY_VERSION"));
- }
- if(!project->isEmpty("TQMAKE_LFLAGS_VERSION")) {
- project->variables()["TQMAKE_LFLAGS"] += TQString(project->first("TQMAKE_LFLAGS_VERSION") +
- project->first("VER_MAJ") + "." +
- project->first("VER_MIN") + "." +
- project->first("VER_PAT"));
- }
- if(!project->isActiveConfig("compile_libtool"))
- project->variables()["TQMAKE_LFLAGS"] += project->variables()["TQMAKE_LFLAGS_SONAME"];
- }
- TQString destdir = project->first("DESTDIR");
- if ( !destdir.isEmpty() && !project->variables()["TQMAKE_RPATH"].isEmpty() ) {
- TQString rpath_destdir = destdir;
- if(TQDir::isRelativePath(rpath_destdir)) {
- TQFileInfo 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()["TQMAKE_LFLAGS"] += project->first("TQMAKE_RPATH") + rpath_destdir;
- }
- }
- TQStringList &quc = project->variables()["TQMAKE_EXTRA_UNIX_COMPILERS"];
- for(TQStringList::Iterator it = quc.begin(); it != quc.end(); ++it) {
- TQString tmp_out = project->variables()[(*it) + ".output"].first();
- if(tmp_out.isEmpty())
- continue;
- TQStringList &tmp = project->variables()[(*it) + ".input"];
- for(TQStringList::Iterator it2 = tmp.begin(); it2 != tmp.end(); ++it2) {
- TQStringList &inputs = project->variables()[(*it2)];
- for(TQStringList::Iterator input = inputs.begin(); input != inputs.end(); ++input) {
- TQFileInfo fi(Option::fixPathToLocalOS((*input)));
- TQString in = Option::fixPathToTargetOS((*input), FALSE),
- out = tmp_out;
- out.replace("${TQMAKE_FILE_BASE}", fi.baseName());
- out.replace("${TQMAKE_FILE_NAME}", fi.filePath());
- if(project->variables()[(*it) + ".CONFIG"].findIndex("no_link") == -1)
- project->variables()["OBJCOMP"] += out;
- }
- }
- }
-}
-
-TQString
-UnixMakefileGenerator::libtoolFileName()
-{
- TQString 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()
-{
- TQString fname = libtoolFileName(), lname = fname;
- int slsh = lname.findRev(Option::dir_sep);
- if(slsh != -1)
- lname = lname.right(lname.length() - slsh - 1);
- TQFile ft(fname);
- if(!ft.open(IO_WriteOnly))
- return;
- project->variables()["ALL_DEPS"].append(fname);
-
- TQTextStream t( TQT_TQIODEVICE(&ft) );
- t << "# " << lname << " - a libtool library file\n";
- time_t now = time(NULL);
- t << "# Generated by qmake/libtool (" << qmake_version() << ") (TQt "
- << TQT_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("TQMAKE_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";
- TQStringList libs;
- if(!project->isEmpty("TQMAKE_INTERNAL_PRL_LIBS"))
- libs = project->variables()["TQMAKE_INTERNAL_PRL_LIBS"];
- else
- libs << "TQMAKE_LIBS"; //obvious one
- t << "dependency_libs='";
- for(TQStringList::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";
-
- TQString 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";
-}
-
-TQString
-UnixMakefileGenerator::pkgConfigFileName()
-{
- TQString 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,TQDir::currentDirPath(), Option::output_dir));
- }
- return ret;
-}
-
-TQString
-UnixMakefileGenerator::TMOCFileName()
-{
- TQString ret = "tmoc";
- if(!project->isEmpty("DESTDIR")) {
- ret.prepend(var("DESTDIR"));
- ret = Option::fixPathToLocalOS(fileFixify(ret,TQDir::currentDirPath(), Option::output_dir));
- }
- return ret;
-}
-
-TQString
-UnixMakefileGenerator::TMOCFileName2()
-{
- TQString ret = "tqt-replace-stream";
- if(!project->isEmpty("DESTDIR")) {
- ret.prepend(var("DESTDIR"));
- ret = Option::fixPathToLocalOS(fileFixify(ret,TQDir::currentDirPath(), Option::output_dir));
- }
- return ret;
-}
-
-TQString
-UnixMakefileGenerator::pkgConfigPrefix() const
-{
- if(!project->isEmpty("TQMAKE_PKGCONFIG_PREFIX"))
- return project->first("TQMAKE_PKGCONFIG_PREFIX");
- return qInstallPath();
-}
-
-TQString
-UnixMakefileGenerator::pkgConfigFixPath(TQString path) const
-{
- TQString prefix = pkgConfigPrefix();
- if(path.startsWith(prefix))
- path = path.replace(prefix, "${prefix}");
- return path;
-}
-
-void
-UnixMakefileGenerator::writePkgConfigFile() // ### does make sense only for libtqt so far
-{
- TQString fname = pkgConfigFileName(), lname = fname;
- int slsh = lname.findRev(Option::dir_sep);
- if(slsh != -1)
- lname = lname.right(lname.length() - slsh - 1);
- TQFile ft(fname);
- if(!ft.open(IO_WriteOnly))
- return;
- project->variables()["ALL_DEPS"].append(fname);
- TQTextStream t( TQT_TQIODEVICE(&ft) );
-
- TQString prefix = pkgConfigPrefix();
- TQString libDir = project->first("TQMAKE_PKGCONFIG_LIBDIR");
- if(libDir.isEmpty())
- libDir = prefix + "/lib";
- TQString includeDir = project->first("TQMAKE_PKGCONFIG_INCDIR");
- if(includeDir.isEmpty())
- includeDir = prefix + "/include";
-
- t << "prefix=" << prefix << endl;
- t << "exec_prefix=${prefix}\n"
- << "bindir=${prefix}/bin\n"
- << "libdir=" << pkgConfigFixPath(libDir) << "\n"
- << "includedir=" << pkgConfigFixPath(includeDir) << endl;
-
- t << "\ntmoc_executable=${bindir}/tmoc\n"
- << "moc_executable=${bindir}/moc\n"
- << "uic_executable=${bindir}/uic-tqt" << 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: TQt" << endl;
- TQString desc = project->first("TQMAKE_PKGCONFIG_DESCRIPTION");
- if(desc.isEmpty()) {
- desc = project->first("TARGET").lower();
- desc.replace(0, 1, TQT_TQCHAR(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
- TQStringList libs;
- if(!project->isEmpty("TQMAKE_INTERNAL_PRL_LIBS"))
- libs = project->variables()["TQMAKE_INTERNAL_PRL_LIBS"];
- else
- libs << "TQMAKE_LIBS"; //obvious one
- if(project->isActiveConfig("thread"))
- libs << "TQMAKE_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(TQStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it)
- t << project->variables()[(*it)].join(" ") << " ";
- t << "-lQtCore -lQtGui -lQtNetwork";
- t << endl;
-
- // flags
- // ### too many
- t << "Cflags: "
- // << var("TQMAKE_CXXFLAGS") << " "
- << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
- << project->variables()["PRL_EXPORT_CXXFLAGS"].join(" ")
- // << varGlue("DEFINES","-D"," -D"," ")
- << " -I${includedir}"
- << " -I${includedir}/qt4"
- << " -include tqt.h";
- t << endl;
-}
-
-void
-UnixMakefileGenerator::writeTMOCFile()
-{
- TQString fname = TMOCFileName(), lname = fname;
- int slsh = lname.findRev(Option::dir_sep);
- if(slsh != -1)
- lname = lname.right(lname.length() - slsh - 1);
- TQFile ft(fname);
- if(!ft.open(IO_WriteOnly))
- return;
- project->variables()["ALL_DEPS"].append(fname);
- TQTextStream t( TQT_TQIODEVICE(&ft) );
-
- TQString prefix = pkgConfigPrefix();
- TQString libDir = project->first("TQMAKE_PKGCONFIG_LIBDIR");
- if(libDir.isEmpty())
- libDir = prefix + "/lib";
- TQString includeDir = project->first("TQMAKE_PKGCONFIG_INCDIR");
- if(includeDir.isEmpty())
- includeDir = prefix + "/include";
- TQString binDir = prefix + "/bin";
-
- t << "if [ -f " << binDir << "/tqt-replace-stream ]; then\n"
- << " if [ -z \"$1\" ]; then\n"
- << " echo \"Usage: tmoc <input_file> -o <out_file>\"\n"
- << " else\n"
- << " input_file=\"$1\"\n"
- << " out_file=\"$3\"\n"
- << " " << binDir << "/tqt-replace-stream \"${input_file}\" | \\\n"
- << " " << binDir << "/moc | \\\n"
- << " sed \"/QT_BEGIN_MOC_NAMESPACE/ i #include \\\"${input_file}\\\"\" \\\n"
- << " > \"${out_file}\"\n"
- << " fi\n"
- << "else\n"
- << " echo \"ERROR: " << binDir << "/tqt-replace-stream is not available. tmoc will fail!\"\n"
- << " exit 1;\n"
- << "fi\n"
- << endl;
-}
-
-void
-UnixMakefileGenerator::writeTMOCFile2()
-{
- TQString fname = TMOCFileName2(), lname = fname;
- int slsh = lname.findRev(Option::dir_sep);
- if(slsh != -1)
- lname = lname.right(lname.length() - slsh - 1);
- TQFile ft(fname);
- if(!ft.open(IO_WriteOnly))
- return;
- project->variables()["ALL_DEPS"].append(fname);
- TQTextStream t( TQT_TQIODEVICE(&ft) );
-
- TQString prefix = pkgConfigPrefix();
- TQString libDir = project->first("TQMAKE_PKGCONFIG_LIBDIR");
- if(libDir.isEmpty())
- libDir = prefix + "/lib";
- TQString includeDir = project->first("TQMAKE_PKGCONFIG_INCDIR");
- if(includeDir.isEmpty())
- includeDir = prefix + "/include";
- TQString binDir = prefix + "/bin";
-
- t << "#!/bin/bash\n"
- << "\n"
- << "if [[ $1 == \"\" ]]; then\n"
- << " echo \"Usage: tqt-replace-stream <filename>\"\n"
- << "else\n"
- << " cat $1 | \\\n"
- << " sed 's/TQ_PROPERTY/Q_PROPERTY/g' | \\\n"
- << " sed 's/TQ_SETS/Q_ENUMS/g'\n"
- << "fi\n"
- << endl;
-}