mirror of
https://salsa.debian.org/srivasta/make-dfsg.git
synced 2024-12-26 14:00:56 +00:00
Don't write "Entering" every time we re-exec for remake makefiles.
This commit is contained in:
parent
30a5ee0d85
commit
4120f91846
6 changed files with 65 additions and 10 deletions
|
@ -1,3 +1,10 @@
|
|||
2013-09-19 Paul Smith <psmith@gnu.org>
|
||||
|
||||
* main.c (main): Set MAKE_RESTARTS to negative before re-exec if
|
||||
we've already generated an "Entering" message. If we are started
|
||||
and notice that MAKE_RESTARTS is negative, assume we already wrote
|
||||
"Entering" and don't write it again.
|
||||
|
||||
2013-09-18 Paul Smith <psmith@gnu.org>
|
||||
|
||||
* main.c (main): Set starting_directory before we write any
|
||||
|
|
20
main.c
20
main.c
|
@ -1332,11 +1332,17 @@ main (int argc, char **argv, char **envp)
|
|||
shell_var.value = xstrdup (ep + 1);
|
||||
}
|
||||
|
||||
/* If MAKE_RESTARTS is set, remember it but don't export it. */
|
||||
if (streq (v->name, "MAKE_RESTARTS"))
|
||||
/* If MAKE_RESTARTS is set, remember it but don't export it.
|
||||
If it's negative, it means the "enter" message was printed. */
|
||||
else if (streq (v->name, "MAKE_RESTARTS"))
|
||||
{
|
||||
v->export = v_noexport;
|
||||
restarts = (unsigned int) atoi (ep + 1);
|
||||
if (*(++ep) == '-')
|
||||
{
|
||||
OUTPUT_TRACED ();
|
||||
++ep;
|
||||
}
|
||||
restarts = (unsigned int) atoi (ep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2309,7 +2315,8 @@ main (int argc, char **argv, char **envp)
|
|||
else if (strneq (*p, "MAKE_RESTARTS=", CSTRLEN ("MAKE_RESTARTS=")))
|
||||
{
|
||||
*p = alloca (40);
|
||||
sprintf (*p, "MAKE_RESTARTS=%u", restarts);
|
||||
sprintf (*p, "MAKE_RESTARTS=%s%u",
|
||||
OUTPUT_IS_TRACED () ? "-" : "", restarts);
|
||||
restarts = 0;
|
||||
}
|
||||
}
|
||||
|
@ -2321,7 +2328,7 @@ main (int argc, char **argv, char **envp)
|
|||
sprintf (buffer, "%u", makelevel);
|
||||
SetVar (MAKELEVEL_NAME, buffer, -1, GVF_GLOBAL_ONLY);
|
||||
|
||||
sprintf (buffer, "%u", restarts);
|
||||
sprintf (buffer, "%s%u", OUTPUT_IS_TRACED () ? "-" : "", restarts);
|
||||
SetVar ("MAKE_RESTARTS", buffer, -1, GVF_GLOBAL_ONLY);
|
||||
restarts = 0;
|
||||
}
|
||||
|
@ -2331,7 +2338,8 @@ main (int argc, char **argv, char **envp)
|
|||
if (restarts)
|
||||
{
|
||||
char *b = alloca (40);
|
||||
sprintf (b, "MAKE_RESTARTS=%u", restarts);
|
||||
sprintf (b, "MAKE_RESTARTS=%s%u",
|
||||
OUTPUT_IS_TRACED () ? "-" : "", restarts);
|
||||
putenv (b);
|
||||
}
|
||||
|
||||
|
|
7
output.c
7
output.c
|
@ -36,7 +36,7 @@ this program. If not, see <http://www.gnu.org/licenses/>. */
|
|||
#endif /* WINDOWS32 */
|
||||
|
||||
struct output *output_context = NULL;
|
||||
static unsigned int stdio_traced = 0;
|
||||
unsigned int stdio_traced = 0;
|
||||
|
||||
#define OUTPUT_NONE (-1)
|
||||
|
||||
|
@ -374,15 +374,14 @@ output_dump (struct output *out)
|
|||
int traced = 0;
|
||||
|
||||
/* Try to acquire the semaphore. If it fails, dump the output
|
||||
unsynchronized; still better than silently discarding it. */
|
||||
unsynchronized; still better than silently discarding it.
|
||||
We want to keep this lock for as little time as possible. */
|
||||
void *sem = acquire_semaphore ();
|
||||
|
||||
/* Log the working directory for this dump. */
|
||||
if (print_directory_flag && output_sync != OUTPUT_SYNC_RECURSE)
|
||||
traced = log_working_directory (output_context, 1);
|
||||
|
||||
/* We've entered the "critical section" during which a lock is held. We
|
||||
want to keep it as short as possible. */
|
||||
if (outfd_not_empty)
|
||||
pump_from_tmp (out->out, stdout);
|
||||
if (errfd_not_empty && out->err != out->out)
|
||||
|
|
4
output.h
4
output.h
|
@ -22,10 +22,14 @@ struct output
|
|||
};
|
||||
|
||||
extern struct output *output_context;
|
||||
extern unsigned int stdio_traced;
|
||||
|
||||
#define OUTPUT_SET(_new) do{ if ((_new)->syncout) output_context = (_new); }while(0)
|
||||
#define OUTPUT_UNSET() do{ output_context = NULL; }while(0)
|
||||
|
||||
#define OUTPUT_TRACED() do{ stdio_traced = 1; }while(0)
|
||||
#define OUTPUT_IS_TRACED() (!!stdio_traced)
|
||||
|
||||
FILE *output_tmpfile (char **, const char *);
|
||||
|
||||
/* Initialize and close a child output structure: if NULL do this program's
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2013-09-21 Paul Smith <psmith@gnu.org>
|
||||
|
||||
* scripts/options/dash-w: Add a test for -w flag.
|
||||
|
||||
2013-09-15 Paul Smith <psmith@gnu.org>
|
||||
|
||||
* scripts/misc/fopen-fail: Check for failure on infinite recursion.
|
||||
|
|
33
tests/scripts/options/dash-w
Normal file
33
tests/scripts/options/dash-w
Normal file
|
@ -0,0 +1,33 @@
|
|||
# -*-perl-*-
|
||||
|
||||
$description = "Test the -w option to GNU make.";
|
||||
|
||||
# Simple test without -w
|
||||
run_make_test(q!
|
||||
all: ; @echo hi
|
||||
!,
|
||||
"", "hi\n");
|
||||
|
||||
# Simple test with -w
|
||||
run_make_test(undef, "-w",
|
||||
"#MAKE#: Entering directory '#PWD#'\nhi\n#MAKE#: Leaving directory '#PWD#'\n");
|
||||
|
||||
# Test makefile rebuild to ensure no enter/leave
|
||||
run_make_test(q!
|
||||
include foo
|
||||
all: ;@:
|
||||
foo: ; touch foo
|
||||
!,
|
||||
"", "#MAKEFILE#:2: foo: No such file or directory\ntouch foo\n");
|
||||
unlink('foo');
|
||||
|
||||
# Test makefile rebuild with -w
|
||||
run_make_test(q!
|
||||
include foo
|
||||
all: ;@:
|
||||
foo: ; touch foo
|
||||
!,
|
||||
"-w", "#MAKE#: Entering directory '#PWD#'\n#MAKEFILE#:2: foo: No such file or directory\ntouch foo\n#MAKE#: Leaving directory '#PWD#'\n");
|
||||
unlink('foo');
|
||||
|
||||
1;
|
Loading…
Reference in a new issue