time_t last_update_;
int finished_edges_, total_edges_;
+ bool verbose_;
};
BuildStatusLog::BuildStatusLog()
- : last_update_(time(NULL)), finished_edges_(0), total_edges_(0) {}
+ : last_update_(time(NULL)), finished_edges_(0), total_edges_(0),
+ verbose_(false) {}
void BuildStatusLog::PlanHasTotalEdges(int total) {
total_edges_ = total;
void BuildStatusLog::BuildEdgeStarted(Edge* edge) {
string desc = edge->GetDescription();
- if (!desc.empty())
+ if (!verbose_ && !desc.empty())
printf("%s\n", desc.c_str());
else
printf("%s\n", edge->EvaluateCommand().c_str());
log_ = new BuildStatusLog;
}
+void Builder::SetVerbose(bool verbose) {
+ log_->verbose_ = verbose;
+}
+
Node* Builder::AddTarget(const string& name, string* err) {
Node* node = state_->LookupNode(name);
if (!node) {
"options:\n"
" -g output graphviz dot file for targets and exit\n"
" -i FILE specify input build file [default=build.ninja]\n"
+" -v show all command lines\n"
);
}
const char* input_file = "build.ninja";
int opt;
- bool graph = false;
- while ((opt = getopt_long(argc, argv, "ghi:", options, NULL)) != -1) {
+ bool graph = false, verbose = false;
+ while ((opt = getopt_long(argc, argv, "ghi:v", options, NULL)) != -1) {
switch (opt) {
case 'g':
graph = true;
case 'i':
input_file = optarg;
break;
+ case 'v':
+ verbose = true;
+ break;
case 'h':
default:
usage();
}
Builder builder(&state);
+ builder.SetVerbose(verbose);
for (int i = 0; i < argc; ++i) {
if (!builder.AddTarget(argv[i], &err)) {
if (!err.empty()) {