mirror of
https://github.com/mirror/make.git
synced 2025-04-02 15:41:18 +08:00
* Various changes.
This commit is contained in:
parent
4ff6c62456
commit
6fa76a7d15
25
ChangeLog
25
ChangeLog
@ -1,4 +1,21 @@
|
|||||||
1999-08-13 Paul D. Smith <psmith@gnu.org>
|
1999-08-20 Paul D. Smith <psmith@gnu.org>
|
||||||
|
|
||||||
|
* variable.c (try_variable_definition): Allocate for variable
|
||||||
|
expansion in f_append with a simple variable: if we're looking at
|
||||||
|
target-specific variables we don't want to trash the buffer.
|
||||||
|
Noticed by Reiner Beninga <Reiner.Beninga@mchp.siemens.de>.
|
||||||
|
|
||||||
|
1999-08-16 Eli Zaretskii <eliz@is.elta.co.il>
|
||||||
|
|
||||||
|
* main.c (main) [__MSDOS__]: Mirror any backslashes in argv[0], to
|
||||||
|
avoid problems in shell commands that use backslashes as escape
|
||||||
|
characters.
|
||||||
|
|
||||||
|
1999-08-16 Paul D. Smith <psmith@gnu.org>
|
||||||
|
|
||||||
|
* Version 3.77.93 released.
|
||||||
|
|
||||||
|
1999-08-13 Paul D. Smith <psmith@gnu.org
|
||||||
|
|
||||||
* function.c (func_if): New function $(if ...) based on the
|
* function.c (func_if): New function $(if ...) based on the
|
||||||
original by Han-Wen but reworked quite a bit.
|
original by Han-Wen but reworked quite a bit.
|
||||||
@ -11,9 +28,9 @@
|
|||||||
|
|
||||||
1999-08-12 Paul D. Smith <psmith@gnu.org>
|
1999-08-12 Paul D. Smith <psmith@gnu.org>
|
||||||
|
|
||||||
Argh. Another jobserver algorithm change. We conveniently forgot
|
Another jobserver algorithm change. We conveniently forgot that
|
||||||
that the blocking bit is shared by all users of the pipe, it's not
|
the blocking bit is shared by all users of the pipe, it's not a
|
||||||
a per-process setting. Since we have many make processes all
|
per-process setting. Since we have many make processes all
|
||||||
sharing the pipe we can't use the blocking bit as a signal handler
|
sharing the pipe we can't use the blocking bit as a signal handler
|
||||||
flag. Instead, we'll dup the pipe's read FD and have the SIGCHLD
|
flag. Instead, we'll dup the pipe's read FD and have the SIGCHLD
|
||||||
handler close the dup'd FD. This will cause the read() to fail
|
handler close the dup'd FD. This will cause the read() to fail
|
||||||
|
60
job.c
60
job.c
@ -90,7 +90,7 @@ static int amiga_batch_file;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_WAITPID
|
#ifdef HAVE_WAITPID
|
||||||
# define WAIT_NOHANG (status) waitpid (-1, (status), WNOHANG)
|
# define WAIT_NOHANG(status) waitpid (-1, (status), WNOHANG)
|
||||||
#else /* Don't have waitpid. */
|
#else /* Don't have waitpid. */
|
||||||
# ifdef HAVE_WAIT3
|
# ifdef HAVE_WAIT3
|
||||||
# ifndef wait3
|
# ifndef wait3
|
||||||
@ -326,13 +326,11 @@ child_handler (sig)
|
|||||||
{
|
{
|
||||||
++dead_children;
|
++dead_children;
|
||||||
|
|
||||||
#ifdef HAVE_JOBSERVER
|
|
||||||
if (job_rfd >= 0)
|
if (job_rfd >= 0)
|
||||||
{
|
{
|
||||||
close (job_rfd);
|
close (job_rfd);
|
||||||
job_rfd = -1;
|
job_rfd = -1;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
if (debug_flag)
|
if (debug_flag)
|
||||||
printf (_("Got a SIGCHLD; %u unreaped children.\n"), dead_children);
|
printf (_("Got a SIGCHLD; %u unreaped children.\n"), dead_children);
|
||||||
@ -348,19 +346,35 @@ extern int shell_function_pid, shell_function_completed;
|
|||||||
complete child, waiting for it to die if necessary. If ERR is nonzero,
|
complete child, waiting for it to die if necessary. If ERR is nonzero,
|
||||||
print an error message first. */
|
print an error message first. */
|
||||||
|
|
||||||
|
static int rc_block, rc_reap_all, rc_got_block, rc_start_rfd, rc_end_rfd;
|
||||||
|
|
||||||
void
|
void
|
||||||
reap_children (block, err)
|
reap_children (block, err)
|
||||||
int block, err;
|
int block, err;
|
||||||
{
|
{
|
||||||
WAIT_T status;
|
WAIT_T status;
|
||||||
#ifdef WAIT_NOHANG
|
|
||||||
/* Initially, assume we have some. */
|
/* Initially, assume we have some. */
|
||||||
int reap_more = 1;
|
int reap_more = 1;
|
||||||
|
|
||||||
|
#ifdef WAIT_NOHANG
|
||||||
# define REAP_MORE reap_more
|
# define REAP_MORE reap_more
|
||||||
#else
|
#else
|
||||||
# define REAP_MORE dead_children
|
# define REAP_MORE dead_children
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
rc_block = block;
|
||||||
|
rc_reap_all = 0;
|
||||||
|
rc_got_block = 0;
|
||||||
|
rc_start_rfd = job_rfd;
|
||||||
|
|
||||||
|
/* As long as:
|
||||||
|
|
||||||
|
We have at least one child outstanding OR a shell function in progress,
|
||||||
|
AND
|
||||||
|
We're blocking for a complete child OR there are more children to reap
|
||||||
|
|
||||||
|
we'll keep reaping children. */
|
||||||
|
|
||||||
while ((children != 0 || shell_function_pid != 0) &&
|
while ((children != 0 || shell_function_pid != 0) &&
|
||||||
(block || REAP_MORE))
|
(block || REAP_MORE))
|
||||||
{
|
{
|
||||||
@ -456,10 +470,11 @@ reap_children (block, err)
|
|||||||
|
|
||||||
if (pid < 0)
|
if (pid < 0)
|
||||||
{
|
{
|
||||||
/* The wait*() failed miserably. Punt. */
|
/* EINTR? Try again. */
|
||||||
if (EINTR_SET)
|
if (EINTR_SET)
|
||||||
goto local_wait;
|
goto local_wait;
|
||||||
|
|
||||||
|
/* The wait*() failed miserably. Punt. */
|
||||||
pfatal_with_name ("wait");
|
pfatal_with_name ("wait");
|
||||||
}
|
}
|
||||||
else if (pid > 0)
|
else if (pid > 0)
|
||||||
@ -472,26 +487,25 @@ reap_children (block, err)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* No local children are dead. */
|
/* No local children are dead. */
|
||||||
#ifdef WAIT_NOHANG
|
|
||||||
reap_more = 0;
|
reap_more = 0;
|
||||||
#endif
|
rc_reap_all = 1;
|
||||||
if (block && any_remote)
|
|
||||||
{
|
if (!block || !any_remote)
|
||||||
/* Now try a blocking wait for a remote child. */
|
break;
|
||||||
pid = remote_status (&exit_code, &exit_sig, &coredump, 1);
|
|
||||||
if (pid < 0)
|
/* Now try a blocking wait for a remote child. */
|
||||||
goto remote_status_lose;
|
pid = remote_status (&exit_code, &exit_sig, &coredump, 1);
|
||||||
else if (pid == 0)
|
if (pid < 0)
|
||||||
/* No remote children either. Finally give up. */
|
goto remote_status_lose;
|
||||||
break;
|
else if (pid == 0)
|
||||||
else
|
/* No remote children either. Finally give up. */
|
||||||
/* We got a remote child. */
|
break;
|
||||||
remote = 1;
|
|
||||||
}
|
/* We got a remote child. */
|
||||||
else
|
remote = 1;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
#endif /* !__MSDOS__, !Amiga, !WINDOWS32. */
|
#endif /* !__MSDOS__, !Amiga, !WINDOWS32. */
|
||||||
|
|
||||||
#ifdef __MSDOS__
|
#ifdef __MSDOS__
|
||||||
/* Life is very different on MSDOS. */
|
/* Life is very different on MSDOS. */
|
||||||
pid = dos_pid - 1;
|
pid = dos_pid - 1;
|
||||||
@ -703,8 +717,10 @@ reap_children (block, err)
|
|||||||
|
|
||||||
/* Only block for one child. */
|
/* Only block for one child. */
|
||||||
block = 0;
|
block = 0;
|
||||||
|
rc_block = block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rc_end_rfd = job_rfd;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
main.c
16
main.c
@ -945,7 +945,7 @@ int main (int argc, char ** argv)
|
|||||||
if (print_version_flag)
|
if (print_version_flag)
|
||||||
die (0);
|
die (0);
|
||||||
|
|
||||||
#if !defined(__MSDOS__) && !defined(VMS)
|
#ifndef VMS
|
||||||
/* Set the "MAKE_COMMAND" variable to the name we were invoked with.
|
/* Set the "MAKE_COMMAND" variable to the name we were invoked with.
|
||||||
(If it is a relative pathname with a slash, prepend our directory name
|
(If it is a relative pathname with a slash, prepend our directory name
|
||||||
so the result will run the same program regardless of the current dir.
|
so the result will run the same program regardless of the current dir.
|
||||||
@ -963,9 +963,21 @@ int main (int argc, char ** argv)
|
|||||||
strneq(argv[0], "//", 2))
|
strneq(argv[0], "//", 2))
|
||||||
argv[0] = xstrdup(w32ify(argv[0],1));
|
argv[0] = xstrdup(w32ify(argv[0],1));
|
||||||
#else /* WINDOWS32 */
|
#else /* WINDOWS32 */
|
||||||
|
#ifdef __MSDOS__
|
||||||
|
if (strchr (argv[0], '\\'))
|
||||||
|
{
|
||||||
|
char *p;
|
||||||
|
|
||||||
|
argv[0] = xstrdup (argv[0]);
|
||||||
|
for (p = argv[0]; *p; p++)
|
||||||
|
if (*p == '\\')
|
||||||
|
*p = '/';
|
||||||
|
}
|
||||||
|
#else /* !__MSDOS__ */
|
||||||
if (current_directory[0] != '\0'
|
if (current_directory[0] != '\0'
|
||||||
&& argv[0] != 0 && argv[0][0] != '/' && index (argv[0], '/') != 0)
|
&& argv[0] != 0 && argv[0][0] != '/' && index (argv[0], '/') != 0)
|
||||||
argv[0] = concat (current_directory, "/", argv[0]);
|
argv[0] = concat (current_directory, "/", argv[0]);
|
||||||
|
#endif /* !__MSDOS__ */
|
||||||
#endif /* WINDOWS32 */
|
#endif /* WINDOWS32 */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1339,6 +1351,8 @@ int main (int argc, char ** argv)
|
|||||||
submakes it's the token they were given by their parent. For the
|
submakes it's the token they were given by their parent. For the
|
||||||
top make, we just subtract one from the number the user wants. */
|
top make, we just subtract one from the number the user wants. */
|
||||||
|
|
||||||
|
job_slots = 1; /* !!!!!DEBUG!!!!! */
|
||||||
|
|
||||||
while (--job_slots)
|
while (--job_slots)
|
||||||
{
|
{
|
||||||
write (job_fds[1], &c, 1);
|
write (job_fds[1], &c, 1);
|
||||||
|
@ -18,7 +18,7 @@ MTEMPLATES = Makefile.DOS SMakefile
|
|||||||
|
|
||||||
# General rule for turning a .template into a regular file.
|
# General rule for turning a .template into a regular file.
|
||||||
#
|
#
|
||||||
$(TEMPLATES) : % : %.template configure.in
|
$(TEMPLATES) : % : %.template Makefile
|
||||||
rm -f $@
|
rm -f $@
|
||||||
sed -e 's@%VERSION%@$(VERSION)@g' \
|
sed -e 's@%VERSION%@$(VERSION)@g' \
|
||||||
-e 's@%PACKAGE%@$(PACKAGE)@g' \
|
-e 's@%PACKAGE%@$(PACKAGE)@g' \
|
||||||
@ -27,7 +27,7 @@ $(TEMPLATES) : % : %.template configure.in
|
|||||||
|
|
||||||
# Construct Makefiles by adding on dependencies, etc.
|
# Construct Makefiles by adding on dependencies, etc.
|
||||||
#
|
#
|
||||||
$(MTEMPLATES) : % : %.template .dep_segment Makefile.am maintMakefile
|
$(MTEMPLATES) : % : %.template .dep_segment Makefile
|
||||||
rm -f $@
|
rm -f $@
|
||||||
sed -e 's@%VERSION%@$(VERSION)@g' \
|
sed -e 's@%VERSION%@$(VERSION)@g' \
|
||||||
-e 's@%PROGRAMS%@$(bin_PROGRAMS)@g' \
|
-e 's@%PROGRAMS%@$(bin_PROGRAMS)@g' \
|
||||||
@ -40,7 +40,7 @@ $(MTEMPLATES) : % : %.template .dep_segment Makefile.am maintMakefile
|
|||||||
cat $(word 2,$^) >>$@
|
cat $(word 2,$^) >>$@
|
||||||
chmod a-w $@
|
chmod a-w $@
|
||||||
|
|
||||||
NMakefile: NMakefile.template .dep_segment Makefile.am maintMakefile
|
NMakefile: NMakefile.template .dep_segment Makefile
|
||||||
rm -f $@
|
rm -f $@
|
||||||
cp $< $@
|
cp $< $@
|
||||||
echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
|
echo >>$@; echo '# --------------- DEPENDENCIES' >>$@; echo '#' >>$@; \
|
||||||
@ -49,7 +49,7 @@ NMakefile: NMakefile.template .dep_segment Makefile.am maintMakefile
|
|||||||
|
|
||||||
# Construct build.sh.in
|
# Construct build.sh.in
|
||||||
#
|
#
|
||||||
build.sh.in: build.template Makefile.am maintMakefile
|
build.sh.in: build.template Makefile
|
||||||
rm -f $@
|
rm -f $@
|
||||||
sed -e 's@%objs%@$(filter-out remote-%, $(make_OBJECTS)@g' \
|
sed -e 's@%objs%@$(filter-out remote-%, $(make_OBJECTS)@g' \
|
||||||
-e 's@%globobjs%@$(patsubst %.c,%.o,$(globsrc)))@g' \
|
-e 's@%globobjs%@$(patsubst %.c,%.o,$(globsrc)))@g' \
|
||||||
|
@ -2750,9 +2750,9 @@ called @file{@var{name}.d} from a C source file called @file{@var{name}.c}:
|
|||||||
@smallexample
|
@smallexample
|
||||||
@group
|
@group
|
||||||
%.d: %.c
|
%.d: %.c
|
||||||
$(SHELL) -ec '$(CC) -M $(CPPFLAGS) $< \
|
set -e; $(CC) -M $(CPPFLAGS) $< \
|
||||||
| sed '\''s/\($*\)\.o[ :]*/\1.o $@@ : /g'\'' > $@@; \
|
| sed 's/\($*\)\.o[ :]*/\1.o $@@ : /g' > $@@; \
|
||||||
[ -s $@@ ] || rm -f $@@'
|
[ -s $@@ ] || rm -f $@@
|
||||||
@end group
|
@end group
|
||||||
@end smallexample
|
@end smallexample
|
||||||
|
|
||||||
|
12
variable.c
12
variable.c
@ -780,9 +780,9 @@ try_variable_definition (flocp, line, origin)
|
|||||||
case f_simple:
|
case f_simple:
|
||||||
/* A simple variable definition "var := value". Expand the value.
|
/* A simple variable definition "var := value". Expand the value.
|
||||||
We have to allocate memory since otherwise it'll clobber the
|
We have to allocate memory since otherwise it'll clobber the
|
||||||
variable buffer, and we still need that. */
|
variable buffer, and we may still need that if we're looking at a
|
||||||
alloc_value = allocated_variable_expand (p);
|
target-specific variable. */
|
||||||
value = alloc_value;
|
value = alloc_value = allocated_variable_expand (p);
|
||||||
break;
|
break;
|
||||||
case f_conditional:
|
case f_conditional:
|
||||||
/* A conditional variable definition "var ?= value".
|
/* A conditional variable definition "var ?= value".
|
||||||
@ -824,8 +824,10 @@ try_variable_definition (flocp, line, origin)
|
|||||||
else
|
else
|
||||||
/* The previous definition of the variable was simple.
|
/* The previous definition of the variable was simple.
|
||||||
The new value comes from the old value, which was expanded
|
The new value comes from the old value, which was expanded
|
||||||
when it was set; and from the expanded new value. */
|
when it was set; and from the expanded new value. Allocate
|
||||||
p = variable_expand (p);
|
memory for the expansion as we may still need the rest of the
|
||||||
|
buffer if we're looking at a target-specific variable. */
|
||||||
|
p = alloc_value = allocated_variable_expand (p);
|
||||||
|
|
||||||
oldlen = strlen (v->value);
|
oldlen = strlen (v->value);
|
||||||
newlen = strlen (p);
|
newlen = strlen (p);
|
||||||
|
Loading…
Reference in New Issue
Block a user