summaryrefslogtreecommitdiffstats
path: root/src/tools/gputils/gputils_compile.cpp
blob: c59828cf380ccf3b3e6ef61aff59b27020c52169 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/***************************************************************************
 *   Copyright (C) 2005-2006 Nicolas Hadacek <hadacek@kde.org>             *
 *   Copyright (C) 2003-2004 Alain Gibaud <alain.gibaud@free.fr>           *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
#include "gputils_compile.h"

#include "gputils.h"
#include "gputils_config.h"
#include "devices/list/device_list.h"
#include "coff/base/disassembler.h"

//-----------------------------------------------------------------------------
QString GPUtils::Process::deviceName() const
{
  return toDeviceName(_data.device);
}

//-----------------------------------------------------------------------------
void GPUtils::AssembleFile::logStderrLine(const QString &line)
{
  if ( parseErrorLine(line, Compile::ParseErrorData("([^:]*):([0-9]+):(.+)\\[[0-9]+\\](.+)", 1, 2, 4, 3)) ) return;
  if ( parseErrorLine(line, Compile::ParseErrorData("([^:]*):([^:]+):([0-9]+):(.+)", 2, 3, 4, Log::LineType::Warning)) ) return;
  doLog(Log::LineType::Normal, line, QString::null, 0); // unrecognized
}

//-----------------------------------------------------------------------------
QStringList GPUtils::AssembleStandaloneFile::genericArguments(const Compile::Config &config) const
{
  QStringList args;
  args += "-L"; // force list
  args += "-o%O";
  uint wl = static_cast<const Config &>(config).gpasmWarningLevel();
  if ( wl!=Config::Nb_WarningLevels ) args += "-w" + QString::number(wl);
  args += config.includeDirs(Tool::Category::Assembler, "-I");
  args += "$NO_AUTO_DEVICE(-p%DEVICE)";
  HexBuffer::Format format = config.hexFormat();
  if( format!=HexBuffer::Nb_Formats ) args += QString("-a") + HexBuffer::FORMATS[format];
  args += config.customOptions(Tool::Category::Assembler);
  args += "%I";
  return args;
}

QString GPUtils::AssembleStandaloneFile::outputFiles() const
{
  return "PURL::Lst PURL::Cod PURL::Hex";
}

//-----------------------------------------------------------------------------
QStringList GPUtils::AssembleProjectFile::genericArguments(const Compile::Config &config) const
{
  QStringList args;
  args += "-c"; // relocatable code
  args += config.includeDirs(Tool::Category::Assembler, "-I");
  if ( !_data.items[0].generated ) args += "-p%DEVICE";
  uint wl = static_cast<const Config &>(config).gpasmWarningLevel() ;
  if( wl!=Config::Nb_WarningLevels ) args += "-w" + QString::number(wl);
  args += config.customOptions(Tool::Category::Assembler);
  args += "%I";
  return args;
}

QString GPUtils::AssembleProjectFile::outputFiles() const
{
  return "PURL::Object PURL::Lst";
}

//-----------------------------------------------------------------------------
QStringList GPUtils::LinkProject::genericArguments(const Compile::Config &config) const
{
  QStringList args;
  args += "-o%O";
  args += "-c"; // create coff file
  HexBuffer::Format f = config.hexFormat();
  if ( f!=HexBuffer::Nb_Formats ) args += QString("-a") + HexBuffer::FORMATS[f];
  args += "-m";  // with map
  args += config.includeDirs(Tool::Category::Linker, "-I");
  args += "$LKR(-s%LKR)";
  args += config.customOptions(Tool::Category::Linker);
  args += "%OBJS";
  args += "%LIBS";
  return args;
}

QString GPUtils::LinkProject::outputFiles() const
{
  return "PURL::Lkr PURL::Map PURL::Lst PURL::Cod PURL::Coff PURL::Hex";
}

//-----------------------------------------------------------------------------
QStringList GPUtils::LibraryProject::genericArguments(const Compile::Config &config) const
{
  QStringList args;
  args += "-c"; // create archive
  args += "%O";
  args += config.customOptions(Tool::Category::Librarian);
  args += "%OBJS";
  args += "%LIBS";
  return args;
}

QString GPUtils::LibraryProject::outputFiles() const
{
  return "PURL::Library";
}