mirror of
https://github.com/mirror/make.git
synced 2025-03-26 01:30:31 +08:00
* maintMakefile, various: Improve constification of the codebase.
This commit is contained in:
parent
e364498113
commit
ac67346d0f
10
default.c
10
default.c
@ -108,7 +108,7 @@ static struct pspec default_terminal_rules[] =
|
|||||||
{ 0, 0, 0 }
|
{ 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
static char *default_suffix_rules[] =
|
static const char *default_suffix_rules[] =
|
||||||
{
|
{
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
".obj.exe",
|
".obj.exe",
|
||||||
@ -548,8 +548,8 @@ set_default_suffixes (void)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
struct dep *d;
|
struct dep *d;
|
||||||
char *p = default_suffixes;
|
const char *p = default_suffixes;
|
||||||
suffix_file->deps = enter_prereqs (PARSE_SIMPLE_SEQ (&p, struct dep),
|
suffix_file->deps = enter_prereqs (PARSE_SIMPLE_SEQ ((char **)&p, struct dep),
|
||||||
NULL);
|
NULL);
|
||||||
for (d = suffix_file->deps; d; d = d->next)
|
for (d = suffix_file->deps; d; d = d->next)
|
||||||
d->file->builtin = 1;
|
d->file->builtin = 1;
|
||||||
@ -566,7 +566,7 @@ set_default_suffixes (void)
|
|||||||
void
|
void
|
||||||
install_default_suffix_rules (void)
|
install_default_suffix_rules (void)
|
||||||
{
|
{
|
||||||
char **s;
|
const char **s;
|
||||||
|
|
||||||
if (no_builtin_rules_flag)
|
if (no_builtin_rules_flag)
|
||||||
return;
|
return;
|
||||||
@ -578,7 +578,7 @@ install_default_suffix_rules (void)
|
|||||||
assert (f->cmds == 0);
|
assert (f->cmds == 0);
|
||||||
f->cmds = xmalloc (sizeof (struct commands));
|
f->cmds = xmalloc (sizeof (struct commands));
|
||||||
f->cmds->fileinfo.filenm = 0;
|
f->cmds->fileinfo.filenm = 0;
|
||||||
f->cmds->commands = s[1];
|
f->cmds->commands = xstrdup (s[1]);
|
||||||
f->cmds->command_lines = 0;
|
f->cmds->command_lines = 0;
|
||||||
f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT;
|
f->cmds->recipe_prefix = RECIPEPREFIX_DEFAULT;
|
||||||
f->builtin = 1;
|
f->builtin = 1;
|
||||||
|
202
job.c
202
job.c
@ -31,14 +31,14 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
#ifdef WINDOWS32
|
#ifdef WINDOWS32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
char *default_shell = "sh.exe";
|
const char *default_shell = "sh.exe";
|
||||||
int no_default_sh_exe = 1;
|
int no_default_sh_exe = 1;
|
||||||
int batch_mode_shell = 1;
|
int batch_mode_shell = 1;
|
||||||
HANDLE main_thread;
|
HANDLE main_thread;
|
||||||
|
|
||||||
#elif defined (_AMIGA)
|
#elif defined (_AMIGA)
|
||||||
|
|
||||||
char default_shell[] = "";
|
const char *default_shell = "";
|
||||||
extern int MyExecute (char **);
|
extern int MyExecute (char **);
|
||||||
int batch_mode_shell = 0;
|
int batch_mode_shell = 0;
|
||||||
|
|
||||||
@ -48,28 +48,28 @@ int batch_mode_shell = 0;
|
|||||||
says so. It is without an explicit path so we get a chance
|
says so. It is without an explicit path so we get a chance
|
||||||
to search the $PATH for it (since MSDOS doesn't have standard
|
to search the $PATH for it (since MSDOS doesn't have standard
|
||||||
directories we could trust). */
|
directories we could trust). */
|
||||||
char *default_shell = "command.com";
|
const char *default_shell = "command.com";
|
||||||
int batch_mode_shell = 0;
|
int batch_mode_shell = 0;
|
||||||
|
|
||||||
#elif defined (__EMX__)
|
#elif defined (__EMX__)
|
||||||
|
|
||||||
char *default_shell = "/bin/sh";
|
const char *default_shell = "/bin/sh";
|
||||||
int batch_mode_shell = 0;
|
int batch_mode_shell = 0;
|
||||||
|
|
||||||
#elif defined (VMS)
|
#elif defined (VMS)
|
||||||
|
|
||||||
# include <descrip.h>
|
# include <descrip.h>
|
||||||
char default_shell[] = "";
|
const char *default_shell = "";
|
||||||
int batch_mode_shell = 0;
|
int batch_mode_shell = 0;
|
||||||
|
|
||||||
#elif defined (__riscos__)
|
#elif defined (__riscos__)
|
||||||
|
|
||||||
char default_shell[] = "";
|
const char *default_shell = "";
|
||||||
int batch_mode_shell = 0;
|
int batch_mode_shell = 0;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
char default_shell[] = "/bin/sh";
|
const char *default_shell = "/bin/sh";
|
||||||
int batch_mode_shell = 0;
|
int batch_mode_shell = 0;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -2428,7 +2428,7 @@ exec_command (char **argv, char **envp)
|
|||||||
{
|
{
|
||||||
/* The file is not executable. Try it as a shell script. */
|
/* The file is not executable. Try it as a shell script. */
|
||||||
extern char *getenv ();
|
extern char *getenv ();
|
||||||
char *shell;
|
const char *shell;
|
||||||
char **new_argv;
|
char **new_argv;
|
||||||
int argc;
|
int argc;
|
||||||
int i=1;
|
int i=1;
|
||||||
@ -2456,7 +2456,7 @@ exec_command (char **argv, char **envp)
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
new_argv = alloca ((1 + argc + 1) * sizeof (char *));
|
new_argv = alloca ((1 + argc + 1) * sizeof (char *));
|
||||||
new_argv[0] = shell;
|
new_argv[0] = (char *)shell;
|
||||||
|
|
||||||
# ifdef __EMX__
|
# ifdef __EMX__
|
||||||
if (!unixy_shell)
|
if (!unixy_shell)
|
||||||
@ -2509,7 +2509,8 @@ exec_command (char **argv, char **envp)
|
|||||||
#endif /* !VMS */
|
#endif /* !VMS */
|
||||||
}
|
}
|
||||||
#else /* On Amiga */
|
#else /* On Amiga */
|
||||||
void exec_command (char **argv)
|
void
|
||||||
|
exec_command (char **argv)
|
||||||
{
|
{
|
||||||
MyExecute (argv);
|
MyExecute (argv);
|
||||||
}
|
}
|
||||||
@ -2526,7 +2527,7 @@ void clean_tmp (void)
|
|||||||
avoid using a shell. This routine handles only ' quoting, and " quoting
|
avoid using a shell. This routine handles only ' quoting, and " quoting
|
||||||
when no backslash, $ or ' characters are seen in the quotes. Starting
|
when no backslash, $ or ' characters are seen in the quotes. Starting
|
||||||
quotes may be escaped with a backslash. If any of the characters in
|
quotes may be escaped with a backslash. If any of the characters in
|
||||||
sh_chars[] is seen, or any of the builtin commands listed in sh_cmds[]
|
sh_chars is seen, or any of the builtin commands listed in sh_cmds
|
||||||
is the first word of a line, the shell is used.
|
is the first word of a line, the shell is used.
|
||||||
|
|
||||||
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
|
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
|
||||||
@ -2541,9 +2542,9 @@ void clean_tmp (void)
|
|||||||
is overridden. */
|
is overridden. */
|
||||||
|
|
||||||
static char **
|
static char **
|
||||||
construct_command_argv_internal (char *line, char **restp, char *shell,
|
construct_command_argv_internal (char *line, char **restp, const char *shell,
|
||||||
char *shellflags, char *ifs, int flags,
|
const char *shellflags, const char *ifs,
|
||||||
char **batch_filename UNUSED)
|
int flags, char **batch_filename UNUSED)
|
||||||
{
|
{
|
||||||
#ifdef __MSDOS__
|
#ifdef __MSDOS__
|
||||||
/* MSDOS supports both the stock DOS shell and ports of Unixy shells.
|
/* MSDOS supports both the stock DOS shell and ports of Unixy shells.
|
||||||
@ -2568,61 +2569,58 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
|
|||||||
DOS_CHARS also include characters special to 4DOS/NDOS, so we
|
DOS_CHARS also include characters special to 4DOS/NDOS, so we
|
||||||
won't have to tell one from another and have one more set of
|
won't have to tell one from another and have one more set of
|
||||||
commands and special characters. */
|
commands and special characters. */
|
||||||
static char sh_chars_dos[] = "*?[];|<>%^&()";
|
static const char *sh_chars_dos = "*?[];|<>%^&()";
|
||||||
static char *sh_cmds_dos[] = { "break", "call", "cd", "chcp", "chdir", "cls",
|
static const char *sh_cmds_dos[] =
|
||||||
"copy", "ctty", "date", "del", "dir", "echo",
|
{ "break", "call", "cd", "chcp", "chdir", "cls", "copy", "ctty", "date",
|
||||||
"erase", "exit", "for", "goto", "if", "md",
|
"del", "dir", "echo", "erase", "exit", "for", "goto", "if", "md",
|
||||||
"mkdir", "path", "pause", "prompt", "rd",
|
"mkdir", "path", "pause", "prompt", "rd", "rmdir", "rem", "ren",
|
||||||
"rmdir", "rem", "ren", "rename", "set",
|
"rename", "set", "shift", "time", "type", "ver", "verify", "vol", ":",
|
||||||
"shift", "time", "type", "ver", "verify",
|
0 };
|
||||||
"vol", ":", 0 };
|
|
||||||
|
|
||||||
static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^";
|
static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^";
|
||||||
static char *sh_cmds_sh[] = { "cd", "echo", "eval", "exec", "exit", "login",
|
static const char *sh_cmds_sh[] =
|
||||||
"logout", "set", "umask", "wait", "while",
|
{ "cd", "echo", "eval", "exec", "exit", "login", "logout", "set", "umask",
|
||||||
"for", "case", "if", ":", ".", "break",
|
"wait", "while", "for", "case", "if", ":", ".", "break", "continue",
|
||||||
"continue", "export", "read", "readonly",
|
"export", "read", "readonly", "shift", "times", "trap", "switch",
|
||||||
"shift", "times", "trap", "switch", "unset",
|
"unset", "ulimit", 0 };
|
||||||
"ulimit", 0 };
|
|
||||||
|
const char *sh_chars;
|
||||||
|
const char **sh_cmds;
|
||||||
|
|
||||||
char *sh_chars;
|
|
||||||
char **sh_cmds;
|
|
||||||
#elif defined (__EMX__)
|
#elif defined (__EMX__)
|
||||||
static char sh_chars_dos[] = "*?[];|<>%^&()";
|
static const char *sh_chars_dos = "*?[];|<>%^&()";
|
||||||
static char *sh_cmds_dos[] = { "break", "call", "cd", "chcp", "chdir", "cls",
|
static const char *sh_cmds_dos[] =
|
||||||
"copy", "ctty", "date", "del", "dir", "echo",
|
{ "break", "call", "cd", "chcp", "chdir", "cls", "copy", "ctty", "date",
|
||||||
"erase", "exit", "for", "goto", "if", "md",
|
"del", "dir", "echo", "erase", "exit", "for", "goto", "if", "md",
|
||||||
"mkdir", "path", "pause", "prompt", "rd",
|
"mkdir", "path", "pause", "prompt", "rd", "rmdir", "rem", "ren",
|
||||||
"rmdir", "rem", "ren", "rename", "set",
|
"rename", "set", "shift", "time", "type", "ver", "verify", "vol", ":",
|
||||||
"shift", "time", "type", "ver", "verify",
|
0 };
|
||||||
"vol", ":", 0 };
|
|
||||||
|
|
||||||
static char sh_chars_os2[] = "*?[];|<>%^()\"'&";
|
static const char *sh_chars_os2 = "*?[];|<>%^()\"'&";
|
||||||
static char *sh_cmds_os2[] = { "call", "cd", "chcp", "chdir", "cls", "copy",
|
static const char *sh_cmds_os2[] =
|
||||||
"date", "del", "detach", "dir", "echo",
|
{ "call", "cd", "chcp", "chdir", "cls", "copy", "date", "del", "detach",
|
||||||
"endlocal", "erase", "exit", "for", "goto", "if",
|
"dir", "echo", "endlocal", "erase", "exit", "for", "goto", "if", "keys",
|
||||||
"keys", "md", "mkdir", "move", "path", "pause",
|
"md", "mkdir", "move", "path", "pause", "prompt", "rd", "rem", "ren",
|
||||||
"prompt", "rd", "rem", "ren", "rename", "rmdir",
|
"rename", "rmdir", "set", "setlocal", "shift", "start", "time", "type",
|
||||||
"set", "setlocal", "shift", "start", "time",
|
"ver", "verify", "vol", ":", 0 };
|
||||||
"type", "ver", "verify", "vol", ":", 0 };
|
|
||||||
|
|
||||||
static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^~'";
|
static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^~'";
|
||||||
static char *sh_cmds_sh[] = { "echo", "cd", "eval", "exec", "exit", "login",
|
static const char *sh_cmds_sh[] =
|
||||||
"logout", "set", "umask", "wait", "while",
|
{ "echo", "cd", "eval", "exec", "exit", "login", "logout", "set", "umask",
|
||||||
"for", "case", "if", ":", ".", "break",
|
"wait", "while", "for", "case", "if", ":", ".", "break", "continue",
|
||||||
"continue", "export", "read", "readonly",
|
"export", "read", "readonly", "shift", "times", "trap", "switch",
|
||||||
"shift", "times", "trap", "switch", "unset",
|
"unset", 0 };
|
||||||
0 };
|
|
||||||
char *sh_chars;
|
const char *sh_chars;
|
||||||
char **sh_cmds;
|
const char **sh_cmds;
|
||||||
|
|
||||||
#elif defined (_AMIGA)
|
#elif defined (_AMIGA)
|
||||||
static char sh_chars[] = "#;\"|<>()?*$`";
|
static const char *sh_chars = "#;\"|<>()?*$`";
|
||||||
static char *sh_cmds[] = { "cd", "eval", "if", "delete", "echo", "copy",
|
static const char *sh_cmds[] =
|
||||||
"rename", "set", "setenv", "date", "makedir",
|
{ "cd", "eval", "if", "delete", "echo", "copy", "rename", "set", "setenv",
|
||||||
"skip", "else", "endif", "path", "prompt",
|
"date", "makedir", "skip", "else", "endif", "path", "prompt", "unset",
|
||||||
"unset", "unsetenv", "version",
|
"unsetenv", "version", 0 };
|
||||||
0 };
|
|
||||||
#elif defined (WINDOWS32)
|
#elif defined (WINDOWS32)
|
||||||
/* We used to have a double quote (") in sh_chars_dos[] below, but
|
/* We used to have a double quote (") in sh_chars_dos[] below, but
|
||||||
that caused any command line with quoted file names be run
|
that caused any command line with quoted file names be run
|
||||||
@ -2631,49 +2629,51 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
|
|||||||
can handle quoted file names just fine, removing the quote lifts
|
can handle quoted file names just fine, removing the quote lifts
|
||||||
the limit from a very frequent use case, because using quoted
|
the limit from a very frequent use case, because using quoted
|
||||||
file names is commonplace on MS-Windows. */
|
file names is commonplace on MS-Windows. */
|
||||||
static char sh_chars_dos[] = "|&<>";
|
static const char *sh_chars_dos = "|&<>";
|
||||||
static char *sh_cmds_dos[] = { "assoc", "break", "call", "cd", "chcp",
|
static const char *sh_cmds_dos[] =
|
||||||
"chdir", "cls", "color", "copy", "ctty",
|
{ "assoc", "break", "call", "cd", "chcp", "chdir", "cls", "color", "copy",
|
||||||
"date", "del", "dir", "echo", "echo.",
|
"ctty", "date", "del", "dir", "echo", "echo.", "endlocal", "erase",
|
||||||
"endlocal", "erase", "exit", "for", "ftype",
|
"exit", "for", "ftype", "goto", "if", "if", "md", "mkdir", "move",
|
||||||
"goto", "if", "if", "md", "mkdir", "move",
|
"path", "pause", "prompt", "rd", "rem", "ren", "rename", "rmdir",
|
||||||
"path", "pause", "prompt", "rd", "rem", "ren",
|
"set", "setlocal", "shift", "time", "title", "type", "ver", "verify",
|
||||||
"rename", "rmdir", "set", "setlocal",
|
"vol", ":", 0 };
|
||||||
"shift", "time", "title", "type", "ver",
|
|
||||||
"verify", "vol", ":", 0 };
|
static const char *sh_chars_sh = "#;\"*?[]&|<>(){}$`^";
|
||||||
static char sh_chars_sh[] = "#;\"*?[]&|<>(){}$`^";
|
static const char *sh_cmds_sh[] =
|
||||||
static char *sh_cmds_sh[] = { "cd", "eval", "exec", "exit", "login",
|
{ "cd", "eval", "exec", "exit", "login", "logout", "set", "umask", "wait",
|
||||||
"logout", "set", "umask", "wait", "while", "for",
|
"while", "for", "case", "if", ":", ".", "break", "continue", "export",
|
||||||
"case", "if", ":", ".", "break", "continue",
|
"read", "readonly", "shift", "times", "trap", "switch", "test",
|
||||||
"export", "read", "readonly", "shift", "times",
|
|
||||||
"trap", "switch", "test",
|
|
||||||
#ifdef BATCH_MODE_ONLY_SHELL
|
#ifdef BATCH_MODE_ONLY_SHELL
|
||||||
"echo",
|
"echo",
|
||||||
#endif
|
#endif
|
||||||
0 };
|
0 };
|
||||||
char* sh_chars;
|
|
||||||
char** sh_cmds;
|
const char *sh_chars;
|
||||||
|
const char **sh_cmds;
|
||||||
#elif defined(__riscos__)
|
#elif defined(__riscos__)
|
||||||
static char sh_chars[] = "";
|
static const char *sh_chars = "";
|
||||||
static char *sh_cmds[] = { 0 };
|
static const char *sh_cmds[] = { 0 };
|
||||||
#else /* must be UNIX-ish */
|
#else /* must be UNIX-ish */
|
||||||
static char sh_chars[] = "#;\"*?[]&|<>(){}$`^~!";
|
static const char *sh_chars = "#;\"*?[]&|<>(){}$`^~!";
|
||||||
static char *sh_cmds[] = { ".", ":", "break", "case", "cd", "continue",
|
static const char *sh_cmds[] =
|
||||||
"eval", "exec", "exit", "export", "for", "if",
|
{ ".", ":", "break", "case", "cd", "continue", "eval", "exec", "exit",
|
||||||
"login", "logout", "read", "readonly", "set",
|
"export", "for", "if", "login", "logout", "read", "readonly", "set",
|
||||||
"shift", "switch", "test", "times", "trap",
|
"shift", "switch", "test", "times", "trap", "ulimit", "umask", "unset",
|
||||||
"ulimit", "umask", "unset", "wait", "while", 0 };
|
"wait", "while", 0 };
|
||||||
|
|
||||||
# ifdef HAVE_DOS_PATHS
|
# ifdef HAVE_DOS_PATHS
|
||||||
/* This is required if the MSYS/Cygwin ports (which do not define
|
/* This is required if the MSYS/Cygwin ports (which do not define
|
||||||
WINDOWS32) are compiled with HAVE_DOS_PATHS defined, which uses
|
WINDOWS32) are compiled with HAVE_DOS_PATHS defined, which uses
|
||||||
sh_chars_sh[] directly (see below). */
|
sh_chars_sh directly (see below). */
|
||||||
static char *sh_chars_sh = sh_chars;
|
static const char *sh_chars_sh = sh_chars;
|
||||||
# endif /* HAVE_DOS_PATHS */
|
# endif /* HAVE_DOS_PATHS */
|
||||||
#endif
|
#endif
|
||||||
int i;
|
int i;
|
||||||
char *p;
|
char *p;
|
||||||
char *ap;
|
|
||||||
char *end;
|
char *end;
|
||||||
|
char *ap;
|
||||||
|
const char *cap;
|
||||||
|
const char *cp;
|
||||||
int instring, word_has_equals, seen_nonequals, last_argument_was_empty;
|
int instring, word_has_equals, seen_nonequals, last_argument_was_empty;
|
||||||
char **new_argv = 0;
|
char **new_argv = 0;
|
||||||
char *argstr = 0;
|
char *argstr = 0;
|
||||||
@ -2758,12 +2758,12 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
|
|||||||
#endif /* !__MSDOS__ && !__EMX__ */
|
#endif /* !__MSDOS__ && !__EMX__ */
|
||||||
#endif /* not WINDOWS32 */
|
#endif /* not WINDOWS32 */
|
||||||
|
|
||||||
if (ifs != 0)
|
if (ifs)
|
||||||
for (ap = ifs; *ap != '\0'; ++ap)
|
for (cap = ifs; *cap != '\0'; ++cap)
|
||||||
if (*ap != ' ' && *ap != '\t' && *ap != '\n')
|
if (*cap != ' ' && *cap != '\t' && *cap != '\n')
|
||||||
goto slow;
|
goto slow;
|
||||||
|
|
||||||
if (shellflags != 0)
|
if (shellflags)
|
||||||
if (shellflags[0] != '-'
|
if (shellflags[0] != '-'
|
||||||
|| ((shellflags[1] != 'c' || shellflags[2] != '\0')
|
|| ((shellflags[1] != 'c' || shellflags[2] != '\0')
|
||||||
&& (shellflags[1] != 'e' || shellflags[2] != 'c' || shellflags[3] != '\0')))
|
&& (shellflags[1] != 'e' || shellflags[2] != 'c' || shellflags[3] != '\0')))
|
||||||
@ -3251,11 +3251,11 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
|
|||||||
we don't escape them, construct_command_argv_internal will
|
we don't escape them, construct_command_argv_internal will
|
||||||
recursively call itself ad nauseam, or until stack overflow,
|
recursively call itself ad nauseam, or until stack overflow,
|
||||||
whichever happens first. */
|
whichever happens first. */
|
||||||
for (p = shell; *p != '\0'; ++p)
|
for (cp = shell; *cp != '\0'; ++cp)
|
||||||
{
|
{
|
||||||
if (strchr (sh_chars, *p) != 0)
|
if (strchr (sh_chars, *cp) != 0)
|
||||||
*(ap++) = '\\';
|
*(ap++) = '\\';
|
||||||
*(ap++) = *p;
|
*(ap++) = *cp;
|
||||||
}
|
}
|
||||||
*(ap++) = ' ';
|
*(ap++) = ' ';
|
||||||
if (shellflags)
|
if (shellflags)
|
||||||
@ -3480,7 +3480,7 @@ construct_command_argv_internal (char *line, char **restp, char *shell,
|
|||||||
avoid using a shell. This routine handles only ' quoting, and " quoting
|
avoid using a shell. This routine handles only ' quoting, and " quoting
|
||||||
when no backslash, $ or ' characters are seen in the quotes. Starting
|
when no backslash, $ or ' characters are seen in the quotes. Starting
|
||||||
quotes may be escaped with a backslash. If any of the characters in
|
quotes may be escaped with a backslash. If any of the characters in
|
||||||
sh_chars[] is seen, or any of the builtin commands listed in sh_cmds[]
|
sh_chars is seen, or any of the builtin commands listed in sh_cmds
|
||||||
is the first word of a line, the shell is used.
|
is the first word of a line, the shell is used.
|
||||||
|
|
||||||
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
|
If RESTP is not NULL, *RESTP is set to point to the first newline in LINE.
|
||||||
|
114
main.c
114
main.c
@ -77,8 +77,8 @@ double atof ();
|
|||||||
static void clean_jobserver (int status);
|
static void clean_jobserver (int status);
|
||||||
static void print_data_base (void);
|
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, const char **argv, int env);
|
||||||
static void decode_env_switches (char *envar, unsigned int len);
|
static void decode_env_switches (const char *envar, unsigned int len);
|
||||||
static struct variable *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);
|
||||||
@ -111,7 +111,7 @@ struct command_switch
|
|||||||
const void *noarg_value; /* Pointer to value used if no arg given. */
|
const void *noarg_value; /* Pointer to value used if no arg given. */
|
||||||
const void *default_value; /* Pointer to default value. */
|
const void *default_value; /* Pointer to default value. */
|
||||||
|
|
||||||
char *long_name; /* Long option name. */
|
const char *long_name; /* Long option name. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* True if C is a switch value that corresponds to a short option. */
|
/* True if C is a switch value that corresponds to a short option. */
|
||||||
@ -480,7 +480,7 @@ static struct command_variable *command_variables;
|
|||||||
|
|
||||||
/* The name we were invoked with. */
|
/* The name we were invoked with. */
|
||||||
|
|
||||||
char *program;
|
const char *program;
|
||||||
|
|
||||||
/* Our current directory before processing any -C options. */
|
/* Our current directory before processing any -C options. */
|
||||||
|
|
||||||
@ -639,7 +639,7 @@ initialize_stopchar_map ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char *
|
static const char *
|
||||||
expand_command_line_file (char *name)
|
expand_command_line_file (const char *name)
|
||||||
{
|
{
|
||||||
const char *cp;
|
const char *cp;
|
||||||
char *expanded = 0;
|
char *expanded = 0;
|
||||||
@ -650,35 +650,30 @@ expand_command_line_file (char *name)
|
|||||||
if (name[0] == '~')
|
if (name[0] == '~')
|
||||||
{
|
{
|
||||||
expanded = tilde_expand (name);
|
expanded = tilde_expand (name);
|
||||||
if (expanded != 0)
|
if (expanded && expanded[0] != '\0')
|
||||||
name = expanded;
|
name = expanded;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is also done in parse_file_seq, so this is redundant
|
/* This is also done in parse_file_seq, so this is redundant
|
||||||
for names read from makefiles. It is here for names passed
|
for names read from makefiles. It is here for names passed
|
||||||
on the command line. */
|
on the command line. */
|
||||||
while (name[0] == '.' && name[1] == '/' && name[2] != '\0')
|
while (name[0] == '.' && name[1] == '/')
|
||||||
{
|
{
|
||||||
name += 2;
|
name += 2;
|
||||||
while (*name == '/')
|
while (name[0] == '/')
|
||||||
/* Skip following slashes: ".//foo" is "foo", not "/foo". */
|
/* Skip following slashes: ".//foo" is "foo", not "/foo". */
|
||||||
++name;
|
++name;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*name == '\0')
|
if (name[0] == '\0')
|
||||||
{
|
{
|
||||||
/* It was all slashes! Move back to the dot and truncate
|
/* Nothing else but one or more "./", maybe plus slashes! */
|
||||||
it after the first slash, so it becomes just "./". */
|
name = "./";
|
||||||
do
|
|
||||||
--name;
|
|
||||||
while (name[0] != '.');
|
|
||||||
name[2] = '\0';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cp = strcache_add (name);
|
cp = strcache_add (name);
|
||||||
|
|
||||||
if (expanded)
|
free (expanded);
|
||||||
free (expanded);
|
|
||||||
|
|
||||||
return cp;
|
return cp;
|
||||||
}
|
}
|
||||||
@ -888,15 +883,15 @@ find_and_set_default_shell (const char *token)
|
|||||||
{
|
{
|
||||||
int sh_found = 0;
|
int sh_found = 0;
|
||||||
char *atoken = 0;
|
char *atoken = 0;
|
||||||
char *search_token;
|
const char *search_token;
|
||||||
char *tokend;
|
char *tokend;
|
||||||
PATH_VAR(sh_path);
|
PATH_VAR(sh_path);
|
||||||
extern char *default_shell;
|
extern const char *default_shell;
|
||||||
|
|
||||||
if (!token)
|
if (!token)
|
||||||
search_token = default_shell;
|
search_token = default_shell;
|
||||||
else
|
else
|
||||||
atoken = search_token = xstrdup (token);
|
search_token = atoken = xstrdup (token);
|
||||||
|
|
||||||
/* If the user explicitly requests the DOS cmd shell, obey that request.
|
/* If the user explicitly requests the DOS cmd shell, obey that request.
|
||||||
However, make sure that's what they really want by requiring the value
|
However, make sure that's what they really want by requiring the value
|
||||||
@ -1156,7 +1151,7 @@ main (int argc, char **argv, char **envp)
|
|||||||
/* Figure out where this program lives. */
|
/* Figure out where this program lives. */
|
||||||
|
|
||||||
if (argv[0] == 0)
|
if (argv[0] == 0)
|
||||||
argv[0] = "";
|
argv[0] = (char *)"";
|
||||||
if (argv[0][0] == '\0')
|
if (argv[0][0] == '\0')
|
||||||
program = "make";
|
program = "make";
|
||||||
else
|
else
|
||||||
@ -1278,7 +1273,7 @@ main (int argc, char **argv, char **envp)
|
|||||||
for (i = 0; envp[i] != 0; ++i)
|
for (i = 0; envp[i] != 0; ++i)
|
||||||
{
|
{
|
||||||
struct variable *v;
|
struct variable *v;
|
||||||
char *ep = envp[i];
|
const char *ep = envp[i];
|
||||||
/* By default, export all variables culled from the environment. */
|
/* By default, export all variables culled from the environment. */
|
||||||
enum variable_export export = v_export;
|
enum variable_export export = v_export;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
@ -1327,7 +1322,7 @@ main (int argc, char **argv, char **envp)
|
|||||||
#ifndef __MSDOS__
|
#ifndef __MSDOS__
|
||||||
export = v_noexport;
|
export = v_noexport;
|
||||||
#endif
|
#endif
|
||||||
shell_var.name = "SHELL";
|
shell_var.name = xstrdup ("SHELL");
|
||||||
shell_var.length = 5;
|
shell_var.length = 5;
|
||||||
shell_var.value = xstrdup (ep);
|
shell_var.value = xstrdup (ep);
|
||||||
}
|
}
|
||||||
@ -1396,7 +1391,7 @@ main (int argc, char **argv, char **envp)
|
|||||||
decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS"));
|
decode_env_switches (STRING_SIZE_TUPLE ("MFLAGS"));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
decode_switches (argc, argv, 0);
|
decode_switches (argc, (const char **)argv, 0);
|
||||||
|
|
||||||
/* Reset in case the switches changed our minds. */
|
/* Reset in case the switches changed our minds. */
|
||||||
syncing = (output_sync == OUTPUT_SYNC_LINE
|
syncing = (output_sync == OUTPUT_SYNC_LINE
|
||||||
@ -1718,7 +1713,8 @@ main (int argc, char **argv, char **envp)
|
|||||||
and thus re-read the makefiles, we read standard input
|
and thus re-read the makefiles, we read standard input
|
||||||
into a temporary file and read from that. */
|
into a temporary file and read from that. */
|
||||||
FILE *outfile;
|
FILE *outfile;
|
||||||
char *template, *tmpdir;
|
char *template;
|
||||||
|
const char *tmpdir;
|
||||||
|
|
||||||
if (stdin_nm)
|
if (stdin_nm)
|
||||||
O (fatal, NILF,
|
O (fatal, NILF,
|
||||||
@ -1889,7 +1885,7 @@ main (int argc, char **argv, char **envp)
|
|||||||
extern int _is_unixy_shell (const char *_path);
|
extern int _is_unixy_shell (const char *_path);
|
||||||
struct variable *shv = lookup_variable (STRING_SIZE_TUPLE ("SHELL"));
|
struct variable *shv = lookup_variable (STRING_SIZE_TUPLE ("SHELL"));
|
||||||
extern int unixy_shell;
|
extern int unixy_shell;
|
||||||
extern char *default_shell;
|
extern const char *default_shell;
|
||||||
|
|
||||||
if (shv && *shv->value)
|
if (shv && *shv->value)
|
||||||
{
|
{
|
||||||
@ -2104,7 +2100,8 @@ main (int argc, char **argv, char **envp)
|
|||||||
|
|
||||||
FILE_TIMESTAMP *makefile_mtimes = 0;
|
FILE_TIMESTAMP *makefile_mtimes = 0;
|
||||||
unsigned int mm_idx = 0;
|
unsigned int mm_idx = 0;
|
||||||
char **nargv;
|
char **aargv = NULL;
|
||||||
|
const char **nargv;
|
||||||
int nargc;
|
int nargc;
|
||||||
int orig_db_level = db_level;
|
int orig_db_level = db_level;
|
||||||
enum update_status status;
|
enum update_status status;
|
||||||
@ -2287,13 +2284,15 @@ main (int argc, char **argv, char **envp)
|
|||||||
nargc = argc;
|
nargc = argc;
|
||||||
if (stdin_nm)
|
if (stdin_nm)
|
||||||
{
|
{
|
||||||
nargv = xmalloc ((nargc + 2) * sizeof (char *));
|
void *m = xmalloc ((nargc + 2) * sizeof (char *));
|
||||||
memcpy (nargv, argv, argc * sizeof (char *));
|
aargv = m;
|
||||||
nargv[nargc++] = xstrdup (concat (2, "-o", stdin_nm));
|
memcpy (aargv, argv, argc * sizeof (char *));
|
||||||
nargv[nargc] = 0;
|
aargv[nargc++] = xstrdup (concat (2, "-o", stdin_nm));
|
||||||
|
aargv[nargc] = 0;
|
||||||
|
nargv = m;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nargv = argv;
|
nargv = (const char**)argv;
|
||||||
|
|
||||||
if (directories != 0 && directories->idx > 0)
|
if (directories != 0 && directories->idx > 0)
|
||||||
{
|
{
|
||||||
@ -2319,7 +2318,7 @@ main (int argc, char **argv, char **envp)
|
|||||||
|
|
||||||
if (ISDB (DB_BASIC))
|
if (ISDB (DB_BASIC))
|
||||||
{
|
{
|
||||||
char **p;
|
const char **p;
|
||||||
printf (_("Re-executing[%u]:"), restarts);
|
printf (_("Re-executing[%u]:"), restarts);
|
||||||
for (p = nargv; *p != 0; ++p)
|
for (p = nargv; *p != 0; ++p)
|
||||||
printf (" %s", *p);
|
printf (" %s", *p);
|
||||||
@ -2398,8 +2397,10 @@ main (int argc, char **argv, char **envp)
|
|||||||
exit (WIFEXITED(r) ? WEXITSTATUS(r) : EXIT_FAILURE);
|
exit (WIFEXITED(r) ? WEXITSTATUS(r) : EXIT_FAILURE);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
exec_command (nargv, environ);
|
exec_command ((char **)nargv, environ);
|
||||||
#endif
|
#endif
|
||||||
|
free (aargv);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
db_level = orig_db_level;
|
db_level = orig_db_level;
|
||||||
@ -2597,7 +2598,7 @@ init_switches (void)
|
|||||||
|
|
||||||
/* Non-option argument. It might be a variable definition. */
|
/* Non-option argument. It might be a variable definition. */
|
||||||
static void
|
static void
|
||||||
handle_non_switch_argument (char *arg, int env)
|
handle_non_switch_argument (const char *arg, int env)
|
||||||
{
|
{
|
||||||
struct variable *v;
|
struct variable *v;
|
||||||
|
|
||||||
@ -2704,7 +2705,7 @@ print_usage (int bad)
|
|||||||
They came from the environment if ENV is nonzero. */
|
They came from the environment if ENV is nonzero. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
decode_switches (int argc, char **argv, int env)
|
decode_switches (int argc, const char **argv, int env)
|
||||||
{
|
{
|
||||||
int bad = 0;
|
int bad = 0;
|
||||||
register const struct command_switch *cs;
|
register const struct command_switch *cs;
|
||||||
@ -2724,14 +2725,17 @@ decode_switches (int argc, char **argv, int env)
|
|||||||
|
|
||||||
while (optind < argc)
|
while (optind < argc)
|
||||||
{
|
{
|
||||||
|
const char *coptarg;
|
||||||
|
|
||||||
/* Parse the next argument. */
|
/* Parse the next argument. */
|
||||||
c = getopt_long (argc, argv, options, long_options, (int *) 0);
|
c = getopt_long (argc, (char*const*)argv, options, long_options, NULL);
|
||||||
|
coptarg = optarg;
|
||||||
if (c == EOF)
|
if (c == EOF)
|
||||||
/* End of arguments, or "--" marker seen. */
|
/* End of arguments, or "--" marker seen. */
|
||||||
break;
|
break;
|
||||||
else if (c == 1)
|
else if (c == 1)
|
||||||
/* An argument not starting with a dash. */
|
/* An argument not starting with a dash. */
|
||||||
handle_non_switch_argument (optarg, env);
|
handle_non_switch_argument (coptarg, env);
|
||||||
else if (c == '?')
|
else if (c == '?')
|
||||||
/* Bad option. We will print a usage message and die later.
|
/* Bad option. We will print a usage message and die later.
|
||||||
But continue to parse the other options so the user can
|
But continue to parse the other options so the user can
|
||||||
@ -2767,9 +2771,9 @@ decode_switches (int argc, char **argv, int env)
|
|||||||
if (!doit)
|
if (!doit)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (optarg == 0)
|
if (! coptarg)
|
||||||
optarg = xstrdup (cs->noarg_value);
|
coptarg = xstrdup (cs->noarg_value);
|
||||||
else if (*optarg == '\0')
|
else if (*coptarg == '\0')
|
||||||
{
|
{
|
||||||
char opt[2] = "c";
|
char opt[2] = "c";
|
||||||
const char *op = opt;
|
const char *op = opt;
|
||||||
@ -2791,7 +2795,7 @@ decode_switches (int argc, char **argv, int env)
|
|||||||
char **val = (char **)cs->value_ptr;
|
char **val = (char **)cs->value_ptr;
|
||||||
if (*val)
|
if (*val)
|
||||||
free (*val);
|
free (*val);
|
||||||
*val = xstrdup (optarg);
|
*val = xstrdup (coptarg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2812,34 +2816,34 @@ decode_switches (int argc, char **argv, int env)
|
|||||||
sl->max * sizeof (char *));
|
sl->max * sizeof (char *));
|
||||||
}
|
}
|
||||||
if (cs->type == filename)
|
if (cs->type == filename)
|
||||||
sl->list[sl->idx++] = expand_command_line_file (optarg);
|
sl->list[sl->idx++] = expand_command_line_file (coptarg);
|
||||||
else
|
else
|
||||||
sl->list[sl->idx++] = xstrdup (optarg);
|
sl->list[sl->idx++] = xstrdup (coptarg);
|
||||||
sl->list[sl->idx] = 0;
|
sl->list[sl->idx] = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case positive_int:
|
case positive_int:
|
||||||
/* See if we have an option argument; if we do require that
|
/* See if we have an option argument; if we do require that
|
||||||
it's all digits, not something like "10foo". */
|
it's all digits, not something like "10foo". */
|
||||||
if (optarg == 0 && argc > optind)
|
if (coptarg == 0 && argc > optind)
|
||||||
{
|
{
|
||||||
const char *cp;
|
const char *cp;
|
||||||
for (cp=argv[optind]; ISDIGIT (cp[0]); ++cp)
|
for (cp=argv[optind]; ISDIGIT (cp[0]); ++cp)
|
||||||
;
|
;
|
||||||
if (cp[0] == '\0')
|
if (cp[0] == '\0')
|
||||||
optarg = argv[optind++];
|
coptarg = argv[optind++];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!doit)
|
if (!doit)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (optarg != 0)
|
if (coptarg)
|
||||||
{
|
{
|
||||||
int i = atoi (optarg);
|
int i = atoi (coptarg);
|
||||||
const char *cp;
|
const char *cp;
|
||||||
|
|
||||||
/* Yes, I realize we're repeating this in some cases. */
|
/* Yes, I realize we're repeating this in some cases. */
|
||||||
for (cp = optarg; ISDIGIT (cp[0]); ++cp)
|
for (cp = coptarg; ISDIGIT (cp[0]); ++cp)
|
||||||
;
|
;
|
||||||
|
|
||||||
if (i < 1 || cp[0] != '\0')
|
if (i < 1 || cp[0] != '\0')
|
||||||
@ -2859,13 +2863,13 @@ decode_switches (int argc, char **argv, int env)
|
|||||||
|
|
||||||
#ifndef NO_FLOAT
|
#ifndef NO_FLOAT
|
||||||
case floating:
|
case floating:
|
||||||
if (optarg == 0 && optind < argc
|
if (coptarg == 0 && optind < argc
|
||||||
&& (ISDIGIT (argv[optind][0]) || argv[optind][0] == '.'))
|
&& (ISDIGIT (argv[optind][0]) || argv[optind][0] == '.'))
|
||||||
optarg = argv[optind++];
|
coptarg = argv[optind++];
|
||||||
|
|
||||||
if (doit)
|
if (doit)
|
||||||
*(double *) cs->value_ptr
|
*(double *) cs->value_ptr
|
||||||
= (optarg != 0 ? atof (optarg)
|
= (coptarg != 0 ? atof (coptarg)
|
||||||
: *(double *) cs->noarg_value);
|
: *(double *) cs->noarg_value);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@ -2901,12 +2905,12 @@ decode_switches (int argc, char **argv, int env)
|
|||||||
decode_switches. */
|
decode_switches. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
decode_env_switches (char *envar, unsigned int len)
|
decode_env_switches (const char *envar, unsigned int len)
|
||||||
{
|
{
|
||||||
char *varref = alloca (2 + len + 2);
|
char *varref = alloca (2 + len + 2);
|
||||||
char *value, *p, *buf;
|
char *value, *p, *buf;
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
const char **argv;
|
||||||
|
|
||||||
/* Get the variable's value. */
|
/* Get the variable's value. */
|
||||||
varref[0] = '$';
|
varref[0] = '$';
|
||||||
@ -3234,7 +3238,7 @@ print_version (void)
|
|||||||
{
|
{
|
||||||
static int printed_version = 0;
|
static int printed_version = 0;
|
||||||
|
|
||||||
char *precede = print_data_base_flag ? "# " : "";
|
const char *precede = print_data_base_flag ? "# " : "";
|
||||||
|
|
||||||
if (printed_version)
|
if (printed_version)
|
||||||
/* Do it only once. */
|
/* Do it only once. */
|
||||||
|
@ -20,7 +20,7 @@ GNUWEBDIR ?= $(SRCROOTDIR)/gnu-www
|
|||||||
MAKEWEBDIR ?= $(SRCROOTDIR)/make/make-web
|
MAKEWEBDIR ?= $(SRCROOTDIR)/make/make-web
|
||||||
|
|
||||||
# We like mondo-warnings!
|
# We like mondo-warnings!
|
||||||
AM_CFLAGS += -Wall -Wextra -Wdeclaration-after-statement -Wshadow -Wpointer-arith -Wbad-function-cast
|
AM_CFLAGS += -Wall -Wwrite-strings -Wextra -Wdeclaration-after-statement -Wshadow -Wpointer-arith -Wbad-function-cast
|
||||||
|
|
||||||
MAKE_MAINTAINER_MODE := -DMAKE_MAINTAINER_MODE
|
MAKE_MAINTAINER_MODE := -DMAKE_MAINTAINER_MODE
|
||||||
AM_CPPFLAGS += $(MAKE_MAINTAINER_MODE)
|
AM_CPPFLAGS += $(MAKE_MAINTAINER_MODE)
|
||||||
|
@ -609,7 +609,7 @@ extern double max_load_average;
|
|||||||
extern int max_load_average;
|
extern int max_load_average;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern char *program;
|
extern const char *program;
|
||||||
extern char *starting_directory;
|
extern char *starting_directory;
|
||||||
extern unsigned int makelevel;
|
extern unsigned int makelevel;
|
||||||
extern char *version_string, *remote_description, *make_host;
|
extern char *version_string, *remote_description, *make_host;
|
||||||
|
6
read.c
6
read.c
@ -238,7 +238,7 @@ read_all_makefiles (const char **makefiles)
|
|||||||
|
|
||||||
if (num_makefiles == 0)
|
if (num_makefiles == 0)
|
||||||
{
|
{
|
||||||
static char *default_makefiles[] =
|
static const char *default_makefiles[] =
|
||||||
#ifdef VMS
|
#ifdef VMS
|
||||||
/* all lower case since readdir() (the vms version) 'lowercasifies' */
|
/* all lower case since readdir() (the vms version) 'lowercasifies' */
|
||||||
{ "makefile.vms", "gnumakefile.", "makefile.", 0 };
|
{ "makefile.vms", "gnumakefile.", "makefile.", 0 };
|
||||||
@ -249,7 +249,7 @@ read_all_makefiles (const char **makefiles)
|
|||||||
{ "GNUmakefile", "makefile", "Makefile", 0 };
|
{ "GNUmakefile", "makefile", "Makefile", 0 };
|
||||||
#endif /* AMIGA */
|
#endif /* AMIGA */
|
||||||
#endif /* VMS */
|
#endif /* VMS */
|
||||||
register char **p = default_makefiles;
|
const char **p = default_makefiles;
|
||||||
while (*p != 0 && !file_exists_p (*p))
|
while (*p != 0 && !file_exists_p (*p))
|
||||||
++p;
|
++p;
|
||||||
|
|
||||||
@ -1572,7 +1572,7 @@ do_define (char *name, enum variable_origin origin, struct ebuffer *ebuf)
|
|||||||
static int
|
static int
|
||||||
conditional_line (char *line, int len, const gmk_floc *flocp)
|
conditional_line (char *line, int len, const gmk_floc *flocp)
|
||||||
{
|
{
|
||||||
char *cmdname;
|
const char *cmdname;
|
||||||
enum { c_ifdef, c_ifndef, c_ifeq, c_ifneq, c_else, c_endif } cmdtype;
|
enum { c_ifdef, c_ifndef, c_ifeq, c_ifneq, c_else, c_endif } cmdtype;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int o;
|
unsigned int o;
|
||||||
|
4
remake.c
4
remake.c
@ -1546,7 +1546,7 @@ name_mtime (const char *name)
|
|||||||
static const char *
|
static const char *
|
||||||
library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
|
library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
|
||||||
{
|
{
|
||||||
static char *dirs[] =
|
static const char *dirs[] =
|
||||||
{
|
{
|
||||||
#ifndef _AMIGA
|
#ifndef _AMIGA
|
||||||
"/lib",
|
"/lib",
|
||||||
@ -1576,7 +1576,7 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
|
|||||||
/* Information about the earliest (in the vpath sequence) match. */
|
/* Information about the earliest (in the vpath sequence) match. */
|
||||||
unsigned int best_vpath = 0, best_path = 0;
|
unsigned int best_vpath = 0, best_path = 0;
|
||||||
|
|
||||||
char **dp;
|
const char **dp;
|
||||||
|
|
||||||
libpatterns = xstrdup (variable_expand ("$(.LIBPATTERNS)"));
|
libpatterns = xstrdup (variable_expand ("$(.LIBPATTERNS)"));
|
||||||
|
|
||||||
|
4
rule.c
4
rule.c
@ -357,7 +357,7 @@ void
|
|||||||
install_pattern_rule (struct pspec *p, int terminal)
|
install_pattern_rule (struct pspec *p, int terminal)
|
||||||
{
|
{
|
||||||
struct rule *r;
|
struct rule *r;
|
||||||
char *ptr;
|
const char *ptr;
|
||||||
|
|
||||||
r = xmalloc (sizeof (struct rule));
|
r = xmalloc (sizeof (struct rule));
|
||||||
|
|
||||||
@ -373,7 +373,7 @@ install_pattern_rule (struct pspec *p, int terminal)
|
|||||||
++r->suffixes[0];
|
++r->suffixes[0];
|
||||||
|
|
||||||
ptr = p->dep;
|
ptr = p->dep;
|
||||||
r->deps = PARSE_SIMPLE_SEQ (&ptr, struct dep);
|
r->deps = PARSE_SIMPLE_SEQ ((char **)&ptr, struct dep);
|
||||||
|
|
||||||
if (new_pattern_rule (r, 0))
|
if (new_pattern_rule (r, 0))
|
||||||
{
|
{
|
||||||
|
2
rule.h
2
rule.h
@ -33,7 +33,7 @@ struct rule
|
|||||||
/* For calling install_pattern_rule. */
|
/* For calling install_pattern_rule. */
|
||||||
struct pspec
|
struct pspec
|
||||||
{
|
{
|
||||||
char *target, *dep, *commands;
|
const char *target, *dep, *commands;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
24
variable.c
24
variable.c
@ -785,12 +785,8 @@ merge_variable_set_lists (struct variable_set_list **setlist0,
|
|||||||
void
|
void
|
||||||
define_automatic_variables (void)
|
define_automatic_variables (void)
|
||||||
{
|
{
|
||||||
#if defined(WINDOWS32) || defined(__EMX__)
|
extern const char* default_shell;
|
||||||
extern char* default_shell;
|
struct variable *v;
|
||||||
#else
|
|
||||||
extern char default_shell[];
|
|
||||||
#endif
|
|
||||||
register struct variable *v;
|
|
||||||
char buf[200];
|
char buf[200];
|
||||||
|
|
||||||
sprintf (buf, "%u", makelevel);
|
sprintf (buf, "%u", makelevel);
|
||||||
@ -1045,7 +1041,7 @@ target_environment (struct file *file)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
makelevel_key.name = MAKELEVEL_NAME;
|
makelevel_key.name = xstrdup (MAKELEVEL_NAME);
|
||||||
makelevel_key.length = MAKELEVEL_LENGTH;
|
makelevel_key.length = MAKELEVEL_LENGTH;
|
||||||
hash_delete (&table, &makelevel_key);
|
hash_delete (&table, &makelevel_key);
|
||||||
|
|
||||||
@ -1328,7 +1324,7 @@ do_variable_definition (const gmk_floc *flocp, const char *varname,
|
|||||||
if ((origin == o_file || origin == o_override || origin == o_command)
|
if ((origin == o_file || origin == o_override || origin == o_command)
|
||||||
&& streq (varname, "SHELL"))
|
&& streq (varname, "SHELL"))
|
||||||
{
|
{
|
||||||
extern char *default_shell;
|
extern const char *default_shell;
|
||||||
|
|
||||||
/* Call shell locator function. If it returns TRUE, then
|
/* Call shell locator function. If it returns TRUE, then
|
||||||
set no_default_sh_exe to indicate sh was found and
|
set no_default_sh_exe to indicate sh was found and
|
||||||
@ -1537,7 +1533,7 @@ parse_variable_definition (const char *p, struct variable *var)
|
|||||||
returned. */
|
returned. */
|
||||||
|
|
||||||
struct variable *
|
struct variable *
|
||||||
assign_variable_definition (struct variable *v, char *line)
|
assign_variable_definition (struct variable *v, const char *line)
|
||||||
{
|
{
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
@ -1570,7 +1566,7 @@ assign_variable_definition (struct variable *v, char *line)
|
|||||||
returned. */
|
returned. */
|
||||||
|
|
||||||
struct variable *
|
struct variable *
|
||||||
try_variable_definition (const gmk_floc *flocp, char *line,
|
try_variable_definition (const gmk_floc *flocp, const char *line,
|
||||||
enum variable_origin origin, int target_var)
|
enum variable_origin origin, int target_var)
|
||||||
{
|
{
|
||||||
struct variable v;
|
struct variable v;
|
||||||
@ -1690,11 +1686,11 @@ print_noauto_variable (const void *item, void *arg)
|
|||||||
/* Print all the variables in SET. PREFIX is printed before
|
/* Print all the variables in SET. PREFIX is printed before
|
||||||
the actual variable definitions (everything else is comments). */
|
the actual variable definitions (everything else is comments). */
|
||||||
|
|
||||||
void
|
static void
|
||||||
print_variable_set (struct variable_set *set, char *prefix, int pauto)
|
print_variable_set (struct variable_set *set, const char *prefix, int pauto)
|
||||||
{
|
{
|
||||||
hash_map_arg (&set->table, (pauto ? print_auto_variable : print_variable),
|
hash_map_arg (&set->table, (pauto ? print_auto_variable : print_variable),
|
||||||
prefix);
|
(void *)prefix);
|
||||||
|
|
||||||
fputs (_("# variable set hash-table stats:\n"), stdout);
|
fputs (_("# variable set hash-table stats:\n"), stdout);
|
||||||
fputs ("# ", stdout);
|
fputs ("# ", stdout);
|
||||||
@ -1721,7 +1717,7 @@ print_variable_data_base (void)
|
|||||||
{
|
{
|
||||||
++rules;
|
++rules;
|
||||||
printf ("\n%s :\n", p->target);
|
printf ("\n%s :\n", p->target);
|
||||||
print_variable (&p->variable, "# ");
|
print_variable (&p->variable, (void *)"# ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rules == 0)
|
if (rules == 0)
|
||||||
|
@ -159,8 +159,8 @@ struct variable *do_variable_definition (const gmk_floc *flocp,
|
|||||||
int target_var);
|
int target_var);
|
||||||
char *parse_variable_definition (const char *line,
|
char *parse_variable_definition (const char *line,
|
||||||
struct variable *v);
|
struct variable *v);
|
||||||
struct variable *assign_variable_definition (struct variable *v, char *line);
|
struct variable *assign_variable_definition (struct variable *v, const char *line);
|
||||||
struct variable *try_variable_definition (const gmk_floc *flocp, char *line,
|
struct variable *try_variable_definition (const gmk_floc *flocp, const char *line,
|
||||||
enum variable_origin origin,
|
enum variable_origin origin,
|
||||||
int target_var);
|
int target_var);
|
||||||
void init_hash_global_variable_set (void);
|
void init_hash_global_variable_set (void);
|
||||||
|
@ -23,8 +23,8 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||||||
# define MAKE_HOST "unknown"
|
# define MAKE_HOST "unknown"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
char *version_string = VERSION;
|
const char *version_string = VERSION;
|
||||||
char *make_host = MAKE_HOST;
|
const char *make_host = MAKE_HOST;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Local variables:
|
Local variables:
|
||||||
|
Loading…
Reference in New Issue
Block a user