This program behaves in two different ways.
2986 std::string remakefile;
2988 bool literal_targets =
false;
2989 bool indirect_targets =
false;
2992 for (
int i = 1; i < argc; ++i)
2994 std::string arg = argv[i];
2995 if (arg.empty())
usage(EXIT_FAILURE);
2996 if (literal_targets)
goto new_target;
2997 if (arg ==
"-h" || arg ==
"--help")
usage(EXIT_SUCCESS);
3001 else if (arg ==
"-k" || arg ==
"--keep-going")
3003 else if (arg ==
"-s" || arg ==
"--silent" || arg ==
"--quiet")
3005 else if (arg ==
"-r")
3006 indirect_targets =
true;
3007 else if (arg ==
"-B" || arg ==
"--always-make")
3009 else if (arg ==
"-f")
3011 if (++i == argc)
usage(EXIT_FAILURE);
3012 remakefile = argv[i];
3014 else if (arg ==
"--")
3015 literal_targets =
true;
3016 else if (arg.compare(0, 2,
"-j") == 0)
3018 else if (arg.compare(0, 7,
"--jobs=") == 0)
3022 if (arg[0] ==
'-')
usage(EXIT_FAILURE);
3023 if (arg.find(
'=') != std::string::npos)
3025 std::istringstream in(arg);
3032 targets.push_back(arg);
3033 DEBUG <<
"New target: " << arg <<
'\n';
3040 if (indirect_targets)
3047 l.push_back(
dependencies.begin()->second->targets.front());
3049 for (string_list::const_iterator i = l.begin(),
3050 i_end = l.end(); i != i_end; ++i)
3052 dependency_map::const_iterator j =
dependencies.find(*i);
3055 for (string_set::const_iterator k = dep.
deps.begin(),
3056 k_end = dep.
deps.end(); k != k_end; ++k)
3066 if (WSAStartup(MAKEWORD(2,2), &wsaData))
3068 std::cerr <<
"Unexpected failure while initializing Windows Socket" << std::endl;
3074 if (
char *sn = getenv(
"REMAKE_SOCKET"))
client_mode(sn, targets);
3077 if (remakefile.empty())
3079 remakefile =
"Remakefile";
static std::string normalize(std::string const &s, std::string const &w, std::string const &p)
static void server_mode(std::string const &remakefile, string_list const &targets)
static void init_prefix_dir()
static variable_map variables
std::list< std::string > string_list
static int max_active_jobs
static std::string read_word(std::istream &in, bool detect_equal=true)
static bool read_words(input_generator &in, string_list &res)
static void init_working_dir()
static std::string working_dir
static std::string prefix_dir
static bool obsolete_targets
static void normalize_list(string_list &l, std::string const &w, std::string const &p)
static int expect_token(std::istream &in, int mask)
static void usage(int exit_status)
static void client_mode(char *socket_name, string_list const &targets)
static void load_dependencies(std::istream &in)
static dependency_map dependencies