aboutsummaryrefslogtreecommitdiff
path: root/build/b.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build/b.cxx')
-rw-r--r--build/b.cxx35
1 files changed, 32 insertions, 3 deletions
diff --git a/build/b.cxx b/build/b.cxx
index d3628d9..c71e6d3 100644
--- a/build/b.cxx
+++ b/build/b.cxx
@@ -13,6 +13,7 @@
#include <sstream>
#include <cassert>
#include <typeinfo>
+#include <iostream>
#include <system_error>
#include <build/path>
@@ -36,6 +37,8 @@
#include <build/lexer>
#include <build/parser>
+#include <build/options>
+
using namespace std;
namespace build
@@ -141,13 +144,39 @@ main (int argc, char* argv[])
{
tracer trace ("main");
- // Initialize time conversion data that is used by localtime_r().
+ cli::argv_scanner scan (argc, argv, true);
+ options ops (scan);
+
+ // Version.
//
- tzset ();
+ if (ops.version ())
+ {
+ cout << "build2 0.0.0" << endl
+ << "Copyright (c) 2014-2015 Code Synthesis Tools CC" << endl
+ << "This is free software released under the MIT license. " << endl;
+ return 0;
+ }
+
+ // Help.
+ //
+ if (ops.help ())
+ {
+ ostream& o (cout);
+
+ o << "Usage: " << argv[0] << " [options] [variables] [buildspec]" << endl
+ << "Options:" << endl;
+
+ options::print_usage (o);
+ return 0;
+ }
// Trace verbosity.
//
- verb = 5;
+ verb = ops.verbose () > 0 ? ops.verbose () : (ops.v () ? 1 : 0);
+
+ // Initialize time conversion data that is used by localtime_r().
+ //
+ tzset ();
// Register modules.
//