2011-04-27 10:05:43 +00:00
|
|
|
/****************************************************************************
|
|
|
|
**
|
2014-05-15 08:09:50 +00:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-09-19 12:28:29 +00:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
|
|
|
** This file is part of the qmake application of the Qt Toolkit.
|
|
|
|
**
|
|
|
|
** $QT_BEGIN_LICENSE:LGPL$
|
2012-09-19 12:28:29 +00:00
|
|
|
** Commercial License Usage
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
|
|
|
**
|
2011-04-27 10:05:43 +00:00
|
|
|
** GNU Lesser General Public License Usage
|
2012-09-19 12:28:29 +00:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
2012-09-19 12:28:29 +00:00
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2011-04-27 10:05:43 +00:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
**
|
2011-05-24 09:34:08 +00:00
|
|
|
** GNU General Public License Usage
|
2012-09-19 12:28:29 +00:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
** General Public License version 3.0 as published by the Free Software
|
|
|
|
** Foundation and appearing in the file LICENSE.GPL included in the
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
** ensure the GNU General Public License version 3.0 requirements will be
|
|
|
|
** met: http://www.gnu.org/copyleft/gpl.html.
|
2011-04-27 10:05:43 +00:00
|
|
|
**
|
2012-01-24 06:17:24 +00:00
|
|
|
**
|
2011-04-27 10:05:43 +00:00
|
|
|
** $QT_END_LICENSE$
|
|
|
|
**
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
#include "unixmake.h"
|
|
|
|
#include "option.h"
|
|
|
|
#include "meta.h"
|
|
|
|
#include <qregexp.h>
|
|
|
|
#include <qbytearray.h>
|
|
|
|
#include <qfile.h>
|
|
|
|
#include <qdir.h>
|
|
|
|
#include <qdatetime.h>
|
|
|
|
#include <qdebug.h>
|
|
|
|
#include <time.h>
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
|
|
|
|
UnixMakefileGenerator::UnixMakefileGenerator() : MakefileGenerator(), init_flag(false), include_deps(false)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
UnixMakefileGenerator::writePrlFile(QTextStream &t)
|
|
|
|
{
|
|
|
|
MakefileGenerator::writePrlFile(t);
|
|
|
|
// libtool support
|
|
|
|
|
|
|
|
if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib") { //write .la
|
|
|
|
if(project->isActiveConfig("compile_libtool"))
|
|
|
|
warn_msg(WarnLogic, "create_libtool specified with compile_libtool can lead to conflicting .la\n"
|
|
|
|
"formats, create_libtool has been disabled\n");
|
|
|
|
else
|
|
|
|
writeLibtoolFile();
|
|
|
|
}
|
|
|
|
// pkg-config support
|
|
|
|
if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")
|
|
|
|
writePkgConfigFile();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
UnixMakefileGenerator::writeMakefile(QTextStream &t)
|
|
|
|
{
|
|
|
|
|
|
|
|
writeHeader(t);
|
2013-08-26 17:51:57 +00:00
|
|
|
if (writeDummyMakefile(t))
|
2011-04-27 10:05:43 +00:00
|
|
|
return true;
|
|
|
|
|
|
|
|
if (project->values("TEMPLATE").first() == "app" ||
|
2011-05-03 13:30:28 +00:00
|
|
|
project->values("TEMPLATE").first() == "lib" ||
|
|
|
|
project->values("TEMPLATE").first() == "aux") {
|
2011-04-27 10:05:43 +00:00
|
|
|
if(Option::mkfile::do_stub_makefile && MakefileGenerator::writeStubMakefile(t))
|
|
|
|
return true;
|
|
|
|
writeMakeParts(t);
|
|
|
|
return MakefileGenerator::writeMakefile(t);
|
|
|
|
} else if(project->values("TEMPLATE").first() == "subdirs") {
|
|
|
|
MakefileGenerator::writeSubDirs(t);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2014-01-17 17:26:00 +00:00
|
|
|
void
|
|
|
|
UnixMakefileGenerator::writeDefaultVariables(QTextStream &t)
|
|
|
|
{
|
|
|
|
MakefileGenerator::writeDefaultVariables(t);
|
|
|
|
t << "TAR = " << var("QMAKE_TAR") << endl;
|
|
|
|
t << "COMPRESS = " << var("QMAKE_GZIP") << endl;
|
|
|
|
|
|
|
|
if (project->isEmpty("QMAKE_DISTNAME")) {
|
|
|
|
ProString distname = project->first("QMAKE_ORIG_TARGET");
|
|
|
|
if (!project->isActiveConfig("no_dist_version"))
|
|
|
|
distname += project->first("VERSION");
|
|
|
|
project->values("QMAKE_DISTNAME") = distname;
|
|
|
|
}
|
|
|
|
t << "DISTNAME = " << var("QMAKE_DISTNAME") << endl;
|
|
|
|
|
|
|
|
if (project->isEmpty("QMAKE_DISTDIR"))
|
|
|
|
project->values("QMAKE_DISTDIR") = project->first("QMAKE_DISTNAME");
|
|
|
|
t << "DISTDIR = " << escapeFilePath(fileFixify(
|
|
|
|
(project->isEmpty("OBJECTS_DIR") ? ProString(".tmp/") : project->first("OBJECTS_DIR")) + project->first("QMAKE_DISTDIR"),
|
|
|
|
Option::output_dir, Option::output_dir, FileFixifyAbsolute)) << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
UnixMakefileGenerator::writeSubTargets(QTextStream &t, QList<MakefileGenerator::SubTarget*> targets, int flags)
|
|
|
|
{
|
|
|
|
MakefileGenerator::writeSubTargets(t, targets, flags);
|
|
|
|
|
|
|
|
t << "dist: distdir FORCE" << endl;
|
|
|
|
t << "\t(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar)"
|
|
|
|
" && $(MOVE) `dirname $(DISTDIR)`/$(DISTNAME).tar.gz . && $(DEL_FILE) -r $(DISTDIR)";
|
|
|
|
t << endl << endl;
|
|
|
|
|
|
|
|
t << "distdir:";
|
|
|
|
for (int target = 0; target < targets.size(); ++target) {
|
|
|
|
SubTarget *subtarget = targets.at(target);
|
|
|
|
t << " " << subtarget->target << "-distdir";
|
|
|
|
}
|
|
|
|
t << " FORCE\n\t"
|
|
|
|
<< mkdir_p_asstring("$(DISTDIR)", false) << "\n\t"
|
|
|
|
<< "$(COPY_FILE) --parents " << var("DISTFILES") << " $(DISTDIR)" << Option::dir_sep << endl << endl;
|
|
|
|
|
|
|
|
const QString abs_source_path = project->first("QMAKE_ABSOLUTE_SOURCE_PATH").toQString();
|
|
|
|
for (int target = 0; target < targets.size(); ++target) {
|
|
|
|
SubTarget *subtarget = targets.at(target);
|
|
|
|
QString in_directory = subtarget->in_directory;
|
|
|
|
if (!in_directory.isEmpty() && !in_directory.endsWith(Option::dir_sep))
|
|
|
|
in_directory += Option::dir_sep;
|
|
|
|
QString out_directory = subtarget->out_directory;
|
|
|
|
if (!out_directory.isEmpty() && !out_directory.endsWith(Option::dir_sep))
|
|
|
|
out_directory += Option::dir_sep;
|
|
|
|
if (!abs_source_path.isEmpty() && out_directory.startsWith(abs_source_path))
|
|
|
|
out_directory = Option::output_dir + out_directory.mid(abs_source_path.length());
|
|
|
|
|
|
|
|
QString dist_directory = out_directory;
|
|
|
|
if (dist_directory.endsWith(Option::dir_sep))
|
|
|
|
dist_directory.chop(Option::dir_sep.length());
|
|
|
|
if (!dist_directory.startsWith(Option::dir_sep))
|
|
|
|
dist_directory.prepend(Option::dir_sep);
|
|
|
|
|
|
|
|
QString out_directory_cdin = out_directory.isEmpty() ? "\n\t"
|
|
|
|
: "\n\tcd " + out_directory + " && ";
|
|
|
|
QString makefilein = " -e -f " + subtarget->makefile + " distdir DISTDIR=$(DISTDIR)" + dist_directory;
|
|
|
|
|
|
|
|
QString out = subtarget->makefile;
|
|
|
|
QString in = escapeFilePath(fileFixify(in_directory + subtarget->profile, FileFixifyAbsolute));
|
|
|
|
if (out.startsWith(in_directory))
|
|
|
|
out.remove(0, in_directory.length());
|
|
|
|
|
|
|
|
t << subtarget->target << "-distdir: FORCE";
|
|
|
|
writeSubTargetCall(t, in_directory, in, out_directory, out,
|
|
|
|
out_directory_cdin, makefilein);
|
|
|
|
t << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
void
|
|
|
|
UnixMakefileGenerator::writeMakeParts(QTextStream &t)
|
|
|
|
{
|
|
|
|
QString deps = fileFixify(Option::output.fileName()), target_deps, prl;
|
|
|
|
bool do_incremental = (project->isActiveConfig("incremental") &&
|
|
|
|
!project->values("QMAKE_INCREMENTAL").isEmpty() &&
|
|
|
|
(!project->values("QMAKE_APP_FLAG").isEmpty() ||
|
|
|
|
(!project->isActiveConfig("staticlib")))),
|
|
|
|
src_incremental=false;
|
|
|
|
|
2013-07-11 13:43:32 +00:00
|
|
|
ProStringList &bundledFiles = project->values("QMAKE_BUNDLED_FILES");
|
|
|
|
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "####### Compiler, tools and options\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "CC = " << var("QMAKE_CC") << endl;
|
|
|
|
t << "CXX = " << var("QMAKE_CXX") << endl;
|
|
|
|
t << "DEFINES = "
|
|
|
|
<< varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
|
|
|
|
<< varGlue("DEFINES","-D"," -D","") << endl;
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "CFLAGS = " << var("QMAKE_CFLAGS") << " $(DEFINES)\n";
|
|
|
|
t << "CXXFLAGS = " << var("QMAKE_CXXFLAGS") << " $(DEFINES)\n";
|
|
|
|
t << "INCPATH = -I" << specdir();
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isActiveConfig("no_include_pwd")) {
|
|
|
|
QString pwd = escapeFilePath(fileFixify(qmake_getpwd()));
|
|
|
|
if(pwd.isEmpty())
|
|
|
|
pwd = ".";
|
|
|
|
t << " -I" << pwd;
|
|
|
|
}
|
|
|
|
{
|
2013-12-09 18:56:31 +00:00
|
|
|
QString isystem = var("QMAKE_CFLAGS_ISYSTEM");
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &incs = project->values("INCLUDEPATH");
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int i = 0; i < incs.size(); ++i) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString inc = escapeFilePath(incs.at(i));
|
2013-12-09 18:56:31 +00:00
|
|
|
if (inc.isEmpty())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (!isystem.isEmpty() && isSystemInclude(inc.toQString()))
|
|
|
|
t << ' ' << isystem << ' ' << inc;
|
|
|
|
else
|
2013-07-04 09:25:16 +00:00
|
|
|
t << " -I" << inc;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!project->isEmpty("QMAKE_FRAMEWORKPATH_FLAGS"))
|
|
|
|
t << " " << var("QMAKE_FRAMEWORKPATH_FLAGS");
|
|
|
|
t << endl;
|
|
|
|
|
2014-05-24 22:41:44 +00:00
|
|
|
writeDefaultVariables(t);
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isActiveConfig("staticlib")) {
|
|
|
|
t << "LINK = " << var("QMAKE_LINK") << endl;
|
|
|
|
t << "LFLAGS = " << var("QMAKE_LFLAGS") << endl;
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "LIBS = $(SUBLIBS) " << var("QMAKE_LIBS") << " " << var("QMAKE_LIBS_PRIVATE") << endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
t << "AR = " << var("QMAKE_AR") << endl;
|
|
|
|
t << "RANLIB = " << var("QMAKE_RANLIB") << endl;
|
|
|
|
if(project->isActiveConfig("compile_libtool"))
|
|
|
|
t << "LIBTOOL = " << var("QMAKE_LIBTOOL") << endl;
|
|
|
|
t << "SED = " << var("QMAKE_STREAM_EDITOR") << endl;
|
|
|
|
t << "STRIP = " << var("QMAKE_STRIP") << endl;
|
|
|
|
|
|
|
|
t << endl;
|
|
|
|
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "####### Output directory\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
if (! project->values("OBJECTS_DIR").isEmpty())
|
|
|
|
t << "OBJECTS_DIR = " << var("OBJECTS_DIR") << endl;
|
|
|
|
else
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "OBJECTS_DIR = ./\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
t << endl;
|
|
|
|
|
|
|
|
/* files */
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "####### Files\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "SOURCES = " << valList(escapeFilePaths(project->values("SOURCES"))) << " "
|
|
|
|
<< valList(escapeFilePaths(project->values("GENERATED_SOURCES"))) << endl;
|
|
|
|
if(do_incremental) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &objs = project->values("OBJECTS");
|
|
|
|
const ProStringList &incrs = project->values("QMAKE_INCREMENTAL");
|
|
|
|
ProStringList incrs_out;
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "OBJECTS = ";
|
2012-09-06 10:21:38 +00:00
|
|
|
for (ProStringList::ConstIterator objit = objs.begin(); objit != objs.end(); ++objit) {
|
2011-04-27 10:05:43 +00:00
|
|
|
bool increment = false;
|
2012-09-06 10:21:38 +00:00
|
|
|
for (ProStringList::ConstIterator incrit = incrs.begin(); incrit != incrs.end(); ++incrit) {
|
|
|
|
if ((*objit).toQString().indexOf(QRegExp((*incrit).toQString(), Qt::CaseSensitive,
|
|
|
|
QRegExp::Wildcard)) != -1) {
|
2011-04-27 10:05:43 +00:00
|
|
|
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 << escapeFilePaths(incrs_out).join(" \\\n\t\t") << endl;
|
|
|
|
} else if(!incrs_out.count()) {
|
|
|
|
t << endl;
|
|
|
|
} else {
|
|
|
|
src_incremental = true;
|
|
|
|
t << endl;
|
|
|
|
t << "INCREMENTAL_OBJECTS = " << escapeFilePaths(incrs_out).join(" \\\n\t\t") << endl;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
t << "OBJECTS = " << valList(escapeFilePaths(project->values("OBJECTS"))) << endl;
|
|
|
|
}
|
|
|
|
if(do_incremental && !src_incremental)
|
|
|
|
do_incremental = false;
|
2013-12-19 14:12:00 +00:00
|
|
|
t << "DIST = " << valList(fileFixify(project->values("DISTFILES").toQStringList())) << " "
|
|
|
|
<< valList(escapeFilePaths(project->values("SOURCES"))) << endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "QMAKE_TARGET = " << var("QMAKE_ORIG_TARGET") << endl;
|
2013-04-07 15:35:17 +00:00
|
|
|
// The comment is important for mingw32-make.exe on Windows as otherwise trailing slashes
|
|
|
|
// would be interpreted as line continuation. The lack of spacing between the value and the
|
|
|
|
// comment is also important as otherwise quoted use of "$(DESTDIR)" would include this
|
|
|
|
// spacing.
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "DESTDIR = " << var("DESTDIR") << "#avoid trailing-slash linebreak\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(project->isActiveConfig("compile_libtool"))
|
|
|
|
t << "TARGETL = " << var("TARGET_la") << endl;
|
|
|
|
t << "TARGET = " << escapeFilePath(var("TARGET")) << endl;
|
|
|
|
if(project->isActiveConfig("plugin")) {
|
|
|
|
t << "TARGETD = " << escapeFilePath(var("TARGET")) << endl;
|
|
|
|
} else if(!project->isActiveConfig("staticlib") && project->values("QMAKE_APP_FLAG").isEmpty()) {
|
|
|
|
t << "TARGETA = " << escapeFilePath(var("TARGETA")) << endl;
|
|
|
|
if(!project->isEmpty("QMAKE_BUNDLE")) {
|
|
|
|
t << "TARGETD = " << escapeFilePath(var("TARGET_x.y")) << endl;
|
|
|
|
t << "TARGET0 = " << escapeFilePath(var("TARGET_")) << endl;
|
2014-04-23 14:26:26 +00:00
|
|
|
} else if (!project->isActiveConfig("unversioned_libname")) {
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "TARGET0 = " << escapeFilePath(var("TARGET_")) << endl;
|
2014-04-23 14:26:26 +00:00
|
|
|
if (project->isEmpty("QMAKE_HPUX_SHLIB")) {
|
|
|
|
t << "TARGETD = " << escapeFilePath(var("TARGET_x.y.z")) << endl;
|
|
|
|
t << "TARGET1 = " << escapeFilePath(var("TARGET_x")) << endl;
|
|
|
|
t << "TARGET2 = " << escapeFilePath(var("TARGET_x.y")) << endl;
|
|
|
|
} else {
|
|
|
|
t << "TARGETD = " << escapeFilePath(var("TARGET_x")) << endl;
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
writeExtraCompilerVariables(t);
|
|
|
|
writeExtraVariables(t);
|
|
|
|
t << endl;
|
|
|
|
|
|
|
|
// blasted includes
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &qeui = project->values("QMAKE_EXTRA_INCLUDES");
|
|
|
|
ProStringList::ConstIterator it;
|
2011-04-27 10:05:43 +00:00
|
|
|
for(it = qeui.begin(); it != qeui.end(); ++it)
|
|
|
|
t << "include " << (*it) << endl;
|
|
|
|
|
|
|
|
/* rules */
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "first: all\n";
|
|
|
|
t << "####### Implicit rules\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
t << ".SUFFIXES: " << Option::obj_ext;
|
|
|
|
for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit)
|
|
|
|
t << " " << (*cit);
|
|
|
|
for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
|
|
|
|
t << " " << (*cppit);
|
|
|
|
t << endl << endl;
|
|
|
|
for(QStringList::Iterator cppit = Option::cpp_ext.begin(); cppit != Option::cpp_ext.end(); ++cppit)
|
|
|
|
t << (*cppit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CXX_IMP") << endl << endl;
|
|
|
|
for(QStringList::Iterator cit = Option::c_ext.begin(); cit != Option::c_ext.end(); ++cit)
|
|
|
|
t << (*cit) << Option::obj_ext << ":\n\t" << var("QMAKE_RUN_CC_IMP") << endl << endl;
|
|
|
|
|
|
|
|
if(include_deps) {
|
2011-10-24 11:37:30 +00:00
|
|
|
if (project->isActiveConfig("gcc_MD_depends")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList objects = project->values("OBJECTS");
|
|
|
|
for (ProStringList::Iterator it = objects.begin(); it != objects.end(); ++it) {
|
|
|
|
QString d_file = (*it).toQString().replace(QRegExp(Option::obj_ext + "$"), ".d");
|
2011-10-24 11:37:30 +00:00
|
|
|
t << "-include " << d_file << endl;
|
2012-09-06 10:21:38 +00:00
|
|
|
project->values("QMAKE_DISTCLEAN") << d_file;
|
2011-10-24 11:37:30 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
QString cmd=var("QMAKE_CFLAGS_DEPS") + " ";
|
|
|
|
cmd += varGlue("DEFINES","-D"," -D","") + varGlue("PRL_EXPORT_DEFINES"," -D"," -D","");
|
|
|
|
if(!project->isEmpty("QMAKE_ABSOLUTE_SOURCE_PATH"))
|
|
|
|
cmd += " -I" + project->first("QMAKE_ABSOLUTE_SOURCE_PATH") + " ";
|
|
|
|
cmd += " $(INCPATH) " + varGlue("DEPENDPATH", "-I", " -I", "");
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString odir;
|
2011-10-24 11:37:30 +00:00
|
|
|
if(!project->values("OBJECTS_DIR").isEmpty())
|
|
|
|
odir = project->first("OBJECTS_DIR");
|
2011-10-11 18:27:22 +00:00
|
|
|
|
2011-10-24 11:37:30 +00:00
|
|
|
QString pwd = escapeFilePath(fileFixify(qmake_getpwd()));
|
2011-10-11 18:27:22 +00:00
|
|
|
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "###### Dependencies\n\n";
|
2011-10-24 11:37:30 +00:00
|
|
|
t << odir << ".deps/%.d: " << pwd << "/%.cpp\n\t";
|
|
|
|
if(project->isActiveConfig("echo_depend_creation"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "@echo Creating depend for $<\n\t";
|
2013-11-18 15:12:13 +00:00
|
|
|
t << mkdir_p_asstring("$(@D)", false) << "\n\t"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "@$(CXX) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@\n\n";
|
2011-10-24 11:37:30 +00:00
|
|
|
|
|
|
|
t << odir << ".deps/%.d: " << pwd << "/%.c\n\t";
|
|
|
|
if(project->isActiveConfig("echo_depend_creation"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "@echo Creating depend for $<\n\t";
|
2013-11-18 15:12:13 +00:00
|
|
|
t << mkdir_p_asstring("$(@D)", false) << "\n\t"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "@$(CC) " << cmd << " $< | sed \"s,^\\($(*F).o\\):," << odir << "\\1:,g\" >$@\n\n";
|
2011-10-24 11:37:30 +00:00
|
|
|
|
2012-08-20 11:04:39 +00:00
|
|
|
static const char * const src[] = { "SOURCES", "GENERATED_SOURCES", 0 };
|
|
|
|
for (int x = 0; src[x]; x++) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &l = project->values(src[x]);
|
|
|
|
for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
|
2011-10-24 11:37:30 +00:00
|
|
|
if(!(*it).isEmpty()) {
|
|
|
|
QString d_file;
|
|
|
|
for(QStringList::Iterator cit = Option::c_ext.begin();
|
|
|
|
cit != Option::c_ext.end(); ++cit) {
|
|
|
|
if((*it).endsWith((*cit))) {
|
2012-09-06 10:21:38 +00:00
|
|
|
d_file = (*it).left((*it).length() - (*cit).length()).toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2011-10-24 11:37:30 +00:00
|
|
|
if(d_file.isEmpty()) {
|
|
|
|
for(QStringList::Iterator cppit = Option::cpp_ext.begin();
|
|
|
|
cppit != Option::cpp_ext.end(); ++cppit) {
|
|
|
|
if((*it).endsWith((*cppit))) {
|
2012-09-06 10:21:38 +00:00
|
|
|
d_file = (*it).left((*it).length() - (*cppit).length()).toQString();
|
2011-10-24 11:37:30 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-10-11 18:27:22 +00:00
|
|
|
|
2011-10-24 11:37:30 +00:00
|
|
|
if(!d_file.isEmpty()) {
|
|
|
|
d_file = odir + ".deps/" + fileFixify(d_file, pwd, Option::output_dir) + ".d";
|
2012-09-06 10:21:38 +00:00
|
|
|
QStringList deps = findDependencies((*it).toQString()).filter(QRegExp(
|
2011-10-24 11:37:30 +00:00
|
|
|
"((^|/)" + Option::h_moc_mod + "|" + Option::cpp_moc_ext + "$)"));
|
|
|
|
if(!deps.isEmpty())
|
2012-05-18 18:00:23 +00:00
|
|
|
t << d_file << ": " << deps.join(' ') << endl;
|
2011-10-24 11:37:30 +00:00
|
|
|
t << "-include " << d_file << endl;
|
|
|
|
project->values("QMAKE_DISTCLEAN") += d_file;
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "####### Build rules\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->values("SUBLIBS").isEmpty()) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString libdir = "tmp/";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("SUBLIBS_DIR"))
|
|
|
|
libdir = project->first("SUBLIBS_DIR");
|
|
|
|
t << "SUBLIBS = ";
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &l = project->values("SUBLIBS");
|
|
|
|
for (ProStringList::ConstIterator it = l.begin(); it != l.end(); ++it)
|
2011-04-27 10:05:43 +00:00
|
|
|
t << libdir << project->first("QMAKE_PREFIX_STATICLIB") << (*it) << "."
|
|
|
|
<< project->first("QMAKE_EXTENSION_STATICLIB") << " ";
|
|
|
|
t << endl << endl;
|
|
|
|
}
|
2013-03-11 17:00:34 +00:00
|
|
|
if ((project->isActiveConfig("depend_prl") || project->isActiveConfig("fast_depend_prl"))
|
|
|
|
&& !project->isEmpty("QMAKE_PRL_INTERNAL_FILES")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &l = project->values("QMAKE_PRL_INTERNAL_FILES");
|
|
|
|
ProStringList::ConstIterator it;
|
2011-04-27 10:05:43 +00:00
|
|
|
for(it = l.begin(); it != l.end(); ++it) {
|
2012-08-22 12:10:35 +00:00
|
|
|
QMakeMetaInfo libinfo(project);
|
2012-09-06 10:21:38 +00:00
|
|
|
if (libinfo.readLib((*it).toQString()) && !libinfo.isEmpty("QMAKE_PRL_BUILD_DIR")) {
|
|
|
|
ProString dir;
|
2011-04-27 10:05:43 +00:00
|
|
|
int slsh = (*it).lastIndexOf(Option::dir_sep);
|
|
|
|
if(slsh != -1)
|
|
|
|
dir = (*it).left(slsh + 1);
|
|
|
|
QString targ = dir + libinfo.first("QMAKE_PRL_TARGET");
|
|
|
|
target_deps += " " + targ;
|
2013-03-11 17:00:34 +00:00
|
|
|
t << targ;
|
|
|
|
if (project->isActiveConfig("fast_depend_prl"))
|
|
|
|
t << ":\n\t@echo \"Creating '";
|
|
|
|
else
|
|
|
|
t << ": FORCE\n\t@echo \"Creating/updating '";
|
2013-07-04 09:25:16 +00:00
|
|
|
t << targ << "'\"\n\t"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< "(cd " << libinfo.first("QMAKE_PRL_BUILD_DIR") << ";"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "$(MAKE))\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2012-08-15 17:41:22 +00:00
|
|
|
if (!project->values("QMAKE_APP_FLAG").isEmpty() || project->first("TEMPLATE") == "aux") {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString destdir = project->first("DESTDIR").toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_BUNDLE")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION").toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!bundle_loc.isEmpty() && !bundle_loc.startsWith("/"))
|
|
|
|
bundle_loc.prepend("/");
|
|
|
|
if(!bundle_loc.endsWith("/"))
|
|
|
|
bundle_loc += "/";
|
|
|
|
destdir += project->first("QMAKE_BUNDLE") + bundle_loc;
|
|
|
|
}
|
|
|
|
if(do_incremental) {
|
|
|
|
//incremental target
|
|
|
|
QString incr_target = var("TARGET") + "_incremental";
|
|
|
|
if(incr_target.indexOf(Option::dir_sep) != -1)
|
|
|
|
incr_target = incr_target.right(incr_target.length() -
|
|
|
|
(incr_target.lastIndexOf(Option::dir_sep) + 1));
|
|
|
|
QString incr_deps, incr_objs;
|
|
|
|
if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") {
|
|
|
|
QString incr_target_dir = var("OBJECTS_DIR") + incr_target + Option::obj_ext;
|
|
|
|
//actual target
|
2013-07-04 09:25:16 +00:00
|
|
|
t << incr_target_dir << ": $(OBJECTS)\n\t"
|
|
|
|
<< "ld -r -o "<< incr_target_dir << " $(OBJECTS)\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
//communicated below
|
|
|
|
deps.prepend(incr_target_dir + " ");
|
|
|
|
incr_deps = "$(INCREMENTAL_OBJECTS)";
|
|
|
|
if(!incr_objs.isEmpty())
|
|
|
|
incr_objs += " ";
|
|
|
|
incr_objs += incr_target_dir;
|
|
|
|
} else {
|
|
|
|
//actual target
|
|
|
|
QString incr_target_dir = var("DESTDIR") + "lib" + incr_target + "." +
|
|
|
|
project->values("QMAKE_EXTENSION_SHLIB").first();
|
|
|
|
QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " ";
|
|
|
|
if(project->isActiveConfig("debug"))
|
|
|
|
incr_lflags += var("QMAKE_LFLAGS_DEBUG");
|
2013-11-18 20:39:08 +00:00
|
|
|
else if (project->isActiveConfig("debug_info"))
|
|
|
|
incr_lflags += var("QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO");
|
2011-04-27 10:05:43 +00:00
|
|
|
else
|
|
|
|
incr_lflags += var("QMAKE_LFLAGS_RELEASE");
|
2013-07-04 09:25:16 +00:00
|
|
|
t << incr_target_dir << ": $(INCREMENTAL_OBJECTS)\n\t";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!destdir.isEmpty())
|
|
|
|
t << "\n\t" << mkdir_p_asstring(destdir) << "\n\t";
|
|
|
|
t << "$(LINK) " << incr_lflags << " -o "<< incr_target_dir <<
|
2013-07-04 09:25:16 +00:00
|
|
|
" $(INCREMENTAL_OBJECTS)\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
//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" + qmake_getpwd();
|
|
|
|
}
|
|
|
|
if(!incr_objs.isEmpty())
|
|
|
|
incr_objs += " ";
|
|
|
|
incr_objs += " -l" + incr_target;
|
|
|
|
deps.prepend(incr_target_dir + " ");
|
|
|
|
incr_deps = "$(OBJECTS)";
|
|
|
|
}
|
|
|
|
t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("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" << mkdir_p_asstring(destdir) << "\n\t";
|
|
|
|
if(!project->isEmpty("QMAKE_PRE_LINK"))
|
|
|
|
t << var("QMAKE_PRE_LINK") << "\n\t";
|
2013-01-30 14:58:00 +00:00
|
|
|
t << "$(LINK) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(TARGET) " << incr_deps << " " << incr_objs << " $(OBJCOMP) $(LIBS)";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_POST_LINK"))
|
|
|
|
t << "\n\t" << var("QMAKE_POST_LINK");
|
|
|
|
t << endl << endl;
|
|
|
|
} else {
|
|
|
|
t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << "$(TARGET)"
|
|
|
|
<< endl << endl;
|
|
|
|
|
|
|
|
t << "$(TARGET): " << var("PRE_TARGETDEPS") << " $(OBJECTS) "
|
|
|
|
<< target_deps << " " << var("POST_TARGETDEPS") << "\n\t";
|
2012-08-15 17:41:22 +00:00
|
|
|
if (project->first("TEMPLATE") != "aux") {
|
|
|
|
if (!destdir.isEmpty())
|
|
|
|
t << mkdir_p_asstring(destdir) << "\n\t";
|
|
|
|
if (!project->isEmpty("QMAKE_PRE_LINK"))
|
|
|
|
t << var("QMAKE_PRE_LINK") << "\n\t";
|
2013-01-30 14:58:00 +00:00
|
|
|
t << "$(LINK) $(LFLAGS) " << var("QMAKE_LINK_O_FLAG") << "$(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)";
|
2012-08-15 17:41:22 +00:00
|
|
|
if (!project->isEmpty("QMAKE_POST_LINK"))
|
|
|
|
t << "\n\t" << var("QMAKE_POST_LINK");
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
t << endl << endl;
|
|
|
|
}
|
|
|
|
} else if(!project->isActiveConfig("staticlib")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString destdir = unescapeFilePath(project->first("DESTDIR").toQString()), incr_deps;
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_BUNDLE")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION").toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!bundle_loc.isEmpty() && !bundle_loc.startsWith("/"))
|
|
|
|
bundle_loc.prepend("/");
|
|
|
|
if(!bundle_loc.endsWith("/"))
|
|
|
|
bundle_loc += "/";
|
|
|
|
destdir += project->first("QMAKE_BUNDLE") + bundle_loc;
|
|
|
|
}
|
|
|
|
destdir = escapeFilePath(destdir);
|
|
|
|
|
|
|
|
if(do_incremental) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString s_ext = project->first("QMAKE_EXTENSION_SHLIB");
|
2011-04-27 10:05:43 +00:00
|
|
|
QString incr_target = var("QMAKE_ORIG_TARGET").replace(
|
|
|
|
QRegExp("\\." + s_ext), "").replace(QRegExp("^lib"), "") + "_incremental";
|
|
|
|
if(incr_target.indexOf(Option::dir_sep) != -1)
|
|
|
|
incr_target = incr_target.right(incr_target.length() -
|
|
|
|
(incr_target.lastIndexOf(Option::dir_sep) + 1));
|
|
|
|
incr_target = escapeFilePath(incr_target);
|
|
|
|
|
|
|
|
if(project->first("QMAKE_INCREMENTAL_STYLE") == "ld") {
|
|
|
|
QString incr_target_dir = escapeFilePath(var("OBJECTS_DIR") + incr_target + Option::obj_ext);
|
|
|
|
//actual target
|
|
|
|
const QString link_deps = "$(OBJECTS) ";
|
|
|
|
t << incr_target_dir << ": " << link_deps << "\n\t"
|
|
|
|
<< "ld -r -o " << incr_target_dir << " " << link_deps << endl;
|
|
|
|
//communicated below
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList &cmd = project->values("QMAKE_LINK_SHLIB_CMD");
|
|
|
|
cmd[0] = cmd.at(0).toQString().replace("$(OBJECTS) ", "$(INCREMENTAL_OBJECTS)"); //ick
|
2011-04-27 10:05:43 +00:00
|
|
|
cmd.append(incr_target_dir);
|
|
|
|
deps.prepend(incr_target_dir + " ");
|
|
|
|
incr_deps = "$(INCREMENTAL_OBJECTS)";
|
|
|
|
} else {
|
|
|
|
//actual target
|
|
|
|
QString incr_target_dir = escapeFilePath(destdir + "lib" + incr_target + "." + s_ext);
|
|
|
|
QString incr_lflags = var("QMAKE_LFLAGS_SHLIB") + " ";
|
|
|
|
if(!project->isEmpty("QMAKE_LFLAGS_INCREMENTAL"))
|
|
|
|
incr_lflags += var("QMAKE_LFLAGS_INCREMENTAL") + " ";
|
|
|
|
if(project->isActiveConfig("debug"))
|
|
|
|
incr_lflags += var("QMAKE_LFLAGS_DEBUG");
|
2013-11-18 20:39:08 +00:00
|
|
|
else if (project->isActiveConfig("debug_info"))
|
|
|
|
incr_lflags += var("QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO");
|
2011-04-27 10:05:43 +00:00
|
|
|
else
|
|
|
|
incr_lflags += var("QMAKE_LFLAGS_RELEASE");
|
2013-07-04 09:25:16 +00:00
|
|
|
t << incr_target_dir << ": $(INCREMENTAL_OBJECTS)\n\t";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!destdir.isEmpty())
|
2013-11-20 17:16:54 +00:00
|
|
|
t << mkdir_p_asstring(destdir, false) << "\n\t";
|
2013-01-30 14:58:00 +00:00
|
|
|
t << "$(LINK) " << incr_lflags << " " << var("QMAKE_LINK_O_FLAG") << incr_target_dir <<
|
2013-07-04 09:25:16 +00:00
|
|
|
" $(INCREMENTAL_OBJECTS)\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
//communicated below
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList &cmd = project->values("QMAKE_LINK_SHLIB_CMD");
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!destdir.isEmpty())
|
|
|
|
cmd.append(" -L" + destdir);
|
|
|
|
cmd.append(" -l" + incr_target);
|
|
|
|
deps.prepend(incr_target_dir + " ");
|
|
|
|
incr_deps = "$(OBJECTS)";
|
|
|
|
}
|
|
|
|
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ")
|
|
|
|
<< " " << destdir << "$(TARGET)\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
//real target
|
|
|
|
t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS") << " "
|
|
|
|
<< incr_deps << " $(SUBLIBS) " << target_deps << " " << var("POST_TARGETDEPS");
|
|
|
|
} else {
|
|
|
|
t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << " " <<
|
2013-07-04 09:25:16 +00:00
|
|
|
destdir << "$(TARGET)\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS")
|
|
|
|
<< " $(OBJECTS) $(SUBLIBS) $(OBJCOMP) " << target_deps
|
|
|
|
<< " " << var("POST_TARGETDEPS");
|
|
|
|
}
|
|
|
|
if(!destdir.isEmpty())
|
2013-11-20 17:16:54 +00:00
|
|
|
t << "\n\t" << mkdir_p_asstring(destdir, false);
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_PRE_LINK"))
|
|
|
|
t << "\n\t" << var("QMAKE_PRE_LINK");
|
|
|
|
|
|
|
|
if(project->isActiveConfig("compile_libtool")) {
|
|
|
|
t << "\n\t"
|
|
|
|
<< var("QMAKE_LINK_SHLIB_CMD");
|
|
|
|
} else if(project->isActiveConfig("plugin")) {
|
|
|
|
t << "\n\t"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "-$(DEL_FILE) $(TARGET)\n\t"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< var("QMAKE_LINK_SHLIB_CMD");
|
|
|
|
if(!destdir.isEmpty())
|
|
|
|
t << "\n\t"
|
2013-04-07 15:35:17 +00:00
|
|
|
<< "-$(MOVE) $(TARGET) " << destdir << " ";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_POST_LINK"))
|
|
|
|
t << "\n\t" << var("QMAKE_POST_LINK");
|
|
|
|
t << endl << endl;
|
|
|
|
} else if(!project->isEmpty("QMAKE_BUNDLE")) {
|
2013-07-11 13:43:32 +00:00
|
|
|
QString currentLink = destdir + "Versions/Current";
|
|
|
|
bundledFiles << currentLink << destdir + "$(TARGET)";
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "\n\t"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "-$(DEL_FILE) $(TARGET) $(TARGET0) $(DESTDIR)$(TARGET0)\n\t"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< var("QMAKE_LINK_SHLIB_CMD") << "\n\t"
|
|
|
|
<< mkdir_p_asstring("\"`dirname $(DESTDIR)$(TARGETD)`\"", false) << "\n\t"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "-$(MOVE) $(TARGET) $(DESTDIR)$(TARGETD)\n\t"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< mkdir_p_asstring("\"`dirname $(DESTDIR)$(TARGET0)`\"", false) << "\n\t"
|
2013-07-12 09:55:28 +00:00
|
|
|
<< varGlue("QMAKE_LN_SHLIB", "-", " ",
|
|
|
|
" Versions/Current/$(TARGET) $(DESTDIR)$(TARGET0)") << "\n\t"
|
2013-07-11 13:43:32 +00:00
|
|
|
<< "-$(DEL_FILE) " << currentLink << "\n\t"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< varGlue("QMAKE_LN_SHLIB","-"," ", " " + project->first("QMAKE_FRAMEWORK_VERSION") +
|
2013-07-11 13:43:32 +00:00
|
|
|
" " + currentLink) << "\n\t";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_POST_LINK"))
|
|
|
|
t << "\n\t" << var("QMAKE_POST_LINK");
|
|
|
|
t << endl << endl;
|
|
|
|
} else if(project->isEmpty("QMAKE_HPUX_SHLIB")) {
|
2014-04-23 14:26:26 +00:00
|
|
|
t << "\n\t";
|
|
|
|
|
|
|
|
if (!project->isActiveConfig("unversioned_libname"))
|
|
|
|
t << "-$(DEL_FILE) $(TARGET) $(TARGET0) $(TARGET1) $(TARGET2)";
|
|
|
|
else
|
|
|
|
t << "-$(DEL_FILE) $(TARGET)";
|
|
|
|
|
|
|
|
t << "\n\t" << var("QMAKE_LINK_SHLIB_CMD");
|
|
|
|
|
|
|
|
if (!project->isActiveConfig("unversioned_libname")) {
|
|
|
|
t << "\n\t"
|
|
|
|
<< varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET0)") << "\n\t"
|
|
|
|
<< varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET1)") << "\n\t"
|
|
|
|
<< varGlue("QMAKE_LN_SHLIB","-"," "," $(TARGET) $(TARGET2)");
|
|
|
|
}
|
|
|
|
if (!destdir.isEmpty()) {
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "\n\t"
|
|
|
|
<< "-$(DEL_FILE) " << destdir << "$(TARGET)\n\t"
|
2014-04-23 14:26:26 +00:00
|
|
|
<< "-$(MOVE) $(TARGET) " << destdir << " ";
|
|
|
|
|
|
|
|
if (!project->isActiveConfig("unversioned_libname")) {
|
|
|
|
t << "\n\t"
|
|
|
|
<< "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t"
|
|
|
|
<< "-$(DEL_FILE) " << destdir << "$(TARGET1)\n\t"
|
|
|
|
<< "-$(DEL_FILE) " << destdir << "$(TARGET2)\n\t"
|
|
|
|
<< "-$(MOVE) $(TARGET0) " << destdir << " \n\t"
|
|
|
|
<< "-$(MOVE) $(TARGET1) " << destdir << " \n\t"
|
|
|
|
<< "-$(MOVE) $(TARGET2) " << destdir << " ";
|
|
|
|
}
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_POST_LINK"))
|
|
|
|
t << "\n\t" << var("QMAKE_POST_LINK");
|
|
|
|
t << endl << endl;
|
|
|
|
} else {
|
|
|
|
t << "\n\t"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "-$(DEL_FILE) $(TARGET) $(TARGET0)\n\t"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< var("QMAKE_LINK_SHLIB_CMD") << "\n\t";
|
|
|
|
t << varGlue("QMAKE_LN_SHLIB",""," "," $(TARGET) $(TARGET0)");
|
|
|
|
if(!destdir.isEmpty())
|
|
|
|
t << "\n\t"
|
|
|
|
<< "-$(DEL_FILE) " << destdir << "$(TARGET)\n\t"
|
|
|
|
<< "-$(DEL_FILE) " << destdir << "$(TARGET0)\n\t"
|
2013-04-07 15:35:17 +00:00
|
|
|
<< "-$(MOVE) $(TARGET) " << destdir << " \n\t"
|
|
|
|
<< "-$(MOVE) $(TARGET0) " << destdir << " \n\t";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_POST_LINK"))
|
|
|
|
t << "\n\t" << var("QMAKE_POST_LINK");
|
|
|
|
t << endl << endl;
|
|
|
|
}
|
|
|
|
t << endl << endl;
|
|
|
|
|
|
|
|
if (! project->isActiveConfig("plugin")) {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "staticlib: $(TARGETA)\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "$(TARGETA): " << var("PRE_TARGETDEPS") << " $(OBJECTS) $(OBJCOMP)";
|
|
|
|
if(do_incremental)
|
|
|
|
t << " $(INCREMENTAL_OBJECTS)";
|
|
|
|
t << " " << var("POST_TARGETDEPS") << "\n\t"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "-$(DEL_FILE) $(TARGETA) \n\t"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< var("QMAKE_AR_CMD");
|
|
|
|
if(do_incremental)
|
|
|
|
t << " $(INCREMENTAL_OBJECTS)";
|
|
|
|
if(!project->isEmpty("QMAKE_RANLIB"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\n\t$(RANLIB) $(TARGETA)";
|
2011-04-27 10:05:43 +00:00
|
|
|
t << endl << endl;
|
|
|
|
}
|
|
|
|
} else {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString destdir = project->first("DESTDIR").toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "all: " << escapeDependencyPath(deps) << " " << valGlue(escapeDependencyPaths(project->values("ALL_DEPS")),""," "," ") << destdir << "$(TARGET) "
|
|
|
|
<< varGlue("QMAKE_AR_SUBLIBS", destdir, " " + destdir, "") << "\n\n"
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "staticlib: " << destdir << "$(TARGET)\n\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(project->isEmpty("QMAKE_AR_SUBLIBS")) {
|
|
|
|
t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS")
|
|
|
|
<< " $(OBJECTS) $(OBJCOMP) " << var("POST_TARGETDEPS") << "\n\t";
|
|
|
|
if(!destdir.isEmpty())
|
|
|
|
t << mkdir_p_asstring(destdir) << "\n\t";
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "-$(DEL_FILE) $(TARGET)\n\t"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< var("QMAKE_AR_CMD") << "\n";
|
|
|
|
if(!project->isEmpty("QMAKE_POST_LINK"))
|
|
|
|
t << "\t" << var("QMAKE_POST_LINK") << "\n";
|
|
|
|
if(!project->isEmpty("QMAKE_RANLIB"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t$(RANLIB) $(TARGET)\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!destdir.isEmpty())
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET)\n"
|
|
|
|
<< "\t-$(MOVE) $(TARGET) " << destdir << " \n";
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
|
|
|
int max_files = project->first("QMAKE_MAX_FILES_PER_AR").toInt();
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList objs = project->values("OBJECTS") + project->values("OBJCOMP"),
|
2011-04-27 10:05:43 +00:00
|
|
|
libs = project->values("QMAKE_AR_SUBLIBS");
|
|
|
|
libs.prepend("$(TARGET)");
|
2012-09-06 10:21:38 +00:00
|
|
|
for (ProStringList::Iterator libit = libs.begin(), objit = objs.begin();
|
|
|
|
libit != libs.end(); ++libit) {
|
|
|
|
ProStringList build;
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int cnt = 0; cnt < max_files && objit != objs.end(); ++objit, cnt++)
|
|
|
|
build << (*objit);
|
|
|
|
QString ar;
|
|
|
|
if((*libit) == "$(TARGET)") {
|
|
|
|
t << destdir << "$(TARGET): " << var("PRE_TARGETDEPS")
|
|
|
|
<< " " << var("POST_TARGETDEPS") << valList(build) << "\n\t";
|
2012-09-06 10:21:38 +00:00
|
|
|
ar = project->first("QMAKE_AR_CMD").toQString();
|
2012-05-18 18:00:23 +00:00
|
|
|
ar = ar.replace("$(OBJECTS)", build.join(' '));
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
|
|
|
t << (*libit) << ": " << valList(build) << "\n\t";
|
2012-05-18 18:00:23 +00:00
|
|
|
ar = "$(AR) " + (*libit) + " " + build.join(' ');
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(!destdir.isEmpty())
|
|
|
|
t << mkdir_p_asstring(destdir) << "\n\t";
|
|
|
|
t << "-$(DEL_FILE) " << (*libit) << "\n\t"
|
|
|
|
<< ar << "\n";
|
|
|
|
if(!project->isEmpty("QMAKE_POST_LINK"))
|
|
|
|
t << "\t" << var("QMAKE_POST_LINK") << "\n";
|
|
|
|
if(!project->isEmpty("QMAKE_RANLIB"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t$(RANLIB) " << (*libit) << "\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!destdir.isEmpty())
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t-$(DEL_FILE) " << destdir << (*libit) << "\n"
|
|
|
|
<< "\t-$(MOVE) " << (*libit) << " " << destdir << " \n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
t << endl << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
writeMakeQmake(t);
|
|
|
|
if(project->isEmpty("QMAKE_FAILED_REQUIREMENTS") && !project->isActiveConfig("no_autoqmake")) {
|
2012-12-21 19:48:14 +00:00
|
|
|
QStringList meta_files;
|
2011-04-27 10:05:43 +00:00
|
|
|
if(project->isActiveConfig("create_libtool") && project->first("TEMPLATE") == "lib" &&
|
|
|
|
!project->isActiveConfig("compile_libtool")) { //libtool
|
|
|
|
meta_files += libtoolFileName();
|
|
|
|
}
|
|
|
|
if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib") { //pkg-config
|
|
|
|
meta_files += pkgConfigFileName();
|
|
|
|
}
|
|
|
|
if(!meta_files.isEmpty())
|
2013-07-04 09:25:16 +00:00
|
|
|
t << escapeDependencyPaths(meta_files).join(" ") << ": \n\t"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< "@$(QMAKE) -prl " << buildArgs() << " " << project->projectFile() << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!project->first("QMAKE_PKGINFO").isEmpty()) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString pkginfo = escapeFilePath(project->first("QMAKE_PKGINFO"));
|
2013-11-20 17:16:54 +00:00
|
|
|
QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents";
|
2013-07-04 09:25:16 +00:00
|
|
|
t << pkginfo << ": \n\t";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!destdir.isEmpty())
|
|
|
|
t << mkdir_p_asstring(destdir) << "\n\t";
|
|
|
|
t << "@$(DEL_FILE) " << pkginfo << "\n\t"
|
|
|
|
<< "@echo \"APPL"
|
|
|
|
<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ? QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4))
|
|
|
|
<< "\" >" << pkginfo << endl;
|
|
|
|
}
|
|
|
|
if(!project->first("QMAKE_BUNDLE_RESOURCE_FILE").isEmpty()) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString resources = escapeFilePath(project->first("QMAKE_BUNDLE_RESOURCE_FILE"));
|
2013-07-11 13:43:32 +00:00
|
|
|
bundledFiles << resources;
|
2013-11-20 17:16:54 +00:00
|
|
|
QString destdir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources";
|
2013-07-04 09:25:16 +00:00
|
|
|
t << resources << ": \n\t";
|
2011-04-27 10:05:43 +00:00
|
|
|
t << mkdir_p_asstring(destdir) << "\n\t";
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "@touch " << resources << "\n\t\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(!project->isEmpty("QMAKE_BUNDLE")) {
|
|
|
|
//copy the plist
|
2012-09-06 10:21:38 +00:00
|
|
|
QString info_plist = escapeFilePath(fileFixify(project->first("QMAKE_INFO_PLIST").toQString())),
|
|
|
|
info_plist_out = escapeFilePath(project->first("QMAKE_INFO_PLIST_OUT").toQString());
|
2014-05-15 08:09:50 +00:00
|
|
|
if (info_plist.isEmpty())
|
|
|
|
info_plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
|
2013-07-11 13:43:32 +00:00
|
|
|
bundledFiles << info_plist_out;
|
2011-04-27 10:05:43 +00:00
|
|
|
QString destdir = info_plist_out.section(Option::dir_sep, 0, -2);
|
2013-07-04 09:25:16 +00:00
|
|
|
t << info_plist_out << ": \n\t";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!destdir.isEmpty())
|
2013-11-20 17:16:54 +00:00
|
|
|
t << mkdir_p_asstring(destdir, false) << "\n\t";
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList commonSedArgs;
|
2011-04-27 10:05:43 +00:00
|
|
|
if (!project->values("VERSION").isEmpty())
|
|
|
|
commonSedArgs << "-e \"s,@SHORT_VERSION@," << project->first("VER_MAJ") << "." << project->first("VER_MIN") << ",g\" ";
|
|
|
|
commonSedArgs << "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
|
|
|
|
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" ";
|
|
|
|
if(project->first("TEMPLATE") == "app") {
|
|
|
|
QString icon = fileFixify(var("ICON"));
|
2014-02-18 09:02:26 +00:00
|
|
|
QString bundlePrefix = project->first("QMAKE_TARGET_BUNDLE_PREFIX").toQString();
|
|
|
|
if (bundlePrefix.isEmpty())
|
2014-05-23 09:02:08 +00:00
|
|
|
bundlePrefix = "com.yourcompany";
|
|
|
|
if (bundlePrefix.endsWith("."))
|
|
|
|
bundlePrefix.chop(1);
|
|
|
|
QString bundleIdentifier = bundlePrefix + "." + var("QMAKE_BUNDLE");
|
2014-01-15 13:34:39 +00:00
|
|
|
if (bundleIdentifier.endsWith(".app"))
|
|
|
|
bundleIdentifier.chop(4);
|
2011-04-27 10:05:43 +00:00
|
|
|
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
|
|
|
|
<< "@sed ";
|
2012-09-06 10:21:38 +00:00
|
|
|
foreach (const ProString &arg, commonSedArgs)
|
2011-04-27 10:05:43 +00:00
|
|
|
t << arg;
|
|
|
|
t << "-e \"s,@ICON@," << icon.section(Option::dir_sep, -1) << ",g\" "
|
2014-01-15 13:34:39 +00:00
|
|
|
<< "-e \"s,@BUNDLEIDENTIFIER@," << bundleIdentifier << ",g\" "
|
2011-04-27 10:05:43 +00:00
|
|
|
<< "-e \"s,@EXECUTABLE@," << var("QMAKE_ORIG_TARGET") << ",g\" "
|
|
|
|
<< "-e \"s,@TYPEINFO@,"<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
|
|
|
|
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
|
|
|
|
<< "" << info_plist << " >" << info_plist_out << endl;
|
|
|
|
//copy the icon
|
|
|
|
if(!project->isEmpty("ICON")) {
|
|
|
|
QString dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/Contents/Resources/";
|
|
|
|
const QString icon_path = escapeFilePath(dir + icon.section(Option::dir_sep, -1));
|
2013-07-11 13:43:32 +00:00
|
|
|
bundledFiles << icon_path;
|
2011-04-27 10:05:43 +00:00
|
|
|
t << icon_path << ": " << icon << "\n\t"
|
|
|
|
<< mkdir_p_asstring(dir) << "\n\t"
|
|
|
|
<< "@$(DEL_FILE) " << icon_path << "\n\t"
|
|
|
|
<< "@$(COPY_FILE) " << escapeFilePath(icon) << " " << icon_path << endl;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
t << "@$(DEL_FILE) " << info_plist_out << "\n\t"
|
|
|
|
<< "@sed ";
|
2012-09-06 10:21:38 +00:00
|
|
|
foreach (const ProString &arg, commonSedArgs)
|
2011-04-27 10:05:43 +00:00
|
|
|
t << arg;
|
|
|
|
t << "-e \"s,@LIBRARY@," << var("QMAKE_ORIG_TARGET") << ",g\" "
|
|
|
|
<< "-e \"s,@TYPEINFO@,"
|
|
|
|
<< (project->isEmpty("QMAKE_PKGINFO_TYPEINFO") ?
|
|
|
|
QString::fromLatin1("????") : project->first("QMAKE_PKGINFO_TYPEINFO").left(4)) << ",g\" "
|
|
|
|
<< "" << info_plist << " >" << info_plist_out << endl;
|
|
|
|
}
|
|
|
|
//copy other data
|
|
|
|
if(!project->isEmpty("QMAKE_BUNDLE_DATA")) {
|
|
|
|
QString bundle_dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/";
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int i = 0; i < bundle_data.count(); i++) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files"));
|
2011-04-27 10:05:43 +00:00
|
|
|
QString path = bundle_dir;
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProKey vkey(bundle_data[i] + ".version");
|
|
|
|
const ProKey pkey(bundle_data[i] + ".path");
|
|
|
|
if (!project->isEmpty(vkey)) {
|
|
|
|
QString version = project->first(vkey) + "/" +
|
2011-04-27 10:05:43 +00:00
|
|
|
project->first("QMAKE_FRAMEWORK_VERSION") + "/";
|
2013-07-11 13:43:32 +00:00
|
|
|
QString link = Option::fixPathToLocalOS(path + project->first(pkey));
|
|
|
|
bundledFiles << link;
|
|
|
|
t << link << ": \n\t"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< mkdir_p_asstring(path) << "\n\t"
|
2012-09-06 10:21:38 +00:00
|
|
|
<< "@$(SYMLINK) " << version << project->first(pkey) << " " << path << endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
path += version;
|
|
|
|
}
|
2012-09-06 10:21:38 +00:00
|
|
|
path += project->first(pkey).toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
path = Option::fixPathToLocalOS(path);
|
|
|
|
for(int file = 0; file < files.count(); file++) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString fn = files.at(file).toQString();
|
|
|
|
QString src = fileFixify(fn, FileFixifyAbsolute);
|
2011-04-27 10:05:43 +00:00
|
|
|
if (!QFile::exists(src))
|
2012-09-06 10:21:38 +00:00
|
|
|
src = fn;
|
2011-04-27 10:05:43 +00:00
|
|
|
src = escapeFilePath(src);
|
2012-09-06 10:21:38 +00:00
|
|
|
const QString dst = escapeFilePath(path + Option::dir_sep + fileInfo(fn).fileName());
|
2013-07-11 13:43:32 +00:00
|
|
|
bundledFiles << dst;
|
2011-04-27 10:05:43 +00:00
|
|
|
t << dst << ": " << src << "\n\t"
|
|
|
|
<< mkdir_p_asstring(path) << "\n\t";
|
2012-09-06 10:21:38 +00:00
|
|
|
QFileInfo fi(fileInfo(fn));
|
2011-04-27 10:05:43 +00:00
|
|
|
if(fi.isDir())
|
|
|
|
t << "@$(DEL_FILE) -r " << dst << "\n\t"
|
|
|
|
<< "@$(COPY_DIR) " << src << " " << dst << endl;
|
|
|
|
else
|
|
|
|
t << "@$(DEL_FILE) " << dst << "\n\t"
|
|
|
|
<< "@$(COPY_FILE) " << src << " " << dst << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-17 17:26:00 +00:00
|
|
|
t << "dist: distdir FORCE\n\t";
|
|
|
|
t << "(cd `dirname $(DISTDIR)` && $(TAR) $(DISTNAME).tar $(DISTNAME) && $(COMPRESS) $(DISTNAME).tar)"
|
|
|
|
" && $(MOVE) `dirname $(DISTDIR)`" << Option::dir_sep << "$(DISTNAME).tar.gz ."
|
|
|
|
" && $(DEL_FILE) -r $(DISTDIR)";
|
|
|
|
t << endl << endl;
|
|
|
|
|
|
|
|
t << "distdir: FORCE\n\t"
|
|
|
|
<< mkdir_p_asstring("$(DISTDIR)", false) << "\n\t"
|
|
|
|
<< "$(COPY_FILE) --parents $(DIST) $(DISTDIR)" << Option::dir_sep << endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_EXTRA_COMPILERS")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &quc = project->values("QMAKE_EXTRA_COMPILERS");
|
|
|
|
for (ProStringList::ConstIterator it = quc.begin(); it != quc.end(); ++it) {
|
|
|
|
const ProStringList &var = project->values(ProKey(*it + ".input"));
|
|
|
|
for (ProStringList::ConstIterator var_it = var.begin(); var_it != var.end(); ++var_it) {
|
|
|
|
const ProStringList &val = project->values((*var_it).toKey());
|
2011-04-27 10:05:43 +00:00
|
|
|
if(val.isEmpty())
|
|
|
|
continue;
|
2014-01-17 17:26:00 +00:00
|
|
|
t << "\t$(COPY_FILE) --parents " << val.join(' ') << " $(DISTDIR)" << Option::dir_sep << endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!project->isEmpty("TRANSLATIONS"))
|
2014-01-17 17:26:00 +00:00
|
|
|
t << "\t$(COPY_FILE) --parents " << var("TRANSLATIONS") << " $(DISTDIR)" << Option::dir_sep << endl;
|
|
|
|
t << endl << endl;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QString clean_targets = "compiler_clean " + var("CLEAN_DEPS");
|
|
|
|
if(do_incremental) {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "incrclean:\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
if(src_incremental)
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t-$(DEL_FILE) $(INCREMENTAL_OBJECTS)\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
t << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
t << "clean:" << clean_targets << "\n\t";
|
|
|
|
if(!project->isEmpty("OBJECTS")) {
|
|
|
|
if(project->isActiveConfig("compile_libtool"))
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "-$(LIBTOOL) --mode=clean $(DEL_FILE) $(OBJECTS)\n\t";
|
2011-04-27 10:05:43 +00:00
|
|
|
else
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "-$(DEL_FILE) $(OBJECTS)\n\t";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList precomp_files;
|
|
|
|
ProString precomph_out_dir;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
if(!project->isEmpty("PRECOMPILED_DIR"))
|
|
|
|
precomph_out_dir = project->first("PRECOMPILED_DIR");
|
|
|
|
precomph_out_dir += project->first("QMAKE_ORIG_TARGET");
|
|
|
|
if (!project->isActiveConfig("clang_pch_style"))
|
|
|
|
precomph_out_dir += project->first("QMAKE_PCH_OUTPUT_EXT");
|
|
|
|
|
|
|
|
if (project->isActiveConfig("icc_pch_style")) {
|
|
|
|
// icc style
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString pchBaseName = project->first("QMAKE_ORIG_TARGET");
|
|
|
|
ProString pchOutput;
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("PRECOMPILED_DIR"))
|
|
|
|
pchOutput = project->first("PRECOMPILED_DIR");
|
|
|
|
pchOutput += pchBaseName + project->first("QMAKE_PCH_OUTPUT_EXT");
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString sourceFile = pchOutput + Option::cpp_ext.first();
|
|
|
|
ProString objectFile = createObjectList(ProStringList(sourceFile)).first();
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
precomp_files << precomph_out_dir << sourceFile << objectFile;
|
|
|
|
} else {
|
|
|
|
// gcc style (including clang_pch_style)
|
|
|
|
precomph_out_dir += Option::dir_sep;
|
|
|
|
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString header_prefix = project->first("QMAKE_PRECOMP_PREFIX");
|
|
|
|
ProString header_suffix = project->isActiveConfig("clang_pch_style")
|
2011-04-27 10:05:43 +00:00
|
|
|
? project->first("QMAKE_PCH_OUTPUT_EXT") : "";
|
|
|
|
|
|
|
|
if(!project->isEmpty("QMAKE_CFLAGS_PRECOMPILE"))
|
|
|
|
precomp_files += precomph_out_dir + header_prefix + "c" + header_suffix;
|
|
|
|
if(!project->isEmpty("QMAKE_CXXFLAGS_PRECOMPILE"))
|
|
|
|
precomp_files += precomph_out_dir + header_prefix + "c++" + header_suffix;
|
|
|
|
if(project->isActiveConfig("objective_c")) {
|
|
|
|
if(!project->isEmpty("QMAKE_OBJCFLAGS_PRECOMPILE"))
|
|
|
|
precomp_files += precomph_out_dir + header_prefix + "objective-c" + header_suffix;
|
|
|
|
if(!project->isEmpty("QMAKE_OBJCXXFLAGS_PRECOMPILE"))
|
|
|
|
precomp_files += precomph_out_dir + header_prefix + "objective-c++" + header_suffix;
|
|
|
|
}
|
|
|
|
}
|
2012-05-18 18:00:23 +00:00
|
|
|
t << "-$(DEL_FILE) " << precomp_files.join(' ') << "\n\t";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(!project->isEmpty("IMAGES"))
|
|
|
|
t << varGlue("QMAKE_IMAGE_COLLECTION", "\t-$(DEL_FILE) ", " ", "") << "\n\t";
|
|
|
|
if(src_incremental)
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "-$(DEL_FILE) $(INCREMENTAL_OBJECTS)\n\t";
|
2011-04-27 10:05:43 +00:00
|
|
|
t << varGlue("QMAKE_CLEAN","-$(DEL_FILE) "," ","\n\t")
|
2013-07-04 09:25:16 +00:00
|
|
|
<< "-$(DEL_FILE) *~ core *.core\n"
|
2011-04-27 10:05:43 +00:00
|
|
|
<< varGlue("CLEAN_FILES","\t-$(DEL_FILE) "," ","") << endl << endl;
|
|
|
|
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString destdir = project->first("DESTDIR");
|
|
|
|
if (!destdir.isEmpty() && !destdir.endsWith(Option::dir_sep))
|
2011-04-27 10:05:43 +00:00
|
|
|
destdir += Option::dir_sep;
|
2014-01-29 14:19:51 +00:00
|
|
|
t << "distclean: clean " << var("DISTCLEAN_DEPS") << '\n';
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_BUNDLE")) {
|
|
|
|
QString bundlePath = escapeFilePath(destdir + project->first("QMAKE_BUNDLE"));
|
|
|
|
t << "\t-$(DEL_FILE) -r " << bundlePath << endl;
|
|
|
|
} else if(project->isActiveConfig("compile_libtool")) {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t-$(LIBTOOL) --mode=clean $(DEL_FILE) $(TARGET)\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
} else if(!project->isActiveConfig("staticlib") && project->values("QMAKE_APP_FLAG").isEmpty() &&
|
|
|
|
!project->isActiveConfig("plugin")) {
|
2013-07-04 09:25:16 +00:00
|
|
|
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n";
|
2014-04-23 14:26:26 +00:00
|
|
|
if (!project->isActiveConfig("unversioned_libname")) {
|
|
|
|
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET0) " << destdir << "$(TARGET1) "
|
|
|
|
<< destdir << "$(TARGET2) $(TARGETA)\n";
|
|
|
|
} else {
|
|
|
|
t << "\t-$(DEL_FILE) $(TARGETA)\n";
|
|
|
|
}
|
2011-04-27 10:05:43 +00:00
|
|
|
} else {
|
2013-11-22 13:31:28 +00:00
|
|
|
t << "\t-$(DEL_FILE) " << destdir << "$(TARGET) \n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
t << varGlue("QMAKE_DISTCLEAN","\t-$(DEL_FILE) "," ","\n");
|
|
|
|
{
|
|
|
|
QString ofile = Option::fixPathToTargetOS(fileFixify(Option::output.fileName()));
|
|
|
|
if(!ofile.isEmpty())
|
|
|
|
t << "\t-$(DEL_FILE) " << ofile << endl;
|
|
|
|
}
|
|
|
|
t << endl << endl;
|
|
|
|
|
2013-12-11 03:27:39 +00:00
|
|
|
t << "####### Sub-libraries\n\n";
|
|
|
|
if (!project->values("SUBLIBS").isEmpty()) {
|
|
|
|
ProString libdir = "tmp/";
|
|
|
|
if (!project->isEmpty("SUBLIBS_DIR"))
|
|
|
|
libdir = project->first("SUBLIBS_DIR");
|
|
|
|
const ProStringList &l = project->values("SUBLIBS");
|
|
|
|
for (it = l.begin(); it != l.end(); ++it)
|
|
|
|
t << libdir << project->first("QMAKE_PREFIX_STATICLIB") << (*it) << "."
|
|
|
|
<< project->first("QMAKE_EXTENSION_STATICLIB") << ":\n\t"
|
|
|
|
<< var(ProKey("MAKELIB" + *it)) << endl << endl;
|
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
if(doPrecompiledHeaders() && !project->isEmpty("PRECOMPILED_HEADER")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString pchInput = project->first("PRECOMPILED_HEADER").toQString();
|
2013-12-11 03:28:26 +00:00
|
|
|
t << "###### Precompiled headers\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
QString comps[] = { "C", "CXX", "OBJC", "OBJCXX", QString() };
|
|
|
|
for(int i = 0; !comps[i].isNull(); i++) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString pchFlags = var(ProKey("QMAKE_" + comps[i] + "FLAGS_PRECOMPILE"));
|
2011-04-27 10:05:43 +00:00
|
|
|
if(pchFlags.isEmpty())
|
|
|
|
continue;
|
|
|
|
|
|
|
|
QString cflags;
|
|
|
|
if(comps[i] == "OBJC" || comps[i] == "OBJCXX")
|
|
|
|
cflags += " $(CFLAGS)";
|
|
|
|
else
|
|
|
|
cflags += " $(" + comps[i] + "FLAGS)";
|
|
|
|
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString pchBaseName = project->first("QMAKE_ORIG_TARGET");
|
|
|
|
ProString pchOutput;
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("PRECOMPILED_DIR"))
|
|
|
|
pchOutput = project->first("PRECOMPILED_DIR");
|
|
|
|
pchOutput += pchBaseName;
|
|
|
|
if (!project->isActiveConfig("clang_pch_style"))
|
|
|
|
pchOutput += project->first("QMAKE_PCH_OUTPUT_EXT");
|
|
|
|
|
|
|
|
if (project->isActiveConfig("icc_pch_style")) {
|
|
|
|
// icc style
|
|
|
|
QString sourceFile = pchOutput + Option::cpp_ext.first();
|
2012-09-06 10:21:38 +00:00
|
|
|
QString objectFile = createObjectList(ProStringList(sourceFile)).first().toQString();
|
2011-04-27 10:05:43 +00:00
|
|
|
t << pchOutput << ": " << pchInput << " " << findDependencies(pchInput).join(" \\\n\t\t")
|
|
|
|
<< "\n\techo \"// Automatically generated, do not modify\" > " << sourceFile
|
|
|
|
<< "\n\trm -f " << pchOutput;
|
|
|
|
|
|
|
|
pchFlags = pchFlags.replace("${QMAKE_PCH_TEMP_SOURCE}", sourceFile)
|
|
|
|
.replace("${QMAKE_PCH_TEMP_OBJECT}", objectFile);
|
|
|
|
} else {
|
|
|
|
// gcc style (including clang_pch_style)
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString header_prefix = project->first("QMAKE_PRECOMP_PREFIX");
|
|
|
|
ProString header_suffix = project->isActiveConfig("clang_pch_style")
|
2011-04-27 10:05:43 +00:00
|
|
|
? project->first("QMAKE_PCH_OUTPUT_EXT") : "";
|
|
|
|
pchOutput += Option::dir_sep;
|
2012-09-06 10:21:38 +00:00
|
|
|
QString pchOutputDir = pchOutput.toQString(), pchOutputFile;
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
if(comps[i] == "C") {
|
|
|
|
pchOutputFile = "c";
|
|
|
|
} else if(comps[i] == "CXX") {
|
|
|
|
pchOutputFile = "c++";
|
|
|
|
} else if(project->isActiveConfig("objective_c")) {
|
|
|
|
if(comps[i] == "OBJC")
|
|
|
|
pchOutputFile = "objective-c";
|
|
|
|
else if(comps[i] == "OBJCXX")
|
|
|
|
pchOutputFile = "objective-c++";
|
|
|
|
}
|
|
|
|
if(pchOutputFile.isEmpty())
|
|
|
|
continue;
|
|
|
|
pchOutput += header_prefix + pchOutputFile + header_suffix;
|
|
|
|
|
|
|
|
t << pchOutput << ": " << pchInput << " " << findDependencies(pchInput).join(" \\\n\t\t")
|
|
|
|
<< "\n\t" << mkdir_p_asstring(pchOutputDir);
|
|
|
|
}
|
|
|
|
pchFlags = pchFlags.replace("${QMAKE_PCH_INPUT}", pchInput)
|
2012-09-06 10:21:38 +00:00
|
|
|
.replace("${QMAKE_PCH_OUTPUT_BASE}", pchBaseName.toQString())
|
|
|
|
.replace("${QMAKE_PCH_OUTPUT}", pchOutput.toQString());
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
QString compiler;
|
|
|
|
if(comps[i] == "C" || comps[i] == "OBJC" || comps[i] == "OBJCXX")
|
|
|
|
compiler = "$(CC)";
|
|
|
|
else
|
|
|
|
compiler = "$(CXX)";
|
|
|
|
|
|
|
|
// compile command
|
|
|
|
t << "\n\t" << compiler << cflags << " $(INCPATH) " << pchFlags << endl << endl;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
writeExtraTargets(t);
|
|
|
|
writeExtraCompilerTargets(t);
|
|
|
|
}
|
|
|
|
|
|
|
|
void UnixMakefileGenerator::init2()
|
|
|
|
{
|
|
|
|
if(project->isEmpty("QMAKE_FRAMEWORK_VERSION"))
|
|
|
|
project->values("QMAKE_FRAMEWORK_VERSION").append(project->values("VER_MAJ").first());
|
|
|
|
|
2011-05-03 13:30:28 +00:00
|
|
|
if (project->values("TEMPLATE").first() == "aux")
|
|
|
|
return;
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
|
|
|
|
if(!project->isEmpty("QMAKE_BUNDLE")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION");
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!bundle_loc.isEmpty() && !bundle_loc.startsWith("/"))
|
|
|
|
bundle_loc.prepend("/");
|
|
|
|
if(!bundle_loc.endsWith("/"))
|
|
|
|
bundle_loc += "/";
|
|
|
|
project->values("TARGET").first().prepend(project->first("QMAKE_BUNDLE") + bundle_loc);
|
|
|
|
}
|
|
|
|
if(!project->isEmpty("TARGET"))
|
|
|
|
project->values("TARGET").first().prepend(project->first("DESTDIR"));
|
|
|
|
if (!project->values("QMAKE_CYGWIN_EXE").isEmpty())
|
|
|
|
project->values("TARGET_EXT").append(".exe");
|
|
|
|
} else if (project->isActiveConfig("staticlib")) {
|
|
|
|
project->values("TARGET").first().prepend(project->first("QMAKE_PREFIX_STATICLIB"));
|
|
|
|
project->values("TARGET").first() += "." + project->first("QMAKE_EXTENSION_STATICLIB");
|
|
|
|
if(project->values("QMAKE_AR_CMD").isEmpty())
|
|
|
|
project->values("QMAKE_AR_CMD").append("$(AR) $(TARGET) $(OBJECTS)");
|
|
|
|
} else {
|
|
|
|
project->values("TARGETA").append(project->first("DESTDIR") + project->first("QMAKE_PREFIX_STATICLIB")
|
|
|
|
+ project->first("TARGET") + "." + project->first("QMAKE_EXTENSION_STATICLIB"));
|
|
|
|
if(project->isActiveConfig("compile_libtool"))
|
2012-09-06 10:21:38 +00:00
|
|
|
project->values("TARGET_la") = ProStringList(project->first("DESTDIR") + "lib" + project->first("TARGET") + Option::libtool_ext);
|
2011-04-27 10:05:43 +00:00
|
|
|
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList &ar_cmd = project->values("QMAKE_AR_CMD");
|
|
|
|
if (!ar_cmd.isEmpty())
|
|
|
|
ar_cmd[0] = ar_cmd.at(0).toQString().replace("(TARGET)","(TARGETA)");
|
2011-04-27 10:05:43 +00:00
|
|
|
else
|
2012-09-06 10:21:38 +00:00
|
|
|
ar_cmd.append("$(AR) $(TARGETA) $(OBJECTS)");
|
2011-04-27 10:05:43 +00:00
|
|
|
if(project->isActiveConfig("compile_libtool")) {
|
|
|
|
project->values("TARGET") = project->values("TARGET_la");
|
|
|
|
} else if(!project->isEmpty("QMAKE_BUNDLE")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString bundle_loc = project->first("QMAKE_BUNDLE_LOCATION");
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!bundle_loc.isEmpty() && !bundle_loc.startsWith("/"))
|
|
|
|
bundle_loc.prepend("/");
|
|
|
|
if(!bundle_loc.endsWith("/"))
|
|
|
|
bundle_loc += "/";
|
|
|
|
project->values("TARGET_").append(project->first("QMAKE_BUNDLE") +
|
|
|
|
bundle_loc + unescapeFilePath(project->first("TARGET")));
|
|
|
|
project->values("TARGET_x.y").append(project->first("QMAKE_BUNDLE") +
|
|
|
|
"/Versions/" +
|
|
|
|
project->first("QMAKE_FRAMEWORK_VERSION") +
|
|
|
|
bundle_loc + unescapeFilePath(project->first("TARGET")));
|
|
|
|
} else if(project->isActiveConfig("plugin")) {
|
|
|
|
QString prefix;
|
|
|
|
if(!project->isActiveConfig("no_plugin_name_prefix"))
|
|
|
|
prefix = "lib";
|
|
|
|
project->values("TARGET_x.y.z").append(prefix +
|
|
|
|
project->first("TARGET") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_PLUGIN"));
|
|
|
|
if(project->isActiveConfig("lib_version_first"))
|
|
|
|
project->values("TARGET_x").append(prefix + project->first("TARGET") + "." +
|
|
|
|
project->first("VER_MAJ") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_PLUGIN"));
|
|
|
|
else
|
|
|
|
project->values("TARGET_x").append(prefix + project->first("TARGET") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_PLUGIN") +
|
|
|
|
"." + project->first("VER_MAJ"));
|
|
|
|
project->values("TARGET") = project->values("TARGET_x.y.z");
|
|
|
|
} else if (!project->isEmpty("QMAKE_HPUX_SHLIB")) {
|
|
|
|
project->values("TARGET_").append("lib" + project->first("TARGET") + ".sl");
|
|
|
|
if(project->isActiveConfig("lib_version_first"))
|
|
|
|
project->values("TARGET_x").append("lib" + project->first("VER_MAJ") + "." +
|
|
|
|
project->first("TARGET"));
|
|
|
|
else
|
|
|
|
project->values("TARGET_x").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("VER_MAJ"));
|
|
|
|
project->values("TARGET") = project->values("TARGET_x");
|
|
|
|
} else if (!project->isEmpty("QMAKE_AIX_SHLIB")) {
|
|
|
|
project->values("TARGET_").append(project->first("QMAKE_PREFIX_STATICLIB") + project->first("TARGET")
|
|
|
|
+ "." + project->first("QMAKE_EXTENSION_STATICLIB"));
|
|
|
|
if(project->isActiveConfig("lib_version_first")) {
|
|
|
|
project->values("TARGET_x").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("VER_MAJ") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_SHLIB"));
|
|
|
|
project->values("TARGET_x.y").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("VER_MAJ") +
|
|
|
|
"." + project->first("VER_MIN") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_SHLIB"));
|
|
|
|
project->values("TARGET_x.y.z").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("VER_MAJ") + "." +
|
|
|
|
project->first("VER_MIN") + "." +
|
|
|
|
project->first("VER_PAT") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_SHLIB"));
|
|
|
|
} else {
|
|
|
|
project->values("TARGET_x").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_SHLIB") +
|
|
|
|
"." + project->first("VER_MAJ"));
|
|
|
|
project->values("TARGET_x.y").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_SHLIB") +
|
|
|
|
"." + project->first("VER_MAJ") +
|
|
|
|
"." + project->first("VER_MIN"));
|
|
|
|
project->values("TARGET_x.y.z").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_SHLIB") + "." +
|
|
|
|
project->first("VER_MAJ") + "." +
|
|
|
|
project->first("VER_MIN") + "." +
|
|
|
|
project->first("VER_PAT"));
|
|
|
|
}
|
|
|
|
project->values("TARGET") = project->values("TARGET_x.y.z");
|
|
|
|
} else {
|
|
|
|
project->values("TARGET_").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_SHLIB"));
|
|
|
|
if(project->isActiveConfig("lib_version_first")) {
|
|
|
|
project->values("TARGET_x").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("VER_MAJ") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_SHLIB"));
|
|
|
|
project->values("TARGET_x.y").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("VER_MAJ") +
|
|
|
|
"." + project->first("VER_MIN") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_SHLIB"));
|
|
|
|
project->values("TARGET_x.y.z").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("VER_MAJ") + "." +
|
|
|
|
project->first("VER_MIN") + "." +
|
|
|
|
project->first("VER_PAT") + "." +
|
|
|
|
project->values("QMAKE_EXTENSION_SHLIB").first());
|
|
|
|
} else {
|
|
|
|
project->values("TARGET_x").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_SHLIB") +
|
|
|
|
"." + project->first("VER_MAJ"));
|
|
|
|
project->values("TARGET_x.y").append("lib" + project->first("TARGET") + "." +
|
|
|
|
project->first("QMAKE_EXTENSION_SHLIB")
|
|
|
|
+ "." + project->first("VER_MAJ") +
|
|
|
|
"." + project->first("VER_MIN"));
|
|
|
|
project->values("TARGET_x.y.z").append("lib" + project->first("TARGET") +
|
|
|
|
"." +
|
|
|
|
project->values(
|
|
|
|
"QMAKE_EXTENSION_SHLIB").first() + "." +
|
|
|
|
project->first("VER_MAJ") + "." +
|
|
|
|
project->first("VER_MIN") + "." +
|
|
|
|
project->first("VER_PAT"));
|
|
|
|
}
|
2014-04-23 14:26:26 +00:00
|
|
|
if (project->isActiveConfig("unversioned_libname"))
|
|
|
|
project->values("TARGET") = project->values("TARGET_");
|
|
|
|
else
|
|
|
|
project->values("TARGET") = project->values("TARGET_x.y.z");
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if(project->isEmpty("QMAKE_LN_SHLIB"))
|
|
|
|
project->values("QMAKE_LN_SHLIB").append("ln -s");
|
|
|
|
if (!project->values("QMAKE_LFLAGS_SONAME").isEmpty()) {
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString soname;
|
2011-04-27 10:05:43 +00:00
|
|
|
if(project->isActiveConfig("plugin")) {
|
|
|
|
if(!project->values("TARGET").isEmpty())
|
|
|
|
soname += project->first("TARGET");
|
|
|
|
} else if(!project->isEmpty("QMAKE_BUNDLE")) {
|
|
|
|
soname += project->first("TARGET_x.y");
|
2013-07-22 11:09:21 +00:00
|
|
|
} else if(project->isActiveConfig("unversioned_soname")) {
|
|
|
|
soname = "lib" + project->first("QMAKE_ORIG_TARGET")
|
|
|
|
+ "." + project->first("QMAKE_EXTENSION_SHLIB");
|
2011-04-27 10:05:43 +00:00
|
|
|
} else if(!project->values("TARGET_x").isEmpty()) {
|
|
|
|
soname += project->first("TARGET_x");
|
|
|
|
}
|
|
|
|
if(!soname.isEmpty()) {
|
|
|
|
if(project->isActiveConfig("absolute_library_soname") &&
|
|
|
|
project->values("INSTALLS").indexOf("target") != -1 &&
|
|
|
|
!project->isEmpty("target.path")) {
|
2012-09-06 10:21:38 +00:00
|
|
|
QString instpath = Option::fixPathToTargetOS(project->first("target.path").toQString());
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!instpath.endsWith(Option::dir_sep))
|
|
|
|
instpath += Option::dir_sep;
|
|
|
|
soname.prepend(instpath);
|
|
|
|
}
|
|
|
|
project->values("QMAKE_LFLAGS_SONAME").first() += escapeFilePath(soname);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (project->values("QMAKE_LINK_SHLIB_CMD").isEmpty())
|
|
|
|
project->values("QMAKE_LINK_SHLIB_CMD").append(
|
2013-01-30 14:58:00 +00:00
|
|
|
"$(LINK) $(LFLAGS) " + project->first("QMAKE_LINK_O_FLAG") + "$(TARGET) $(OBJECTS) $(LIBS) $(OBJCOMP)");
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
if (!project->values("QMAKE_APP_FLAG").isEmpty()) {
|
|
|
|
project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_APP");
|
|
|
|
project->values("QMAKE_CXXFLAGS") += project->values("QMAKE_CXXFLAGS_APP");
|
|
|
|
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_APP");
|
|
|
|
} else if (project->isActiveConfig("dll")) {
|
|
|
|
if(!project->isActiveConfig("plugin") || !project->isActiveConfig("plugin_no_share_shlib_cflags")) {
|
|
|
|
project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_SHLIB");
|
|
|
|
project->values("QMAKE_CXXFLAGS") += project->values("QMAKE_CXXFLAGS_SHLIB");
|
|
|
|
}
|
|
|
|
if (project->isActiveConfig("plugin")) {
|
|
|
|
project->values("QMAKE_CFLAGS") += project->values("QMAKE_CFLAGS_PLUGIN");
|
|
|
|
project->values("QMAKE_CXXFLAGS") += project->values("QMAKE_CXXFLAGS_PLUGIN");
|
|
|
|
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_PLUGIN");
|
|
|
|
if(project->isActiveConfig("plugin_with_soname") && !project->isActiveConfig("compile_libtool"))
|
|
|
|
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_SONAME");
|
|
|
|
} else {
|
|
|
|
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_SHLIB");
|
|
|
|
if(!project->isEmpty("QMAKE_LFLAGS_COMPAT_VERSION")) {
|
|
|
|
if(project->isEmpty("COMPAT_VERSION"))
|
|
|
|
project->values("QMAKE_LFLAGS") += QString(project->first("QMAKE_LFLAGS_COMPAT_VERSION") +
|
|
|
|
project->first("VER_MAJ") + "." +
|
|
|
|
project->first("VER_MIN"));
|
|
|
|
else
|
|
|
|
project->values("QMAKE_LFLAGS") += QString(project->first("QMAKE_LFLAGS_COMPAT_VERSION") +
|
|
|
|
project->first("COMPATIBILITY_VERSION"));
|
|
|
|
}
|
|
|
|
if(!project->isEmpty("QMAKE_LFLAGS_VERSION")) {
|
|
|
|
project->values("QMAKE_LFLAGS") += QString(project->first("QMAKE_LFLAGS_VERSION") +
|
|
|
|
project->first("VER_MAJ") + "." +
|
|
|
|
project->first("VER_MIN") + "." +
|
|
|
|
project->first("VER_PAT"));
|
|
|
|
}
|
|
|
|
if(!project->isActiveConfig("compile_libtool"))
|
|
|
|
project->values("QMAKE_LFLAGS") += project->values("QMAKE_LFLAGS_SONAME");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-24 11:37:30 +00:00
|
|
|
if (include_deps && project->isActiveConfig("gcc_MD_depends")) {
|
2013-12-11 04:10:10 +00:00
|
|
|
// use -MMD if we know about -isystem too
|
|
|
|
ProString MD_flag(project->values("QMAKE_CFLAGS_ISYSTEM").isEmpty() ? "-MD" : "-MMD");
|
|
|
|
project->values("QMAKE_CFLAGS") += MD_flag;
|
|
|
|
project->values("QMAKE_CXXFLAGS") += MD_flag;
|
2011-10-24 11:37:30 +00:00
|
|
|
}
|
|
|
|
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_BUNDLE")) {
|
2012-11-19 13:58:10 +00:00
|
|
|
QString plist = fileFixify(project->first("QMAKE_INFO_PLIST").toQString(), qmake_getpwd());
|
2011-04-27 10:05:43 +00:00
|
|
|
if(plist.isEmpty())
|
|
|
|
plist = specdir() + QDir::separator() + "Info.plist." + project->first("TEMPLATE");
|
|
|
|
if(exists(Option::fixPathToLocalOS(plist))) {
|
|
|
|
project->values("QMAKE_INFO_PLIST_OUT").append(project->first("DESTDIR") +
|
|
|
|
project->first("QMAKE_BUNDLE") +
|
|
|
|
"/Contents/Info.plist");
|
|
|
|
project->values("ALL_DEPS") += project->first("QMAKE_INFO_PLIST_OUT");
|
|
|
|
if(!project->isEmpty("ICON") && project->first("TEMPLATE") == "app")
|
|
|
|
project->values("ALL_DEPS") += project->first("DESTDIR") +
|
|
|
|
project->first("QMAKE_BUNDLE") +
|
2012-09-06 10:21:38 +00:00
|
|
|
"/Contents/Resources/" + project->first("ICON").toQString().section('/', -1);
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_BUNDLE_DATA")) {
|
|
|
|
QString bundle_dir = project->first("DESTDIR") + project->first("QMAKE_BUNDLE") + "/";
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList &alldeps = project->values("ALL_DEPS");
|
|
|
|
const ProStringList &bundle_data = project->values("QMAKE_BUNDLE_DATA");
|
2011-04-27 10:05:43 +00:00
|
|
|
for(int i = 0; i < bundle_data.count(); i++) {
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProStringList &files = project->values(ProKey(bundle_data[i] + ".files"));
|
2011-04-27 10:05:43 +00:00
|
|
|
QString path = bundle_dir;
|
2012-09-06 10:21:38 +00:00
|
|
|
const ProKey vkey(bundle_data[i] + ".version");
|
|
|
|
const ProKey pkey(bundle_data[i] + ".path");
|
|
|
|
if (!project->isEmpty(vkey)) {
|
|
|
|
alldeps += Option::fixPathToLocalOS(path + Option::dir_sep + project->first(pkey));
|
|
|
|
path += project->first(vkey) + "/" +
|
2011-04-27 10:05:43 +00:00
|
|
|
project->first("QMAKE_FRAMEWORK_VERSION") + "/";
|
|
|
|
}
|
2012-09-06 10:21:38 +00:00
|
|
|
path += project->first(pkey);
|
2011-04-27 10:05:43 +00:00
|
|
|
path = Option::fixPathToLocalOS(path);
|
|
|
|
for(int file = 0; file < files.count(); file++)
|
2012-09-06 10:21:38 +00:00
|
|
|
alldeps += path + Option::dir_sep + fileInfo(files[file].toQString()).fileName();
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
2013-10-21 09:14:31 +00:00
|
|
|
} else {
|
|
|
|
warn_msg(WarnLogic, "Could not resolve Info.plist: '%s'. Check if QMAKE_INFO_PLIST points to a valid file.", plist.toLatin1().constData());
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
QString
|
|
|
|
UnixMakefileGenerator::libtoolFileName(bool fixify)
|
|
|
|
{
|
|
|
|
QString ret = var("TARGET");
|
|
|
|
int slsh = ret.lastIndexOf(Option::dir_sep);
|
|
|
|
if(slsh != -1)
|
|
|
|
ret = ret.right(ret.length() - slsh - 1);
|
|
|
|
int dot = ret.indexOf('.');
|
|
|
|
if(dot != -1)
|
|
|
|
ret = ret.left(dot);
|
|
|
|
ret += Option::libtool_ext;
|
|
|
|
if(!project->isEmpty("QMAKE_LIBTOOL_DESTDIR"))
|
|
|
|
ret.prepend(project->first("QMAKE_LIBTOOL_DESTDIR") + Option::dir_sep);
|
|
|
|
if(fixify) {
|
|
|
|
if(QDir::isRelativePath(ret) && !project->isEmpty("DESTDIR"))
|
2012-09-06 10:21:38 +00:00
|
|
|
ret.prepend(project->first("DESTDIR").toQString());
|
2011-04-27 10:05:43 +00:00
|
|
|
ret = Option::fixPathToLocalOS(fileFixify(ret, qmake_getpwd(), Option::output_dir));
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
UnixMakefileGenerator::writeLibtoolFile()
|
|
|
|
{
|
|
|
|
QString fname = libtoolFileName(), lname = fname;
|
|
|
|
mkdir(fileInfo(fname).path());
|
|
|
|
int slsh = lname.lastIndexOf(Option::dir_sep);
|
|
|
|
if(slsh != -1)
|
|
|
|
lname = lname.right(lname.length() - slsh - 1);
|
|
|
|
QFile ft(fname);
|
|
|
|
if(!ft.open(QIODevice::WriteOnly))
|
|
|
|
return;
|
|
|
|
project->values("ALL_DEPS").append(fileFixify(fname));
|
|
|
|
|
|
|
|
QTextStream t(&ft);
|
|
|
|
t << "# " << lname << " - a libtool library file\n";
|
2012-09-12 17:27:09 +00:00
|
|
|
t << "# Generated by qmake/libtool (" QMAKE_VERSION_STR ") (Qt "
|
2011-04-27 10:05:43 +00:00
|
|
|
<< QT_VERSION_STR << ") on: " << QDateTime::currentDateTime().toString();
|
2014-01-13 14:48:44 +00:00
|
|
|
t << "\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
|
|
|
|
t << "# The name that we can dlopen(3).\n"
|
|
|
|
<< "dlname='" << var(project->isActiveConfig("plugin") ? "TARGET" : "TARGET_x")
|
|
|
|
<< "'\n\n";
|
|
|
|
|
|
|
|
t << "# Names of this library.\n";
|
|
|
|
t << "library_names='";
|
|
|
|
if(project->isActiveConfig("plugin")) {
|
|
|
|
t << var("TARGET");
|
|
|
|
} else {
|
|
|
|
if (project->isEmpty("QMAKE_HPUX_SHLIB"))
|
|
|
|
t << var("TARGET_x.y.z") << " ";
|
|
|
|
t << var("TARGET_x") << " " << var("TARGET_");
|
|
|
|
}
|
|
|
|
t << "'\n\n";
|
|
|
|
|
|
|
|
t << "# The name of the static archive.\n"
|
|
|
|
<< "old_library='" << lname.left(lname.length()-Option::libtool_ext.length()) << ".a'\n\n";
|
|
|
|
|
|
|
|
t << "# Libraries that this one depends upon.\n";
|
2012-09-06 10:21:38 +00:00
|
|
|
ProStringList libs;
|
2011-04-27 10:05:43 +00:00
|
|
|
if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS"))
|
|
|
|
libs = project->values("QMAKE_INTERNAL_PRL_LIBS");
|
|
|
|
else
|
|
|
|
libs << "QMAKE_LIBS"; //obvious one
|
|
|
|
t << "dependency_libs='";
|
2012-09-06 10:21:38 +00:00
|
|
|
for (ProStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it)
|
2012-05-18 18:00:23 +00:00
|
|
|
t << project->values((*it).toKey()).join(' ') << " ";
|
2011-04-27 10:05:43 +00:00
|
|
|
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";
|
|
|
|
|
2012-09-06 10:21:38 +00:00
|
|
|
ProString install_dir = project->first("QMAKE_LIBTOOL_LIBDIR");
|
2011-04-27 10:05:43 +00:00
|
|
|
if(install_dir.isEmpty())
|
|
|
|
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"
|
2012-09-06 10:21:38 +00:00
|
|
|
"libdir='" << Option::fixPathToTargetOS(install_dir.toQString(), false) << "'\n";
|
2011-04-27 10:05:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
QT_END_NAMESPACE
|