void parse_option(std::string const& flag) { if ("library" == flag) { env->lib(argp->required_arg()); } else if ("include" == flag) { env->include(argp->required_arg()); } else if ("generator" == flag) { env->generator(argp->required_arg()); } else if ("debug" == flag) { env->debug(true); } else if ("optimize" == flag) { env->optimize(true); } else if ("verbose" == flag) { env->verbose(true); } else if ("clean" == flag) { clean(env->build_dir()); clean("bin"); clean("lib"); exit(0); } else if ("reset" == flag) { File::unlink(".jgmake"); exit(0); } else { argp->bad_option(flag); } }
void load_options() { // Loads options from the options file. FIXME: This settings file loader // is pretty haggard. It should be replaced with JSON. std::ifstream opts(".jgmake"); int c = opts.get(); while (c != '\n' && !opts.fail()) { std::string include; while (c != ',' && c != '\n' && !opts.fail()) { include += c; c = opts.get(); } env->include(include); c = opts.get(); } c = opts.get(); while (c != '\n' && !opts.fail()) { std::string lib; while (c != ',' && c != '\n' && !opts.fail()) { lib += c; c = opts.get(); } env->lib(lib); c = opts.get(); } }
void save_options() { // Saves options to the options file. std::ofstream opts(".jgmake"); for (int i = 0; i < env->includes(); ++i) { opts << env->include(i) << ","; } opts << std::endl; for (int i = 0; i < env->libs(); ++i) { opts << env->lib(i) << ","; } opts << std::endl; }
void parse_option(std::string const& flag) { if ("output" == flag) { env->output(argp->required_arg()); } else if ("include" == flag) { env->include(argp->required_arg()); } else if ("format" == flag) { env->generator(argp->required_arg()); } else if ("verbose" == flag) { env->verbose(true); } else { argp->bad_option(flag); } }
void parse_option(std::string const& flag) { // Parses an option and all the corresponding arguments to that option. if ("verbose" == flag) { env->verbose(true); } else if ("optimize" == flag) { env->optimize(true); } else if ("assembly" == flag) { env->assemble(false); env->link(false); } else if ("compile" == flag) { env->link(false); } else if ("make" == flag) { env->make(true); } else if ("debug" == flag) { env->debug(true); } else if ("dump-ir" == flag) { env->dump_ir(true); } else if ("dump-ast" == flag) { env->dump_ast(true); } else if ("dump-lex" == flag) { env->dump_lex(true); } else if ("dump-liveness" == flag) { env->dump_liveness(true); } else if ("dump-regalloc" == flag) { env->dump_regalloc(true); } else if ("dump-reggraph" == flag) { env->dump_reggraph(true); } else if ("execute" == flag) { env->execute(true); } else if ("no-default-libs" == flag) { env->no_default_libs(true); // Debugger flag that prevents default modules from getting // loaded automatically by the parser. } else if ("include" == flag) { env->include(argp->required_arg()); } else if ("output" == flag) { env->output(argp->required_arg()); } else if ("build-dir" == flag) { env->build_dir(argp->required_arg()); } else if ("library" == flag) { env->lib(argp->required_arg()); } else if ("generator" == flag) { env->generator(argp->required_arg()); } else { argp->bad_option(flag); } }