+ GetOpt getopt;
+ getopt.add_option(GetOpt::Option('a', "analyze", GetOpt::REQUIRED));
+ getopt.add_option(GetOpt::Option('b', "build", GetOpt::NONE));
+ getopt.add_option(GetOpt::Option('c', "clean", GetOpt::NONE));
+ getopt.add_option(GetOpt::Option('f', "file", GetOpt::REQUIRED, "Build"));
+ getopt.add_option(GetOpt::Option('h', "help", GetOpt::NONE));
+ getopt.add_option(GetOpt::Option('j', "jobs", GetOpt::REQUIRED, "1"));
+ getopt.add_option(GetOpt::Option('n', "dry-run", GetOpt::NONE));
+ getopt.add_option(GetOpt::Option('v', "verbose", GetOpt::NONE));
+ getopt.add_option(GetOpt::Option('A', "conf-all", GetOpt::NONE));
+ getopt.add_option(GetOpt::Option('B', "build-all", GetOpt::NONE));
+ getopt.add_option(GetOpt::Option('C', "chdir", GetOpt::REQUIRED));
+ getopt.add_option(GetOpt::Option('W', "what-if", GetOpt::REQUIRED));
+ getopt.add_option(GetOpt::Option("chrome", GetOpt::NONE));
+ getopt.add_option(GetOpt::Option("full-paths", GetOpt::NONE));
+ getopt.add_option(GetOpt::Option("max-depth", GetOpt::REQUIRED));
+ int index=getopt(argc, argv);
+
+ verbose+=getopt['v'].count();
+
+ if(getopt['a'])
+ {
+ analyzer=new Analyzer(*this);
+
+ string mode=getopt['a'].arg();
+ if(mode=="deps")
+ analyzer->set_mode(Analyzer::DEPS);
+ else if(mode=="alldeps")
+ analyzer->set_mode(Analyzer::ALLDEPS);
+ else if(mode=="rebuild")
+ analyzer->set_mode(Analyzer::REBUILD);
+ else if(mode=="rdeps")
+ analyzer->set_mode(Analyzer::RDEPS);
+ else
+ throw UsageError("Invalid analysis mode");
+
+ if(getopt["max-depth"])
+ analyzer->set_max_depth(strtol(getopt["max-depth"].arg()));
+ analyzer->set_full_paths(getopt["full-paths"]);
+
+ if(!getopt['b'])
+ do_build=false;
+ }
+
+ dry_run=getopt['n'];
+ jobs=max(strtol(getopt['j'].arg()), 1L);
+ chrome=getopt["chrome"];
+ conf_all=getopt['A'];
+ build_file=getopt['f'].arg();
+ build_all=getopt['B'];
+ help=getopt['h'];
+
+ if(getopt['C'])
+ chdir(getopt['C'].arg().c_str());
+
+ for(int i=index; i<argc; ++i)