master
Daniel Kolesa 2015-11-09 18:51:55 +00:00
parent 98e99f7c49
commit 4b6d9c466a
1 changed files with 7 additions and 6 deletions

13
main.cc
View File

@ -336,14 +336,16 @@ struct ObState {
} }
}; };
static ConstCharRange deffile = "obuild.cfg";
static int ob_print_help(ConstCharRange a0, ostd::Stream &os, int v) { static int ob_print_help(ConstCharRange a0, ostd::Stream &os, int v) {
os.writeln("Usage: ", a0, " [options] [target]\n", os.writeln("Usage: ", a0, " [options] [action]\n",
"Options:\n" "Options:\n"
" -C DIRECTORY\tChange to DIRECTORY before running.\n", " -C DIRECTORY\tChange to DIRECTORY before running.\n",
" -f FILE\tSpecify the file to run (default: obuild.cfg).\n" " -f FILE\tSpecify the file to run (default: ", deffile, ").\n"
" -h\t\tPrint this message.\n" " -h\t\tPrint this message.\n"
" -j N\t\tSpecify the number of jobs to use (default: 1).\n" " -j N\t\tSpecify the number of jobs to use (default: 1).\n"
" -e STR\t\tEvaluate a string instead of a file.\n" " -e STR\tEvaluate a string instead of a file.\n"
" -E\t\tIgnore environment variables."); " -E\t\tIgnore environment variables.");
return v; return v;
} }
@ -369,7 +371,6 @@ int main(int argc, char **argv) {
os.cs.add_ident(cscript::ID_VAR, "numcpus", INT_MAX, 1, &ncpus); os.cs.add_ident(cscript::ID_VAR, "numcpus", INT_MAX, 1, &ncpus);
os.cs.add_ident(cscript::ID_VAR, "numjobs", INT_MAX, 1, &os.jobs); os.cs.add_ident(cscript::ID_VAR, "numjobs", INT_MAX, 1, &os.jobs);
ConstCharRange fname = "obuild.cfg";
ConstCharRange fcont; ConstCharRange fcont;
int ac; int ac;
@ -380,7 +381,7 @@ int main(int argc, char **argv) {
return os.error(1, "failed changing directory: %s", optarg); return os.error(1, "failed changing directory: %s", optarg);
break; break;
case 'f': case 'f':
fname = optarg; deffile = optarg;
break; break;
case 'e': case 'e':
fcont = optarg; fcont = optarg;
@ -482,7 +483,7 @@ int main(int argc, char **argv) {
cs_register_globs(os.cs); cs_register_globs(os.cs);
if ((!fcont.empty() && !os.cs.run_bool(fcont)) || !os.cs.run_file(fname)) if ((!fcont.empty() && !os.cs.run_bool(fcont)) || !os.cs.run_file(deffile))
return os.error(1, "failed creating rules"); return os.error(1, "failed creating rules");
if (os.rules.empty()) if (os.rules.empty())