aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/utility.ixx
blob: e7eb56502d9b4e7c19a880b140fcc1b00c6a1c08 (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
// file      : build2/cc/utility.ixx -*- C++ -*-
// copyright : Copyright (c) 2014-2016 Code Synthesis Ltd
// license   : MIT; see accompanying LICENSE file

namespace build2
{
  namespace cc
  {
    inline ostream&
    operator<< (ostream& os, lang l)
    {
      return os << (l == lang::c ? "C" : "C++");
    }

    inline otype
    compile_type (target& t)
    {
      return
        t.is_a<bin::obje> () ? otype::e :
        t.is_a<bin::obja> () ? otype::a :
        otype::s;
    }

    inline otype
    link_type (target& t)
    {
      return
        t.is_a<bin::exe> ()  ? otype::e :
        t.is_a<bin::liba> () ? otype::a :
        otype::s;
    }
  }
}