mirror of
https://github.com/mirror/make.git
synced 2026-08-20 00:43:29 +08:00
Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
806dc4f7c4 | ||
|
|
c0163410d2 | ||
|
|
eac1e9ee66 | ||
|
|
8ad5af7c28 | ||
|
|
857d7ad256 | ||
|
|
612a29e0dd | ||
|
|
462304918c | ||
|
|
9d36c92adb | ||
|
|
640c4ecd99 | ||
|
|
07f09cfd88 | ||
|
|
d37c9ba18a | ||
|
|
cc8d6cf343 | ||
|
|
4b17f0982b | ||
|
|
dc576b2051 | ||
|
|
a543a2ae9f | ||
|
|
0e352e4bf7 | ||
|
|
3f8bde0f25 | ||
|
|
4308542cb1 | ||
|
|
e622fcf22e | ||
|
|
1766b7fa59 | ||
|
|
fa999783d7 | ||
|
|
e97d6632b5 | ||
|
|
e3d013a79a | ||
|
|
9807a2869f | ||
|
|
e9521d3447 | ||
|
|
c62ca42327 | ||
|
|
2feb36f620 | ||
|
|
f40918e005 | ||
|
|
b13a443fa7 | ||
|
|
e938a511be | ||
|
|
a96d572aa6 | ||
|
|
990c39d973 | ||
|
|
24d37fb493 | ||
|
|
c1e20276cb | ||
|
|
9f71eaf6b5 | ||
|
|
03cd08cca2 |
4
alloca.c
4
alloca.c
@@ -22,11 +22,7 @@
|
||||
your main control loop, etc. to force garbage collection. */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if defined (emacs) || defined (CONFIG_BROKETS)
|
||||
#include <config.h>
|
||||
#else
|
||||
#include "config.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef emacs
|
||||
|
||||
62
commands.c
62
commands.c
@@ -116,34 +116,64 @@ set_file_variables (file)
|
||||
DEFINE_VARIABLE ("@", 1, at);
|
||||
DEFINE_VARIABLE ("%", 1, percent);
|
||||
|
||||
/* Make sure that no dependencies are repeated. This does not
|
||||
really matter for the purpose of updating targets, but it
|
||||
might make some names be listed twice for $^ and $?. */
|
||||
|
||||
uniquize_deps (file->deps);
|
||||
|
||||
/* Compute the values for $^ and $?. */
|
||||
/* Compute the values for $^, $+, and $?. */
|
||||
|
||||
{
|
||||
register unsigned int caret_len, qmark_len;
|
||||
char *caret_value;
|
||||
register unsigned int qmark_len, plus_len;
|
||||
char *caret_value, *plus_value;
|
||||
register char *cp;
|
||||
char *qmark_value;
|
||||
register char *qp;
|
||||
register struct dep *d;
|
||||
unsigned int len;
|
||||
|
||||
caret_len = qmark_len = 0;
|
||||
/* Compute first the value for $+, which is supposed to contain
|
||||
duplicate dependencies as they were listed in the makefile. */
|
||||
|
||||
plus_len = 0;
|
||||
for (d = file->deps; d != 0; d = d->next)
|
||||
plus_len += strlen (dep_name (d)) + 1;
|
||||
|
||||
len = plus_len == 0 ? 1 : plus_len;
|
||||
cp = plus_value = (char *) alloca (len);
|
||||
|
||||
qmark_len = plus_len; /* Will be this or less. */
|
||||
for (d = file->deps; d != 0; d = d->next)
|
||||
{
|
||||
register unsigned int i = strlen (dep_name (d)) + 1;
|
||||
caret_len += i;
|
||||
if (d->changed)
|
||||
qmark_len += i;
|
||||
char *c = dep_name (d);
|
||||
|
||||
#ifndef NO_ARCHIVES
|
||||
if (ar_name (c))
|
||||
{
|
||||
c = index (c, '(') + 1;
|
||||
len = strlen (c) - 1;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
len = strlen (c);
|
||||
|
||||
bcopy (c, cp, len);
|
||||
cp += len;
|
||||
*cp++ = ' ';
|
||||
|
||||
if (! d->changed)
|
||||
qmark_len -= len + 1; /* Don't space in $? for this one. */
|
||||
}
|
||||
|
||||
len = caret_len == 0 ? 1 : caret_len;
|
||||
cp = caret_value = (char *) alloca (len);
|
||||
/* Kill the last space and define the variable. */
|
||||
|
||||
cp[cp > plus_value ? -1 : 0] = '\0';
|
||||
DEFINE_VARIABLE ("+", 1, plus_value);
|
||||
|
||||
/* Make sure that no dependencies are repeated. This does not
|
||||
really matter for the purpose of updating targets, but it
|
||||
might make some names be listed twice for $^ and $?. */
|
||||
|
||||
uniquize_deps (file->deps);
|
||||
|
||||
/* Compute the values for $^ and $?. */
|
||||
|
||||
cp = caret_value = plus_value; /* Reuse the buffer; it's big enough. */
|
||||
len = qmark_len == 0 ? 1 : qmark_len;
|
||||
qp = qmark_value = (char *) alloca (len);
|
||||
|
||||
|
||||
2
dir.c
2
dir.c
@@ -48,7 +48,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#endif /* POSIX */
|
||||
|
||||
#ifdef __MSDOS__
|
||||
#inlcude <ctype.h>
|
||||
#include <ctype.h>
|
||||
|
||||
static char *
|
||||
dosify (filename)
|
||||
|
||||
26
file.c
26
file.c
@@ -383,6 +383,32 @@ snap_deps ()
|
||||
f = lookup_file (".EXPORT_ALL_VARIABLES");
|
||||
if (f != 0 && f->is_target)
|
||||
export_all_variables = 1;
|
||||
|
||||
f = lookup_file (".IGNORE");
|
||||
if (f != 0 && f->is_target)
|
||||
{
|
||||
if (f->deps == 0)
|
||||
ignore_errors_flag = 1;
|
||||
else
|
||||
for (d = f->deps; d != 0; d = d->next)
|
||||
for (f2 = d->file; f2 != 0; f2 = f2->prev)
|
||||
f2->command_flags |= COMMANDS_NOERROR;
|
||||
}
|
||||
|
||||
f = lookup_file (".SILENT");
|
||||
if (f != 0 && f->is_target)
|
||||
{
|
||||
if (f->deps == 0)
|
||||
silent_flag = 1;
|
||||
else
|
||||
for (d = f->deps; d != 0; d = d->next)
|
||||
for (f2 = d->file; f2 != 0; f2 = f2->prev)
|
||||
f2->command_flags |= COMMANDS_SILENT;
|
||||
}
|
||||
|
||||
f = lookup_file (".POSIX");
|
||||
if (f != 0 && f->is_target)
|
||||
posix_pedantic = 1;
|
||||
}
|
||||
|
||||
/* Set the `command_state' member of FILE and all its `also_make's. */
|
||||
|
||||
3
file.h
3
file.h
@@ -25,7 +25,8 @@ struct file
|
||||
struct file *next;
|
||||
char *name;
|
||||
struct dep *deps;
|
||||
struct commands *cmds; /* Commands to execute for this target */
|
||||
struct commands *cmds; /* Commands to execute for this target. */
|
||||
int command_flags; /* Flags OR'd in for cmds; see commands.h. */
|
||||
char *stem; /* Implicit stem, if an implicit
|
||||
rule has been used */
|
||||
struct dep *also_make; /* Targets that are made by making this. */
|
||||
|
||||
37
getloadavg.c
37
getloadavg.c
@@ -70,14 +70,7 @@
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if defined (emacs) || defined (CONFIG_BROKETS)
|
||||
/* We use <config.h> instead of "config.h" so that a compilation
|
||||
using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
|
||||
(which it would do because it found this file in $srcdir). */
|
||||
#include <config.h>
|
||||
#else
|
||||
#include "config.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Exclude all the code except the test program at the end
|
||||
@@ -149,6 +142,7 @@ extern int errno;
|
||||
|
||||
#if defined (__osf__) && (defined (__alpha) || defined (__alpha__))
|
||||
#define OSF_ALPHA
|
||||
#include <sys/table.h>
|
||||
#endif
|
||||
|
||||
#if defined (__osf__) && (defined (mips) || defined (__mips__))
|
||||
@@ -211,6 +205,10 @@ extern int errno;
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#if defined(alliant) && defined(i860) /* Alliant FX/2800 */
|
||||
#define LOAD_AVE_TYPE long
|
||||
#endif
|
||||
|
||||
#endif /* No LOAD_AVE_TYPE. */
|
||||
|
||||
#ifdef OSF_ALPHA
|
||||
@@ -220,6 +218,13 @@ extern int errno;
|
||||
#define FSCALE 1024.0
|
||||
#endif
|
||||
|
||||
#if defined(alliant) && defined(i860) /* Alliant FX/2800 */
|
||||
/* <sys/param.h> defines an incorrect value for FSCALE on an
|
||||
Alliant FX/2800 Concentrix 2.2, according to ghazi@noc.rutgers.edu. */
|
||||
#undef FSCALE
|
||||
#define FSCALE 100.0
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef FSCALE
|
||||
|
||||
@@ -297,7 +302,7 @@ extern int errno;
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#ifdef tex4300
|
||||
#ifdef tek4300
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
@@ -305,6 +310,10 @@ extern int errno;
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#if defined(alliant) && defined(i860) /* Alliant FX/2800 */
|
||||
#define NLIST_STRUCT
|
||||
#endif
|
||||
|
||||
#endif /* defined (NLIST_STRUCT) */
|
||||
|
||||
|
||||
@@ -702,6 +711,18 @@ getloadavg (loadavg, nelem)
|
||||
: (load_ave.tl_avenrun.l[0] / (double) load_ave.tl_lscale));
|
||||
#endif /* OSF_MIPS */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined (OSF_ALPHA)
|
||||
#define LDAV_DONE
|
||||
|
||||
struct tbl_loadavg load_ave;
|
||||
table (TBL_LOADAVG, 0, &load_ave, 1, sizeof (load_ave));
|
||||
for (elem = 0; elem < nelem; elem++)
|
||||
loadavg[elem]
|
||||
= (load_ave.tl_lscale == 0
|
||||
? load_ave.tl_avenrun.d[elem]
|
||||
: (load_ave.tl_avenrun.l[elem] / (double) load_ave.tl_lscale));
|
||||
#endif /* OSF_ALPHA */
|
||||
|
||||
#if !defined (LDAV_DONE) && defined (VMS)
|
||||
/* VMS specific code -- read from the Load Ave driver. */
|
||||
|
||||
|
||||
@@ -262,7 +262,7 @@ pattern_search (file, archive, depth, recursions)
|
||||
}
|
||||
|
||||
/* If we have found a matching rule that won't match all filenames,
|
||||
retroactively reject any "terminal" rules that do always match. */
|
||||
retroactively reject any non-"terminal" rules that do always match. */
|
||||
if (specific_rule_matched)
|
||||
for (i = 0; i < nrules; ++i)
|
||||
if (!tryrules[i]->terminal)
|
||||
|
||||
73
job.c
73
job.c
@@ -21,6 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#include "job.h"
|
||||
#include "file.h"
|
||||
#include "variable.h"
|
||||
#include <assert.h>
|
||||
|
||||
/* Default path to search for executables. */
|
||||
static char default_path[] = ":/bin:/usr/bin";
|
||||
@@ -378,9 +379,15 @@ reap_children (block, err)
|
||||
{
|
||||
/* The commands failed. Write an error message,
|
||||
delete non-precious targets, and abort. */
|
||||
static int delete_on_error = -1;
|
||||
child_error (c->file->name, exit_code, exit_sig, coredump, 0);
|
||||
c->file->update_status = 1;
|
||||
if (exit_sig != 0)
|
||||
if (delete_on_error == -1)
|
||||
{
|
||||
struct file *f = lookup_file (".DELETE_ON_ERROR");
|
||||
delete_on_error = f != 0 && f->is_target;
|
||||
}
|
||||
if (exit_sig != 0 || delete_on_error)
|
||||
delete_child_targets (c);
|
||||
}
|
||||
else
|
||||
@@ -402,7 +409,6 @@ reap_children (block, err)
|
||||
Since there are more commands that wanted to be run,
|
||||
the target was not completely remade. So we treat
|
||||
this as if a command had failed. */
|
||||
c->file->command_state = cs_finished;
|
||||
c->file->update_status = 1;
|
||||
}
|
||||
else
|
||||
@@ -413,30 +419,29 @@ reap_children (block, err)
|
||||
by start_remote_job_p. */
|
||||
c->remote = start_remote_job_p ();
|
||||
start_job_command (c);
|
||||
if (c->file->command_state == cs_running)
|
||||
/* We successfully started the new command.
|
||||
Loop to reap more children. */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
switch (c->file->command_state)
|
||||
{
|
||||
case cs_running:
|
||||
/* Successfully started. Loop to reap more children. */
|
||||
continue;
|
||||
|
||||
case cs_finished:
|
||||
if (c->file->update_status != 0)
|
||||
/* We failed to start the commands. */
|
||||
delete_child_targets (c);
|
||||
break;
|
||||
|
||||
default:
|
||||
error ("internal error: `%s' has bogus command_state \
|
||||
%d in reap_children",
|
||||
c->file->name, (int) c->file->command_state);
|
||||
abort ();
|
||||
break;
|
||||
}
|
||||
else
|
||||
/* There are no more commands. We got through them all
|
||||
without an unignored error. Now the target has been
|
||||
successfully updated. */
|
||||
c->file->update_status = 0;
|
||||
}
|
||||
|
||||
/* When we get here, all the commands for C->file are finished
|
||||
(or aborted) and C->file->update_status contains 0 or 1. But
|
||||
C->file->command_state is still cs_running if all the commands
|
||||
ran; notice_finish_file looks for cs_running to tell it that
|
||||
it's interesting to check the file's modtime again now. */
|
||||
|
||||
if (! handling_fatal_signal)
|
||||
/* Notice if the target of the commands has been changed.
|
||||
This also propagates its values for command_state and
|
||||
@@ -524,9 +529,14 @@ start_job_command (child)
|
||||
{
|
||||
static int bad_stdin = -1;
|
||||
register char *p;
|
||||
int flags = child->file->cmds->lines_flags[child->command_line - 1];
|
||||
int flags;
|
||||
char **argv;
|
||||
|
||||
/* Combine the flags parsed for the line itself with
|
||||
the flags specified globally for this target. */
|
||||
flags = (child->file->command_flags
|
||||
| child->file->cmds->lines_flags[child->command_line - 1]);
|
||||
|
||||
p = child->command_ptr;
|
||||
child->noerror = flags & COMMANDS_NOERROR;
|
||||
while (*p != '\0')
|
||||
@@ -584,6 +594,12 @@ start_job_command (child)
|
||||
/* This line has no commands. Go to the next. */
|
||||
if (job_next_command (child))
|
||||
start_job_command (child);
|
||||
else
|
||||
{
|
||||
/* No more commands. All done. */
|
||||
child->file->update_status = 0;
|
||||
notice_finished_file (child->file);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -609,6 +625,7 @@ start_job_command (child)
|
||||
free ((char *) argv);
|
||||
if (job_next_command (child))
|
||||
start_job_command (child);
|
||||
child->file->update_status = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -774,15 +791,18 @@ start_waiting_job (c)
|
||||
unblock_sigs ();
|
||||
break;
|
||||
|
||||
case cs_not_started:
|
||||
/* All the command lines turned out to be empty. */
|
||||
c->file->update_status = 0;
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case cs_finished:
|
||||
notice_finished_file (c->file);
|
||||
free_child (c);
|
||||
break;
|
||||
|
||||
default:
|
||||
error ("internal error: `%s' command_state == %d in new_job",
|
||||
c->file->name, (int) c->file->command_state);
|
||||
abort ();
|
||||
assert (c->file->command_state == cs_finished);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -928,8 +948,11 @@ new_job (file)
|
||||
|
||||
/* Fetch the first command line to be run. */
|
||||
if (! job_next_command (c))
|
||||
/* There were no commands! */
|
||||
free_child (c);
|
||||
{
|
||||
/* There were no commands! */
|
||||
free_child (c);
|
||||
c->file->update_status = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The job is now primed. Start it running. */
|
||||
@@ -957,8 +980,6 @@ job_next_command (child)
|
||||
{
|
||||
/* There are no more lines to be expanded. */
|
||||
child->command_ptr = 0;
|
||||
child->file->command_state = cs_finished;
|
||||
child->file->update_status = 0;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
|
||||
212
main.c
212
main.c
@@ -46,6 +46,7 @@ static void log_working_directory ();
|
||||
static void print_data_base (), print_version ();
|
||||
static void decode_switches (), decode_env_switches ();
|
||||
static void define_makeflags ();
|
||||
static char *quote_as_word ();
|
||||
|
||||
/* The structure that describes an accepted command switch. */
|
||||
|
||||
@@ -271,13 +272,13 @@ static const struct command_switch switches[] =
|
||||
{ 'w', flag, (char *) &print_directory_flag, 1, 1, 0, 0, 0,
|
||||
"print-directory", 0,
|
||||
"Print the current directory" },
|
||||
{ 1, flag, (char *) &inhibit_print_directory_flag, 1, 1, 0, 0, 0,
|
||||
{ 2, flag, (char *) &inhibit_print_directory_flag, 1, 1, 0, 0, 0,
|
||||
"no-print-directory", 0,
|
||||
"Turn off -w, even if it was turned on implicitly" },
|
||||
{ 'W', string, (char *) &new_files, 0, 0, 0, 0, 0,
|
||||
"what-if", "FILE",
|
||||
"Consider FILE to be infinitely new" },
|
||||
{ 2, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
|
||||
{ 3, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
|
||||
"warn-undefined-variables", 0,
|
||||
"Warn when an undefined variable is referenced" },
|
||||
{ '\0', }
|
||||
@@ -345,6 +346,11 @@ struct file *default_goal_file;
|
||||
This is zero if the makefiles do not define .DEFAULT. */
|
||||
|
||||
struct file *default_file;
|
||||
|
||||
/* Nonzero if we have seen the magic `.POSIX' target.
|
||||
This turns on pedantic compliance with POSIX.2. */
|
||||
|
||||
int posix_pedantic;
|
||||
|
||||
/* Mask of signals that are being caught with fatal_error_signal. */
|
||||
|
||||
@@ -563,6 +569,53 @@ main (argc, argv, envp)
|
||||
(void) define_variable ("MAKE_COMMAND", 12, argv[0], o_default, 0);
|
||||
(void) define_variable ("MAKE", 4, "$(MAKE_COMMAND)", o_default, 1);
|
||||
|
||||
if (command_variables != 0)
|
||||
{
|
||||
struct command_variable *cv;
|
||||
struct variable *v;
|
||||
unsigned int len = 0;
|
||||
char *value, *p;
|
||||
|
||||
/* Figure out how much space will be taken up by the command-line
|
||||
variable definitions. */
|
||||
for (cv = command_variables; cv != 0; cv = cv->next)
|
||||
{
|
||||
v = cv->variable;
|
||||
len += 2 * strlen (v->name);
|
||||
if (! v->recursive)
|
||||
++len;
|
||||
++len;
|
||||
len += 2 * strlen (v->value);
|
||||
}
|
||||
|
||||
/* Now allocate a buffer big enough and fill it. */
|
||||
p = value = alloca (len);
|
||||
for (cv = command_variables; cv != 0; cv = cv->next)
|
||||
{
|
||||
v = cv->variable;
|
||||
p = quote_as_word (p, v->name, 0);
|
||||
if (! v->recursive)
|
||||
*p++ = ':';
|
||||
*p++ = '=';
|
||||
p = quote_as_word (p, v->value, 0);
|
||||
*p++ = ' ';
|
||||
}
|
||||
p[-1] = '\0'; /* Kill the final space and terminate. */
|
||||
|
||||
/* Define an unchangeable variable with a name that no POSIX.2
|
||||
makefile could validly use for its own variable. */
|
||||
(void) define_variable ("-*-command-variables-*-", 23,
|
||||
value, o_automatic, 0);
|
||||
|
||||
/* Define the variable; this will not override any user definition.
|
||||
Normally a reference to this variable is written into the value of
|
||||
MAKEFLAGS, allowing the user to override this value to affect the
|
||||
exported value of MAKEFLAGS. In POSIX-pedantic mode, we cannot
|
||||
allow the user's setting of MAKEOVERRIDES to affect MAKEFLAGS, so
|
||||
a reference to this hidden variable is written instead. */
|
||||
(void) define_variable ("MAKEOVERRIDES", 13,
|
||||
"${-*-command-variables-*-}", o_env, 1);
|
||||
}
|
||||
|
||||
/* If there were -C flags, move ourselves about. */
|
||||
if (directories != 0)
|
||||
@@ -732,12 +785,8 @@ main (argc, argv, envp)
|
||||
|
||||
define_makeflags (1, 0);
|
||||
|
||||
ignore_errors_flag |= lookup_file (".IGNORE") != 0;
|
||||
|
||||
silent_flag |= lookup_file (".SILENT") != 0;
|
||||
|
||||
/* Make each `struct dep' point at the
|
||||
`struct file' for the file depended on. */
|
||||
/* Make each `struct dep' point at the `struct file' for the file
|
||||
depended on. Also do magic for special targets. */
|
||||
|
||||
snap_deps ();
|
||||
|
||||
@@ -1155,9 +1204,26 @@ decode_switches (argc, argv, env)
|
||||
/* Reset getopt's state. */
|
||||
optind = 0;
|
||||
|
||||
while ((c = getopt_long (argc, argv,
|
||||
options, long_options, (int *) 0)) != EOF)
|
||||
c = 0;
|
||||
while (optind < argc)
|
||||
{
|
||||
if (c == EOF)
|
||||
{
|
||||
/* There are no more options according to getting getopt, but
|
||||
there are some arguments left. Since we have asked for
|
||||
non-option arguments to be returned in order, I think this
|
||||
only happens when there is a "--" argument to prevent later
|
||||
argument from being options. Since getopt has finished its
|
||||
job, just update its state variables for the next argument and
|
||||
set C as if it had returned 1, indicating a non-option
|
||||
argument. */
|
||||
optarg = argv[optind++];
|
||||
c = 1;
|
||||
}
|
||||
else
|
||||
/* Parse the next argument. */
|
||||
c = getopt_long (argc, argv, options, long_options, (int *) 0);
|
||||
|
||||
if (c == 1)
|
||||
{
|
||||
/* Non-option argument. It might be a variable definition. */
|
||||
@@ -1402,7 +1468,7 @@ decode_env_switches (envar, len)
|
||||
unsigned int len;
|
||||
{
|
||||
char *varref = (char *) alloca (2 + len + 2);
|
||||
char *value;
|
||||
char *value, *p;
|
||||
int argc;
|
||||
char **argv;
|
||||
|
||||
@@ -1412,7 +1478,7 @@ decode_env_switches (envar, len)
|
||||
bcopy (envar, &varref[2], len);
|
||||
varref[2 + len] = ')';
|
||||
varref[2 + len + 1] = '\0';
|
||||
value = allocated_variable_expand (varref);
|
||||
value = variable_expand (varref);
|
||||
|
||||
/* Skip whitespace, and check for an empty value. */
|
||||
value = next_token (value);
|
||||
@@ -1423,12 +1489,34 @@ decode_env_switches (envar, len)
|
||||
/* Allocate a vector that is definitely big enough. */
|
||||
argv = (char **) alloca ((1 + len + 1) * sizeof (char *));
|
||||
|
||||
/* Allocate a buffer to copy the value into while we split it into words
|
||||
and unquote it. We must use permanent storage for this because
|
||||
decode_switches may store pointers into the passed argument words. */
|
||||
p = (char *) xmalloc (2 * len);
|
||||
|
||||
/* getopt will look at the arguments starting at ARGV[1].
|
||||
Prepend a spacer word. */
|
||||
argv[0] = 0;
|
||||
argc = 1;
|
||||
while ((argv[argc] = find_next_token (&value, (unsigned int *) 0)) != 0)
|
||||
++argc;
|
||||
argv[argc] = p;
|
||||
while (*value != '\0')
|
||||
{
|
||||
if (*value == '\\')
|
||||
++value; /* Skip the backslash. */
|
||||
else if (isblank (*value))
|
||||
{
|
||||
/* End of the word. */
|
||||
*p++ = '\0';
|
||||
argv[++argc] = p;
|
||||
do
|
||||
++value;
|
||||
while (isblank (*value));
|
||||
continue;
|
||||
}
|
||||
*p++ = *value++;
|
||||
}
|
||||
*p = '\0';
|
||||
argv[++argc] = 0;
|
||||
|
||||
if (argc == 2 && argv[1][0] != '-')
|
||||
{
|
||||
@@ -1463,6 +1551,30 @@ decode_env_switches (envar, len)
|
||||
decode_switches (argc, argv, 1);
|
||||
}
|
||||
|
||||
/* Quote the string IN so that it will be interpreted as a single word with
|
||||
no magic by the shell; if DOUBLE_DOLLARS is nonzero, also double dollar
|
||||
signs to avoid variable expansion in make itself. Write the result into
|
||||
OUT, returning the address of the next character to be written.
|
||||
Allocating space for OUT twice the length of IN (thrice if
|
||||
DOUBLE_DOLLARS is nonzero) is always sufficient. */
|
||||
|
||||
static char *
|
||||
quote_as_word (out, in, double_dollars)
|
||||
char *out, *in;
|
||||
int double_dollars;
|
||||
{
|
||||
while (*in != '\0')
|
||||
{
|
||||
if (index ("^;'\"*?[]$<>(){}|&~`\\ \t\r\n\f\v", *in) != 0)
|
||||
*out++ = '\\';
|
||||
if (double_dollars && *in == '$')
|
||||
*out++ = '$';
|
||||
*out++ = *in++;
|
||||
}
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
/* Define the MAKEFLAGS and MFLAGS variables to reflect the settings of the
|
||||
command switches. Include options with args if ALL is nonzero.
|
||||
Don't include options with the `no_makefile' flag set if MAKEFILE. */
|
||||
@@ -1471,12 +1583,13 @@ static void
|
||||
define_makeflags (all, makefile)
|
||||
int all, makefile;
|
||||
{
|
||||
static const char ref[] = "$(MAKEOVERRIDES)";
|
||||
static const char posixref[] = "$(-*-command-variables-*-)";
|
||||
register const struct command_switch *cs;
|
||||
char *flagstring;
|
||||
register char *p;
|
||||
unsigned int words;
|
||||
struct variable *v;
|
||||
struct command_variable *cv;
|
||||
|
||||
/* We will construct a linked list of `struct flag's describing
|
||||
all the flags which need to go in MAKEFLAGS. Then, once we
|
||||
@@ -1488,7 +1601,6 @@ define_makeflags (all, makefile)
|
||||
struct flag *next;
|
||||
const struct command_switch *cs;
|
||||
char *arg;
|
||||
unsigned int arglen;
|
||||
};
|
||||
struct flag *flags = 0;
|
||||
unsigned int flagslen = 0;
|
||||
@@ -1497,13 +1609,12 @@ define_makeflags (all, makefile)
|
||||
struct flag *new = (struct flag *) alloca (sizeof (struct flag)); \
|
||||
new->cs = cs; \
|
||||
new->arg = (ARG); \
|
||||
new->arglen = (LEN); \
|
||||
new->next = flags; \
|
||||
flags = new; \
|
||||
if (new->arg == 0) \
|
||||
++flagslen; /* Just a single flag letter. */ \
|
||||
else \
|
||||
flagslen += 1 + 1 + 1 + 1 + new->arglen; /* " -x foo" */ \
|
||||
flagslen += 1 + 1 + 1 + 1 + 3 * (LEN); /* " -x foo" */ \
|
||||
if (!isalnum (cs->c)) \
|
||||
/* This switch has no single-letter version, so we use the long. */ \
|
||||
flagslen += 2 + strlen (cs->long_name); \
|
||||
@@ -1587,23 +1698,9 @@ define_makeflags (all, makefile)
|
||||
break;
|
||||
}
|
||||
|
||||
#undef ADD_FLAG
|
||||
flagslen += 4 + sizeof posixref; /* Four more for the possible " -- ". */
|
||||
|
||||
if (all && command_variables != 0)
|
||||
{
|
||||
/* Now figure out how much space will be taken up
|
||||
by the command-line variable definitions. */
|
||||
flagslen += 4; /* For the possible " -- ". */
|
||||
for (cv = command_variables; cv != 0; cv = cv->next)
|
||||
{
|
||||
v = cv->variable;
|
||||
flagslen += strlen (v->name);
|
||||
if (! v->recursive)
|
||||
++flagslen;
|
||||
++flagslen;
|
||||
flagslen += strlen (v->value);
|
||||
}
|
||||
}
|
||||
#undef ADD_FLAG
|
||||
|
||||
/* Construct the value in FLAGSTRING.
|
||||
We allocate enough space for a preceding dash and trailing null. */
|
||||
@@ -1624,16 +1721,15 @@ define_makeflags (all, makefile)
|
||||
*p++ = flags->cs->c;
|
||||
if (flags->arg != 0)
|
||||
{
|
||||
/* A flag that takes an optional argument which in this case
|
||||
is omitted is specified by ARG being "" and ARGLEN being 0.
|
||||
We must distinguish because a following flag appended without
|
||||
an intervening " -" is considered the arg for the first. */
|
||||
if (flags->arglen > 0)
|
||||
/* A flag that takes an optional argument which in this case is
|
||||
omitted is specified by ARG being "". We must distinguish
|
||||
because a following flag appended without an intervening " -"
|
||||
is considered the arg for the first. */
|
||||
if (flags->arg[0] != '\0')
|
||||
{
|
||||
/* Add its argument too. */
|
||||
*p++ = !isalnum (flags->cs->c) ? '=' : ' ';
|
||||
bcopy (flags->arg, p, flags->arglen);
|
||||
p += flags->arglen;
|
||||
p = quote_as_word (p, flags->arg, 1);
|
||||
}
|
||||
++words;
|
||||
/* Write a following space and dash, for the next flag. */
|
||||
@@ -1653,7 +1749,9 @@ define_makeflags (all, makefile)
|
||||
|
||||
if (all && command_variables != 0)
|
||||
{
|
||||
/* Now write all the command-line variable definitions. */
|
||||
/* Now write a reference to $(MAKEOVERRIDES), which contains all the
|
||||
command-line variable definitions. */
|
||||
|
||||
if (p == &flagstring[1])
|
||||
/* No flags written, so elide the leading dash already written. */
|
||||
p = flagstring;
|
||||
@@ -1670,28 +1768,22 @@ define_makeflags (all, makefile)
|
||||
*p++ = '-';
|
||||
*p++ = ' ';
|
||||
}
|
||||
for (cv = command_variables; cv != 0; cv = cv->next)
|
||||
|
||||
/* Copy in the string. */
|
||||
if (posix_pedantic)
|
||||
{
|
||||
/* XXX Quoting? */
|
||||
unsigned int len;
|
||||
v = cv->variable;
|
||||
len = strlen (v->name);
|
||||
bcopy (v->name, p, len);
|
||||
p += len;
|
||||
if (! v->recursive)
|
||||
*p++ = ':';
|
||||
len = strlen (v->value);
|
||||
bcopy (v->value, p, len);
|
||||
p += len;
|
||||
*p++ = ' ';
|
||||
++words;
|
||||
bcopy (posixref, p, sizeof posixref - 1);
|
||||
p += sizeof posixref - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
bcopy (ref, p, sizeof ref - 1);
|
||||
p += sizeof ref - 1;
|
||||
}
|
||||
--p; /* Kill the final space. */
|
||||
}
|
||||
else if (p[-1] == '-')
|
||||
/* Kill the final space and dash. */
|
||||
p -= 2;
|
||||
|
||||
/* Terminate the string. */
|
||||
*p = '\0';
|
||||
|
||||
@@ -1708,7 +1800,7 @@ define_makeflags (all, makefile)
|
||||
to redefine its value with the full set of
|
||||
switches. Of course, an override or command
|
||||
definition will still take precedence. */
|
||||
o_file, 0);
|
||||
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
|
||||
@@ -1716,7 +1808,7 @@ define_makeflags (all, makefile)
|
||||
v->export = v_export;
|
||||
/* Since MFLAGS is not parsed for flags, there is no reason to
|
||||
override any makefile redefinition. */
|
||||
(void) define_variable ("MFLAGS", 6, flagstring, o_env, 0);
|
||||
(void) define_variable ("MFLAGS", 6, flagstring, o_env, 1);
|
||||
}
|
||||
|
||||
/* Print version information. */
|
||||
|
||||
1
make.h
1
make.h
@@ -331,6 +331,7 @@ extern int just_print_flag, silent_flag, ignore_errors_flag, keep_going_flag;
|
||||
extern int debug_flag, print_data_base_flag, question_flag, touch_flag;
|
||||
extern int env_overrides, no_builtin_rules_flag, print_version_flag;
|
||||
extern int print_directory_flag, warn_undefined_variables_flag;
|
||||
extern int posix_pedantic;
|
||||
|
||||
extern unsigned int job_slots;
|
||||
extern double max_load_average;
|
||||
|
||||
183
make.texinfo
183
make.texinfo
@@ -8,10 +8,10 @@
|
||||
@c FSF publishers: format makebook.texi instead of using this file directly.
|
||||
|
||||
@set RCSID $Id$
|
||||
@set EDITION 0.46
|
||||
@set EDITION 0.47 DRAFT
|
||||
@set VERSION 3.72 Beta
|
||||
@set UPDATED 5 July 1994
|
||||
@set UPDATE-MONTH July 1994
|
||||
@set UPDATED 1 November 1994
|
||||
@set UPDATE-MONTH November 1994
|
||||
@set ISBN 1-882114-50-7
|
||||
|
||||
@c finalout
|
||||
@@ -2141,24 +2141,28 @@ match that file's name.
|
||||
@findex .IGNORE
|
||||
@item .IGNORE
|
||||
|
||||
Simply by being mentioned as a target, @code{.IGNORE} says to ignore
|
||||
errors in execution of commands. The dependencies and commands for
|
||||
@code{.IGNORE} are not meaningful.
|
||||
If you specify dependencies for @code{.IGNORE}, then @code{make} will
|
||||
ignore errors in execution of the commands run for those particular
|
||||
files. The commands for @code{.IGNORE} are not meaningful.
|
||||
|
||||
@samp{.IGNORE} exists for historical compatibility. Since
|
||||
@code{.IGNORE} affects every command in the makefile, it is not very
|
||||
useful; we recommend you use the more selective ways to ignore errors
|
||||
in specific commands. @xref{Errors, ,Errors in Commands}.
|
||||
If mentioned as a target with no dependencies, @code{.IGNORE} says to
|
||||
ignore errors in execution of commands for all files. This usage of
|
||||
@samp{.IGNORE} is supported only for historical compatibility. Since
|
||||
this affects every command in the makefile, it is not very useful; we
|
||||
recommend you use the more selective ways to ignore errors in specific
|
||||
commands. @xref{Errors, ,Errors in Commands}.
|
||||
|
||||
@findex .SILENT
|
||||
@item .SILENT
|
||||
|
||||
Simply by being mentioned as a target, @code{.SILENT} says not to
|
||||
print commands before executing them. The dependencies and commands
|
||||
for @code{.SILENT} are not meaningful.
|
||||
If you specify dependencies for @code{.SILENT}, then @code{make} will
|
||||
not the print commands to remake those particular files before executing
|
||||
them. The commands for @code{.SILENT} are not meaningful.
|
||||
|
||||
@samp{.SILENT} exists for historical compatibility. We recommend you
|
||||
use the more selective ways to silence specific commands.
|
||||
If mentioned as a target with no dependencies, @code{.SILENT} says not
|
||||
to print any commands before executing them. This usage of
|
||||
@samp{.SILENT} is supported only for historical compatibility. We
|
||||
recommend you use the more selective ways to silence specific commands.
|
||||
@xref{Echoing, ,Command Echoing}. If you want to silence all commands
|
||||
for a particular run of @code{make}, use the @samp{-s} or
|
||||
@w{@samp{--silent}} option (@pxref{Options Summary}).
|
||||
@@ -2583,7 +2587,7 @@ called @file{@var{name}.d} from a C source file called @file{@var{name}.c}:
|
||||
@group
|
||||
%.d: %.c
|
||||
$(SHELL) -ec '$(CC) -M $(CPPFLAGS) $< \
|
||||
| sed '\''s/$*.o/& $@@/g'\'' > $@@'
|
||||
| sed '\''s/$*\\.o[ :]*/& $@@/g'\'' > $@@'
|
||||
@end group
|
||||
@end example
|
||||
|
||||
@@ -2596,6 +2600,12 @@ shell exits with the status of the last command in the pipeline
|
||||
status from the compiler.
|
||||
@cindex @code{-e} (shell flag)
|
||||
|
||||
@cindex @code{-MM} (to GNU compiler)
|
||||
With the GNU C compiler, you may wish to use the @samp{-MM} flag instead
|
||||
of @samp{-M}. This omits dependencies on system header files.
|
||||
@xref{Preprocessor Options, , Options Controlling the Preprocessor,
|
||||
gcc.info, Using GNU CC}, for details.
|
||||
|
||||
@cindex @code{sed} (shell command)
|
||||
The purpose of the @code{sed} command is to translate (for example):
|
||||
|
||||
@@ -2643,11 +2653,13 @@ with no further work from you. @xref{Remaking Makefiles}.
|
||||
@cindex rule commands
|
||||
@cindex writing rule commands
|
||||
|
||||
The commands of a rule consist of shell command lines to be executed one by
|
||||
one. Each command line must start with a tab, except that the first
|
||||
The commands of a rule consist of shell command lines to be executed one
|
||||
by one. Each command line must start with a tab, except that the first
|
||||
command line may be attached to the target-and-dependencies line with a
|
||||
semicolon in between. Blank lines and lines of just comments may appear
|
||||
among the command lines; they are ignored.
|
||||
among the command lines; they are ignored. (But beware, an apparently
|
||||
``blank'' line that begins with a tab is @emph{not} blank! It is an
|
||||
empty command; @pxref{Empty Commands}.)
|
||||
|
||||
Users use many different shell programs, but commands in makefiles are
|
||||
always interpreted by @file{/bin/sh} unless the makefile specifies
|
||||
@@ -2713,7 +2725,7 @@ actually doing them.
|
||||
The @samp{-s} or @samp{--silent}
|
||||
flag to @code{make} prevents all echoing, as if all commands
|
||||
started with @samp{@@}. A rule in the makefile for the special target
|
||||
@code{.SILENT} has the same effect
|
||||
@code{.SILENT} without dependencies has the same effect
|
||||
(@pxref{Special Targets, ,Special Built-in Target Names}).
|
||||
@code{.SILENT} is essentially obsolete since @samp{@@} is more flexible.@refill
|
||||
|
||||
@@ -2902,10 +2914,10 @@ This causes @code{rm} to continue even if it is unable to remove a file.
|
||||
@cindex @code{--ignore-errors}
|
||||
@findex .IGNORE
|
||||
When you run @code{make} with the @samp{-i} or @samp{--ignore-errors}
|
||||
flag, errors are ignored in
|
||||
all commands of all rules. A rule in the makefile for the special target
|
||||
@code{.IGNORE} has the same effect. These ways of ignoring errors are
|
||||
obsolete because @samp{-} is more flexible.
|
||||
flag, errors are ignored in all commands of all rules. A rule in the
|
||||
makefile for the special target @code{.IGNORE} has the same effect, if
|
||||
there are no dependencies. These ways of ignoring errors are obsolete
|
||||
because @samp{-} is more flexible.
|
||||
|
||||
When errors are to be ignored, because of either a @samp{-} or the
|
||||
@samp{-i} flag, @code{make} treats an error return just like success,
|
||||
@@ -2918,6 +2930,7 @@ can any other that depends on it either directly or indirectly. No further
|
||||
commands will be executed for these targets, since their preconditions
|
||||
have not been achieved.
|
||||
|
||||
|
||||
@cindex @code{-k}
|
||||
@cindex @code{--keep-going}
|
||||
Normally @code{make} gives up immediately in this circumstance, returning a
|
||||
@@ -2939,11 +2952,28 @@ is why Emacs' @code{compile} command passes the @samp{-k} flag by
|
||||
default.
|
||||
@cindex Emacs (@code{M-x compile})
|
||||
|
||||
@findex .DELETE_ON_ERROR
|
||||
@cindex deletion of target files
|
||||
@cindex removal of target files
|
||||
@cindex target, deleting on error
|
||||
Usually when a command fails, if it has changed the target file at all,
|
||||
the file is corrupted and cannot be used---or at least it is not
|
||||
completely updated. Yet the file's timestamp says that it is now up to
|
||||
date, so the next time @code{make} runs, it will not try to update that
|
||||
file. The situation is just the same as when the command is killed by a
|
||||
signal; @pxref{Interrupts}. So generally the right thing to do is to
|
||||
delete the target file if the command fails after beginning to change
|
||||
the file. @code{make} will do this if @code{.DELETE_ON_ERROR} appears
|
||||
as a target. This is almost always what you want @code{make} to do, but
|
||||
it is not historical practice; so for compatibility, you must explicitly
|
||||
request it.
|
||||
|
||||
@node Interrupts, Recursion, Errors, Commands
|
||||
@section Interrupting or Killing @code{make}
|
||||
@cindex interrupt
|
||||
@cindex signal
|
||||
@cindex deletion of target files
|
||||
@cindex removal of target files
|
||||
@cindex target, deleting on interrupt
|
||||
@cindex killing (interruption)
|
||||
|
||||
@@ -3034,28 +3064,6 @@ is @samp{cd subdir; /bin/make}. If you use a special version of
|
||||
executed for recursive invocations.
|
||||
@cindex @code{cd} (shell command)
|
||||
|
||||
Also, any arguments that define variable values are added to @code{MAKE},
|
||||
so the sub-@code{make} gets them too. Thus, if you do @samp{make
|
||||
CFLAGS=-O}, so that all C compilations will be optimized, the
|
||||
sub-@code{make} is run with @samp{cd subdir; /bin/make CFLAGS=-O}.@refill
|
||||
|
||||
@vindex MAKE_COMMAND
|
||||
@vindex MAKEOVERRIDES
|
||||
The @code{MAKE} variable actually just refers to two other variables
|
||||
which contain these special values. In fact, @code{MAKE} is always
|
||||
defined as @samp{$(MAKE_COMMAND) $(MAKEOVERRIDES)}. The variable
|
||||
@code{MAKE_COMMAND} is the file name with which @code{make} was invoked
|
||||
(such as @file{/bin/make}, above). The variable @code{MAKEOVERRIDES}
|
||||
contains definitions for the variables defined on the command line; in
|
||||
the above example, its value is @samp{CFLAGS=-O}. If you @emph{do not}
|
||||
want these variable definitions done in all recursive @code{make}
|
||||
invocations, you can redefine the @code{MAKEOVERRIDES} variable to
|
||||
remove them. You do this in any of the normal ways for defining
|
||||
variables: in a makefile (@pxref{Setting, ,Setting Variables}); on the command
|
||||
line with an argument like @samp{MAKEOVERRIDES=}
|
||||
(@pxref{Overriding, ,Overriding Variables}); or with an environment variable
|
||||
(@pxref{Environment, ,Variables from the Environment}).
|
||||
|
||||
As a special feature, using the variable @code{MAKE} in the commands of
|
||||
a rule alters the effects of the @samp{-t} (@samp{--touch}), @samp{-n}
|
||||
(@samp{--just-print}), or @samp{-q} (@w{@samp{--question}}) option.
|
||||
@@ -3098,9 +3106,9 @@ commands, is propagated to the subsystem.@refill
|
||||
Variable values of the top-level @code{make} can be passed to the
|
||||
sub-@code{make} through the environment by explicit request. These
|
||||
variables are defined in the sub-@code{make} as defaults, but do not
|
||||
override what is specified in the sub-@code{make}'s makefile unless
|
||||
you use the @samp{-e} switch
|
||||
(@pxref{Options Summary, ,Summary of Options}).@refill
|
||||
override what is specified in the makefile used by the sub-@code{make}
|
||||
makefile unless you use the @samp{-e} switch (@pxref{Options Summary,
|
||||
,Summary of Options}).@refill
|
||||
|
||||
To pass down, or @dfn{export}, a variable, @code{make} adds the variable
|
||||
and its value to the environment for running each command. The
|
||||
@@ -3118,6 +3126,15 @@ The special variables @code{SHELL} and @code{MAKEFLAGS} are always
|
||||
exported (unless you unexport them).
|
||||
@code{MAKEFILES} is exported if you set it to anything.
|
||||
|
||||
@code{make} automatically passes down variable values that were defined
|
||||
on the command line, by putting them in the @code{MAKEFLAGS} variable.
|
||||
@iftex
|
||||
See the next section.
|
||||
@end iftex
|
||||
@ifinfo
|
||||
@xref{Options/Recursion}.
|
||||
@end ifinfo
|
||||
|
||||
Variables are @emph{not} normally passed down if they were created by
|
||||
default by @code{make} (@pxref{Implicit Variables, ,Variables Used by
|
||||
Implicit Rules}). The sub-@code{make} will define these for
|
||||
@@ -3266,6 +3283,15 @@ in its environment. In response, it takes the flags from that value and
|
||||
processes them as if they had been given as arguments.
|
||||
@xref{Options Summary, ,Summary of Options}.
|
||||
|
||||
@cindex command line variable definitions, and recursion
|
||||
@cindex variables, command line, and recursion
|
||||
@cindex recursion, and command line variable definitions
|
||||
Likewise variables defined on the command line are passed to the
|
||||
sub-@code{make} through @code{MAKEFLAGS}. Words in the value of
|
||||
@code{MAKEFLAGS} that contain @samp{=}, @code{make} treats as variable
|
||||
definitions just as if they appeared on the command line.
|
||||
@xref{Overriding, ,Overriding Variables}.
|
||||
|
||||
@cindex @code{-C}, and recursion
|
||||
@cindex @code{-f}, and recursion
|
||||
@cindex @code{-I}, and recursion
|
||||
@@ -3315,13 +3341,39 @@ subsystem:
|
||||
cd subdir; $(MAKE) MAKEFLAGS=
|
||||
@end example
|
||||
|
||||
@vindex MAKEOVERRIDES
|
||||
The command line variable definitions really appear in the variable
|
||||
@code{MAKEOVERRIDES}, and @code{MAKEFLAGS} contains a reference to this
|
||||
variable. If you do want to pass flags down normally, but don't want to
|
||||
pass down the command line variable definitions, you can reset
|
||||
@code{MAKEOVERRIDES} to empty, like this:
|
||||
|
||||
@example
|
||||
MAKEOVERRIDES =
|
||||
@end example
|
||||
|
||||
@noindent
|
||||
@cindex Arg list too long
|
||||
@cindex E2BIG
|
||||
This is not usually useful to do. However, some systems have a small
|
||||
fixed limit on the size of the environment, and putting so much
|
||||
information in into the value of @code{MAKEFLAGS} can exceed it.
|
||||
If you see the error message @samp{Arg list too long}, this may be the problem.
|
||||
@findex .POSIX
|
||||
@cindex POSIX.2
|
||||
(For strict compliance with POSIX.2, changing @code{MAKEOVERRIDES} does
|
||||
not affect @code{MAKEFLAGS} if the special target @samp{.POSIX} appears
|
||||
in the makefile. You probably do not care about this.)
|
||||
|
||||
@vindex MFLAGS
|
||||
A similar variable @code{MFLAGS} exists also, for historical compatibility.
|
||||
It has the same value as @code{MAKEFLAGS} except that it always begins with
|
||||
a hyphen unless it is empty (@code{MAKEFLAGS} begins with a hyphen only when
|
||||
it begins with an option that has no single-letter version, such as
|
||||
@samp{--warn-undefined-variables}). @code{MFLAGS} was traditionally used
|
||||
explicitly in the recursive @code{make} command, like this:
|
||||
A similar variable @code{MFLAGS} exists also, for historical
|
||||
compatibility. It has the same value as @code{MAKEFLAGS} except that it
|
||||
does not contain the command line variable definitions, and it always
|
||||
begins with a hyphen unless it is empty (@code{MAKEFLAGS} begins with a
|
||||
hyphen only when it begins with an option that has no single-letter
|
||||
version, such as @samp{--warn-undefined-variables}). @code{MFLAGS} was
|
||||
traditionally used explicitly in the recursive @code{make} command, like
|
||||
this:
|
||||
|
||||
@example
|
||||
subsystem:
|
||||
@@ -7110,6 +7162,14 @@ the value of @code{$^} contains just one copy of the name.
|
||||
@cindex dependencies, list of all
|
||||
@cindex list of all dependencies
|
||||
|
||||
@vindex $+
|
||||
@vindex + @r{(automatic variable)}
|
||||
@item $+
|
||||
This is like @samp{$^}, but dependencies listed more than once are
|
||||
duplicated in the order they were listed in the makefile. This is
|
||||
primarily useful for use in linking commands where it is meaningful to
|
||||
repeat library file names in a particular order.
|
||||
|
||||
@vindex $*
|
||||
@vindex * @r{(automatic variable)}
|
||||
@item $*
|
||||
@@ -7934,8 +7994,9 @@ same time. @xref{Chained Rules, ,Chains of Implicit Rules}.
|
||||
|
||||
@item
|
||||
The automatic variable @code{$^} containing a list of all dependencies
|
||||
of the current target. We did not invent this, but we have no idea who did.
|
||||
@xref{Automatic, ,Automatic Variables}.
|
||||
of the current target. We did not invent this, but we have no idea who
|
||||
did. @xref{Automatic, ,Automatic Variables}. The automatic variable
|
||||
@code{$+} is a simple extension of @code{$^}.
|
||||
|
||||
@item
|
||||
The ``what if'' flag (@samp{-W} in GNU @code{make}) was (as far as we know)
|
||||
@@ -8403,9 +8464,11 @@ For dependencies which are archive members, only
|
||||
the member named is used (@pxref{Archives}).
|
||||
|
||||
@item $^
|
||||
@itemx $+
|
||||
The names of all the dependencies, with spaces between them. For
|
||||
dependencies which are archive members, only the member named is used
|
||||
(@pxref{Archives}).
|
||||
(@pxref{Archives}). The value of @code{$^} omits duplicate
|
||||
dependencies, while @code{$+} retains them and preserves their order.
|
||||
|
||||
@item $*
|
||||
The stem with which an implicit rule matches
|
||||
@@ -8431,6 +8494,10 @@ The directory part and the file-within-directory part of @code{$<}.
|
||||
@itemx $(^F)
|
||||
The directory part and the file-within-directory part of @code{$^}.
|
||||
|
||||
@item $(+D)
|
||||
@itemx $(+F)
|
||||
The directory part and the file-within-directory part of @code{$+}.
|
||||
|
||||
@item $(?D)
|
||||
@itemx $(?F)
|
||||
The directory part and the file-within-directory part of @code{$?}.
|
||||
|
||||
13
remake.c
13
remake.c
@@ -21,6 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#include "job.h"
|
||||
#include "dep.h"
|
||||
#include "file.h"
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef HAVE_FCNTL_H
|
||||
#include <fcntl.h>
|
||||
@@ -277,9 +278,7 @@ update_file (file, depth)
|
||||
return 0;
|
||||
|
||||
default:
|
||||
error ("internal error: `%s' command_state == %d in update_file",
|
||||
f->name, (int) f->command_state);
|
||||
abort ();
|
||||
assert (f->command_state == cs_running);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -572,13 +571,9 @@ update_file_1 (file, depth)
|
||||
case 0:
|
||||
DEBUGPR ("Successfully remade target file `%s'.\n");
|
||||
break;
|
||||
case -1:
|
||||
error ("internal error: `%s' update_status is -1 at cs_finished!",
|
||||
file->name);
|
||||
abort ();
|
||||
default:
|
||||
error ("internal error: `%s' update_status invalid!", file->name);
|
||||
abort ();
|
||||
assert (file->update_status == 0 || file->update_status == 1);
|
||||
break;
|
||||
}
|
||||
|
||||
file->updated = 1;
|
||||
|
||||
@@ -20,14 +20,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
|
||||
#include <signal.h>
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#if defined (emacs) || defined (CONFIG_BROKETS)
|
||||
/* We use <config.h> instead of "config.h" so that a compilation
|
||||
using -I. -I$srcdir will use ./config.h rather than $srcdir/config.h
|
||||
(which it would do because it found this file in $srcdir). */
|
||||
#include <config.h>
|
||||
#else
|
||||
#include "config.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Some systems do not define NSIG in <signal.h>. */
|
||||
|
||||
@@ -387,12 +387,14 @@ define_automatic_variables ()
|
||||
define_variable ("<D", 2, "$(patsubst %/,%,$(dir $<))", o_automatic, 1);
|
||||
define_variable ("?D", 2, "$(patsubst %/,%,$(dir $?))", o_automatic, 1);
|
||||
define_variable ("^D", 2, "$(patsubst %/,%,$(dir $^))", o_automatic, 1);
|
||||
define_variable ("+D", 2, "$(patsubst %/,%,$(dir $+))", o_automatic, 1);
|
||||
define_variable ("@F", 2, "$(notdir $@)", o_automatic, 1);
|
||||
define_variable ("%F", 2, "$(notdir $%)", o_automatic, 1);
|
||||
define_variable ("*F", 2, "$(notdir $*)", o_automatic, 1);
|
||||
define_variable ("<F", 2, "$(notdir $<)", o_automatic, 1);
|
||||
define_variable ("?F", 2, "$(notdir $?)", o_automatic, 1);
|
||||
define_variable ("^F", 2, "$(notdir $^)", o_automatic, 1);
|
||||
define_variable ("+F", 2, "$(notdir $+)", o_automatic, 1);
|
||||
}
|
||||
|
||||
int export_all_variables;
|
||||
|
||||
Reference in New Issue
Block a user