+ string analyze_mode;
+ string work_dir;
+ bool full_paths=false;
+ unsigned max_depth=5;
+
+ GetOpt getopt;
+ getopt.add_option('a', "analyze", analyze_mode, GetOpt::REQUIRED_ARG);
+ getopt.add_option('b', "build", build, GetOpt::NO_ARG);
+ getopt.add_option('c', "clean", clean, GetOpt::NO_ARG);
+ getopt.add_option('f', "file", build_file, GetOpt::REQUIRED_ARG);
+ getopt.add_option('h', "help", help, GetOpt::NO_ARG);
+ getopt.add_option('j', "jobs", jobs, GetOpt::REQUIRED_ARG);
+ getopt.add_option('n', "dry-run", dry_run, GetOpt::NO_ARG);
+ getopt.add_option('v', "verbose", verbose, GetOpt::NO_ARG);
+ getopt.add_option('A', "conf-all", conf_all, GetOpt::NO_ARG);
+ getopt.add_option('B', "build-all", build_all, GetOpt::NO_ARG);
+ getopt.add_option('C', "chdir", work_dir, GetOpt::REQUIRED_ARG);
+ getopt.add_option('P', "progress", show_progress, GetOpt::NO_ARG);
+ getopt.add_option('W', "what-if", what_if, GetOpt::REQUIRED_ARG);
+ getopt.add_option( "conf-only", conf_only, GetOpt::NO_ARG);
+ getopt.add_option( "full-paths", full_paths, GetOpt::NO_ARG);
+ //getopt.add_option( "makefile", create_makefile, GetOpt::NO_ARG);
+ getopt.add_option( "max-depth", max_depth, GetOpt::REQUIRED_ARG);
+ getopt(argc, argv);
+
+ if(!analyze_mode.empty())
+ {
+ analyzer=new Analyzer(*this);
+
+ if(analyze_mode=="deps")
+ analyzer->set_mode(Analyzer::DEPS);
+ else if(analyze_mode=="alldeps")
+ analyzer->set_mode(Analyzer::ALLDEPS);
+ else if(analyze_mode=="rebuild")
+ analyzer->set_mode(Analyzer::REBUILD);
+ else if(analyze_mode=="rdeps")
+ analyzer->set_mode(Analyzer::RDEPS);
+ else
+ throw UsageError("Invalid analyze mode");
+
+ analyzer->set_max_depth(max_depth);
+ analyzer->set_full_paths(full_paths);
+ }
+ else if(!clean && !create_makefile)
+ build=true;
+
+ const vector<string> &args=getopt.get_args();
+ for(vector<string>::const_iterator i=args.begin(); i!=args.end(); ++i)