mirror of
https://git.savannah.gnu.org/git/make.git
synced 2025-02-07 06:47:52 +00:00
Small cleanup defining MAKEFLAGS.
This commit is contained in:
parent
20ecc58126
commit
fa0f2c516a
1 changed files with 11 additions and 25 deletions
36
main.c
36
main.c
|
@ -79,7 +79,7 @@ static void print_data_base (void);
|
||||||
static void print_version (void);
|
static void print_version (void);
|
||||||
static void decode_switches (int argc, char **argv, int env);
|
static void decode_switches (int argc, char **argv, int env);
|
||||||
static void decode_env_switches (char *envar, unsigned int len);
|
static void decode_env_switches (char *envar, unsigned int len);
|
||||||
static const char *define_makeflags (int all, int makefile);
|
static struct variable *define_makeflags (int all, int makefile);
|
||||||
static char *quote_for_env (char *out, const char *in);
|
static char *quote_for_env (char *out, const char *in);
|
||||||
static void initialize_global_hash_tables (void);
|
static void initialize_global_hash_tables (void);
|
||||||
|
|
||||||
|
@ -1805,7 +1805,6 @@ main (int argc, char **argv, char **envp)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Define the initial list of suffixes for old-style rules. */
|
/* Define the initial list of suffixes for old-style rules. */
|
||||||
|
|
||||||
set_default_suffixes ();
|
set_default_suffixes ();
|
||||||
|
|
||||||
/* Define the file rules for the built-in suffix rules. These will later
|
/* Define the file rules for the built-in suffix rules. These will later
|
||||||
|
@ -1813,17 +1812,14 @@ main (int argc, char **argv, char **envp)
|
||||||
install_default_implicit_rules, but since that happens after reading
|
install_default_implicit_rules, but since that happens after reading
|
||||||
makefiles, it results in the built-in pattern rules taking precedence
|
makefiles, it results in the built-in pattern rules taking precedence
|
||||||
over makefile-specified suffix rules, which is wrong. */
|
over makefile-specified suffix rules, which is wrong. */
|
||||||
|
|
||||||
install_default_suffix_rules ();
|
install_default_suffix_rules ();
|
||||||
|
|
||||||
/* Define some internal and special variables. */
|
/* Define some internal and special variables. */
|
||||||
|
|
||||||
define_automatic_variables ();
|
define_automatic_variables ();
|
||||||
|
|
||||||
/* Set up the MAKEFLAGS and MFLAGS variables
|
/* Set up the MAKEFLAGS and MFLAGS variables for makefiles to see.
|
||||||
so makefiles can look at them. */
|
Initialize it to be exported but allow the makefile to reset it. */
|
||||||
|
define_makeflags (0, 0)->export = v_export;
|
||||||
define_makeflags (0, 0);
|
|
||||||
|
|
||||||
/* Define the default variables. */
|
/* Define the default variables. */
|
||||||
define_default_variables ();
|
define_default_variables ();
|
||||||
|
@ -2305,13 +2301,12 @@ main (int argc, char **argv, char **envp)
|
||||||
char **p;
|
char **p;
|
||||||
for (p = environ; *p != 0; ++p)
|
for (p = environ; *p != 0; ++p)
|
||||||
{
|
{
|
||||||
if (strneq (*p, MAKELEVEL_NAME, MAKELEVEL_LENGTH)
|
if (strneq (*p, MAKELEVEL_NAME "=", MAKELEVEL_LENGTH+1))
|
||||||
&& (*p)[MAKELEVEL_LENGTH] == '=')
|
|
||||||
{
|
{
|
||||||
*p = alloca (40);
|
*p = alloca (40);
|
||||||
sprintf (*p, "%s=%u", MAKELEVEL_NAME, makelevel);
|
sprintf (*p, "%s=%u", MAKELEVEL_NAME, makelevel);
|
||||||
}
|
}
|
||||||
if (strneq (*p, "MAKE_RESTARTS=", 14))
|
else if (strneq (*p, "MAKE_RESTARTS=", CSTRLEN ("MAKE_RESTARTS=")))
|
||||||
{
|
{
|
||||||
*p = alloca (40);
|
*p = alloca (40);
|
||||||
sprintf (*p, "MAKE_RESTARTS=%u", restarts);
|
sprintf (*p, "MAKE_RESTARTS=%u", restarts);
|
||||||
|
@ -2947,7 +2942,7 @@ quote_for_env (char *out, const char *in)
|
||||||
command switches. Include options with args if ALL is nonzero.
|
command switches. Include options with args if ALL is nonzero.
|
||||||
Don't include options with the 'no_makefile' flag set if MAKEFILE. */
|
Don't include options with the 'no_makefile' flag set if MAKEFILE. */
|
||||||
|
|
||||||
static const char *
|
static struct variable *
|
||||||
define_makeflags (int all, int makefile)
|
define_makeflags (int all, int makefile)
|
||||||
{
|
{
|
||||||
const char ref[] = "$(MAKEOVERRIDES)";
|
const char ref[] = "$(MAKEOVERRIDES)";
|
||||||
|
@ -2955,8 +2950,7 @@ define_makeflags (int all, int makefile)
|
||||||
const char evalref[] = "$(-*-eval-flags-*-)";
|
const char evalref[] = "$(-*-eval-flags-*-)";
|
||||||
const struct command_switch *cs;
|
const struct command_switch *cs;
|
||||||
char *flagstring;
|
char *flagstring;
|
||||||
register char *p;
|
char *p;
|
||||||
struct variable *v;
|
|
||||||
|
|
||||||
/* We will construct a linked list of 'struct flag's describing
|
/* We will construct a linked list of 'struct flag's describing
|
||||||
all the flags which need to go in MAKEFLAGS. Then, once we
|
all the flags which need to go in MAKEFLAGS. Then, once we
|
||||||
|
@ -3140,7 +3134,7 @@ define_makeflags (int all, int makefile)
|
||||||
p += CSTRLEN (evalref);
|
p += CSTRLEN (evalref);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (all && command_variables != 0)
|
if (all && command_variables)
|
||||||
{
|
{
|
||||||
/* Write a reference to $(MAKEOVERRIDES), which contains all the
|
/* Write a reference to $(MAKEOVERRIDES), which contains all the
|
||||||
command-line variable definitions. Separate the variables from the
|
command-line variable definitions. Separate the variables from the
|
||||||
|
@ -3172,16 +3166,8 @@ define_makeflags (int all, int makefile)
|
||||||
lost when users added -e, causing a previous MAKEFLAGS env. var. to take
|
lost when users added -e, causing a previous MAKEFLAGS env. var. to take
|
||||||
precedence over the new one. Of course, an override or command
|
precedence over the new one. Of course, an override or command
|
||||||
definition will still take precedence. */
|
definition will still take precedence. */
|
||||||
v = define_variable_cname ("MAKEFLAGS", flagstring,
|
return define_variable_cname ("MAKEFLAGS", flagstring,
|
||||||
env_overrides ? o_env_override : o_file, 1);
|
env_overrides ? o_env_override : o_file, 1);
|
||||||
|
|
||||||
if (! all)
|
|
||||||
/* The first time we are called, set MAKEFLAGS to always be exported.
|
|
||||||
We should not do this again on the second call, because that is
|
|
||||||
after reading makefiles which might have done 'unexport MAKEFLAGS'. */
|
|
||||||
v->export = v_export;
|
|
||||||
|
|
||||||
return v->value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Print version information. */
|
/* Print version information. */
|
||||||
|
|
Loading…
Reference in a new issue