blob: c43827dc78f439c310f34da77a4bea3f7be7f7e3 (
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
|
// file : build/prerequisite.cxx -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
// license : MIT; see accompanying LICENSE file
#include <build/prerequisite>
#include <ostream>
#include <build/scope>
#include <build/target> // target_type
#include <build/context>
using namespace std;
namespace build
{
ostream&
operator<< (ostream& os, const prerequisite& p)
{
if (p.target != nullptr)
os << *p.target;
else
{
os << p.type.name << '{';
// Print scope unless the directory is absolute.
//
if (!p.directory.absolute ())
{
string s (diagnostic_string (p.scope.path ()));
if (!s.empty ())
os << s << path::traits::directory_separator << ": ";
}
// Print directory.
//
if (!p.directory.empty ())
{
string s (diagnostic_string (p.directory));
if (!s.empty ())
os << s << path::traits::directory_separator;
}
os << p.name << '}';
}
return os;
}
bool
operator< (const prerequisite& x, const prerequisite& y)
{
return
(x.type.id < y.type.id) ||
(x.type.id == y.type.id && x.name < y.name) ||
(x.type.id == y.type.id && x.name == y.name &&
x.directory < y.directory);
}
}
|