aboutsummaryrefslogtreecommitdiff
path: root/build2/cc/utility.ixx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2016-08-09 11:31:53 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2016-08-12 17:04:22 +0200
commit9fa5f73d00905568e8979d0c93ec4a8f645c81d5 (patch)
treef2bf937fa256c0ef2c9bbe05d3655d1985719405 /build2/cc/utility.ixx
parenta1b2319ff2ddc8a6f139ee364cabe236ca62e23e (diff)
Implement support for C compilation
We now have two new modules: cc (c-common) and c.
Diffstat (limited to 'build2/cc/utility.ixx')
-rw-r--r--build2/cc/utility.ixx33
1 files changed, 33 insertions, 0 deletions
diff --git a/build2/cc/utility.ixx b/build2/cc/utility.ixx
new file mode 100644
index 0000000..e7eb565
--- /dev/null
+++ b/build2/cc/utility.ixx
@@ -0,0 +1,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;
+ }
+ }
+}