* A large number of fixes/enhancements. See the ChangeLog.

* Added a new version of the German translation file.
This commit is contained in:
Paul Smith 2000-03-27 06:54:37 +00:00
parent a81013175c
commit c637af71d9
17 changed files with 1959 additions and 1721 deletions

View File

@ -1,3 +1,25 @@
2000-03-27 Paul D. Smith <psmith@gnu.org>
* remake.c (start_updating, finish_updating, is_updating): Fix
PR/1671; circular dependencies in double-colon rules are not
diagnosed. These macros set the updating flag in the root
double-colon file instead of the current one, if it's part of a
double-colon list. This solution provided by Tim Magill
<magill@gate.net>; I just changed the macro names :).
(update_file_1): Call them.
(check_dep): Call them.
The change to not automatically evaluate the $(call ...)
function's arguments breaks recursive use of call. Although using
$(if ...) and $(foreach ...) in $(call ...) macros is important,
the error conditions generated are simply to obscure for me to
feel comfortable with. If a method is devised to get both
working, we'll revisit. For now, remove this change.
* function.c (function_table): Turn on the expand bit for func_call.
(func_call): Don't expand arguments for builtin functions; that
will have already been done.
2000-03-26 Paul D. Smith <psmith@gnu.org>
* file.c (remove_intermediates): Never remove targets explicitly
@ -23,6 +45,48 @@
* make.h: Ditto.
Reported by Marco Franzen <Marco.Franzen@Thyron.com>.
2000-03-08 Tim Magill <magill@gate.net>
* remake.c (update_file): Return the exit status of the pruned
file when pruning, not just 0. Fixes PR/1634.
2000-02-24 Paul D. Smith <psmith@gnu.org>
* configure.in: Close a minor potential security hole; if you're
reading makefiles from stdin (who does that?) you could run into a
race condition with the temp file using mktemp() or tmpnam(). Add
a check for mkstemp() and fdopen().
* main.c (open_tmpfile): New function to open a temporary file.
If we have mkstemp() (and fdopen()), use that. If not use
mktemp() or tmpnam(). If we have fdopen(), use open() to open the
file O_CREAT|O_EXCL. If not, fall back to normal fopen() (insecure).
(main): Call it.
* job.c (child_execute_job) [VMS]: Call it.
* variable.c (lookup_variable): If we find a variable which is
being expanded, then note it but keep looking through the rest of
the set list to see if we can find one that isn't. If we do,
return that. If we don't, return the original. Fix for PR/1610.
While implementing this I realized that it also solves PR/1380 in
a much more elegant way. I don't know what I was smoking before.
So, remove the hackage surrounding the original fix for that (see
below). Change this function back to lookup_variable and remove
the extra setlist argument.
* variable.h (recursively_expand_setlist): Remove the macro,
rename the prototype, and remove the extra setlist argument.
(lookup_variable): Ditto.
* expand.c (recursively_expand): Rename and remove the extra
setlist argument.
(reference_variable): Use lookup_variable() again.
(allocated_variable_append): Remove the extra setlist argument.
2000-02-21 Paul D. Smith <psmith@gnu.org>
* README.template: A few updates.
* i18n/de.po: New version from the German translation team.
2000-02-09 Paul D. Smith <psmith@gnu.org>
* Version 3.78.91 released.
@ -42,6 +106,7 @@
implementing expansion of these references separately from the
"normal" expansion, say, instead of using the same codepath.
Actually, it's already "worse enough" :-/.
Fix for PR/1380.
* variable.h (recursively_expand_setlist): Rename
recursively_expand to add a struct variable_set_list argument, and

View File

@ -19,6 +19,13 @@ Some systems' Make programs are broken and cannot process the Makefile for
GNU Make. If you get errors from your system's Make when building GNU
Make, try using `build.sh' instead.
GNU Make is free software. See the file COPYING for copying conditions.
Documentation
-------------
GNU make is fully documented in the GNU Make manual, which is contained
in this distribution as the file make.texinfo. You can also find
on-line and preformatted (PostScript and DVI) versions at the FSF's web
@ -30,6 +37,10 @@ site. There is information there about ordering hardcopy documentation.
You can also find the latest versions of GNU Make from there.
Bug Reporting
-------------
You can send GNU make bug reports to <bug-make@gnu.org>. Please see the
section of the GNU make manual entitled `Problems and Bugs' for
information on submitting useful and complete bug reports.
@ -49,17 +60,36 @@ If you need help using GNU make, try these forums:
news:gnu.utils.help
news:gnu.utils.bug
Also:
CVS Access
----------
The GNU make source repository is available via anonymous CVS from the
GNU Subversions CVS server; look here for details:
http://www.gnu.org/software/devel.html
Please note: you won't be able to build GNU make from CVS without
installing appropriate maintainer's tools, such as automake, autoconf,
GNU make, and GCC. There are no instructions on this included with the
tree, so you must be familiar with the installation and use of these
tools. We make no guarantees about the contents or quality of the
latest code in the CVS repository: it is not unheard of for code that is
known to be broken to be checked in. Use at your own risk.
Ports
-----
- See README.customs for details on integrating GNU make with the
Customs distributed build environment from the Pmake distribution.
- See readme.vms for details about GNU Make on OpenVMS.
- See README.W32 for details about GNU Make on Windows NT, 95, or 98.
- See README.Amiga for details about GNU Make on AmigaDOS.
- See README.W32 for details about GNU Make on Windows NT, 95, or 98.
- See README.DOS for compilation instructions on MS-DOS and MS-Windows
using DJGPP tools.
@ -67,8 +97,10 @@ Also:
of DJGPP; see the WWW page http://www.delorie.com/djgpp/ for more
information.
GNU Make is free software. See the file COPYING for copying conditions.
Please note there are two _separate_ ports of GNU make for Microsoft
systems: a native Windows tool built with (for example) MSVC or Cygwin,
and a DOS-based tool built with DJGPP. Please be sure you are looking
at the right README!
System-specific Notes

View File

@ -60,7 +60,7 @@ AC_MSG_RESULT($ac_cv_check_symbol_$1)])dnl
# clock_gettime is in -lposix4 in Solaris 2.6.
AC_CHECK_LIB(posix4, clock_gettime)
AC_CHECK_FUNCS(memmove strchr memcpy strdup psignal mktemp pstat_getdynamic \
AC_CHECK_FUNCS(memmove strchr memcpy strdup psignal mkstemp mktemp fdopen \
clock_gettime dup2 getcwd sigsetmask sigaction getgroups \
setlinebuf seteuid setegid setreuid setregid pipe \
strerror strsignal)
@ -74,6 +74,7 @@ AC_FUNC_SETVBUF_REVERSED
AC_FUNC_SELECT
AC_CHECK_LIB(kstat, kstat_open) dnl _Must_ come before AC_FUNC_GETLOADAVG.
AC_CHECK_FUNCS(pstat_getdynamic) dnl Supposedly in AC_FUNC_GETLOADAVG, but...?
AC_FUNC_GETLOADAVG
# Check out the wait reality.

View File

@ -91,13 +91,11 @@ initialize_variable_output ()
/* Recursively expand V. The returned string is malloc'd. */
static char *allocated_variable_append PARAMS ((struct variable *v,
struct variable_set_list *l));
static char *allocated_variable_append PARAMS ((struct variable *v));
char *
recursively_expand_setlist (v, list)
recursively_expand (v)
register struct variable *v;
struct variable_set_list *list;
{
char *value;
@ -109,7 +107,7 @@ recursively_expand_setlist (v, list)
v->expanding = 1;
if (v->append)
value = allocated_variable_append (v, list);
value = allocated_variable_append (v);
else
value = allocated_variable_expand (v->value);
v->expanding = 0;
@ -144,10 +142,9 @@ reference_variable (o, name, length)
unsigned int length;
{
register struct variable *v;
struct variable_set_list *setlist;
char *value;
v = lookup_variable_setlist (name, length, &setlist);
v = lookup_variable (name, length);
if (v == 0)
warn_undefined (name, length);
@ -155,7 +152,7 @@ reference_variable (o, name, length)
if (v == 0 || *v->value == '\0')
return o;
value = (v->recursive ? recursively_expand_setlist (v, setlist) : v->value);
value = (v->recursive ? recursively_expand (v) : v->value);
o = variable_buffer_output (o, value, strlen (value));
@ -472,9 +469,8 @@ variable_expand_for_file (line, file)
context of the next variable set, then we append the expanded value. */
static char *
allocated_variable_append (v, list)
allocated_variable_append (v)
struct variable *v;
struct variable_set_list *list;
{
struct variable_set_list *save;
int len = strlen (v->name);
@ -486,12 +482,9 @@ allocated_variable_append (v, list)
variable_buffer = 0;
if (!list)
list = current_variable_set_list;
assert(list->next != 0);
assert(current_variable_set_list->next != 0);
save = current_variable_set_list;
current_variable_set_list = list->next;
current_variable_set_list = current_variable_set_list->next;
var[0] = '$';
var[1] = '(';

View File

@ -1536,7 +1536,10 @@ func_shell (char *o, char **argv, const char *funcname)
if (command_argv == 0)
return o;
/* Note the mktemp() is a security hole, but this only runs on Amiga.
Ideally we would use main.c:open_tmpfile(), but this uses a special
Open(), not fopen(), and I'm not familiar enough with the code to mess
with it. */
strcpy (tmp_output, "t:MakeshXXXXXXXX");
mktemp (tmp_output);
child_stdout = Open (tmp_output, MODE_NEWFILE);
@ -1662,7 +1665,7 @@ static struct function_table_entry function_table[] =
{ STRING_SIZE_TUPLE("words"), 1, 1, 1, func_words},
{ STRING_SIZE_TUPLE("origin"), 1, 1, 1, func_origin},
{ STRING_SIZE_TUPLE("foreach"), 3, 3, 0, func_foreach},
{ STRING_SIZE_TUPLE("call"), 1, 0, 0, func_call},
{ STRING_SIZE_TUPLE("call"), 1, 0, 1, func_call},
{ STRING_SIZE_TUPLE("error"), 1, 1, 1, func_error},
{ STRING_SIZE_TUPLE("warning"), 1, 1, 1, func_error},
{ STRING_SIZE_TUPLE("if"), 2, 3, 0, func_if},
@ -1824,60 +1827,38 @@ func_call (o, argv, funcname)
int i;
const struct function_table_entry *entry_p;
fname = expand_argument (argv[0], NULL);
/* There is no way to define a variable with a space in the name, so strip
leading and trailing whitespace as a favor to the user. */
cp = fname;
while (*cp != '\0' && isspace ((unsigned char)*cp))
++cp;
argv[0] = cp;
fname = argv[0];
while (*fname != '\0' && isspace ((unsigned char)*fname))
++fname;
cp += strlen(cp) - 1;
while (cp > argv[0] && isspace ((unsigned char)*cp))
cp = fname + strlen(fname) - 1;
while (cp > fname && isspace ((unsigned char)*cp))
--cp;
cp[1] = '\0';
/* Calling nothing is a no-op */
if (*argv[0] == '\0')
{
free (fname);
return o;
}
if (*fname == '\0')
return o;
/* Are we invoking a builtin function? */
entry_p = lookup_function (function_table, argv[0]);
entry_p = lookup_function (function_table, fname);
if (entry_p)
{
char **av;
free (fname);
/* How many arguments do we have? */
for (i=0; argv[i+1]; ++i)
;
/* If we need to expand arguments, do it now. */
if (entry_p->expand_args)
for (av=argv+1; *av; ++av)
*av = expand_argument (*av, NULL);
o = expand_builtin_function (o, i, argv+1, entry_p);
/* What we expanded we must free... */
if (entry_p->expand_args)
for (av=argv+1; *av; ++av)
free (*av);
return o;
return expand_builtin_function (o, i, argv+1, entry_p);
}
/* Not a builtin, so the first argument is the name of a variable to be
expanded and interpreted as a function. Create the variable
reference. */
flen = strlen (argv[0]);
flen = strlen (fname);
body = alloca (flen + 4);
body[0] = '$';
@ -1905,6 +1886,5 @@ func_call (o, argv, funcname)
pop_variable_scope ();
free (fname);
return o + strlen(o);
}

3165
i18n/de.po

File diff suppressed because it is too large Load Diff

21
job.c
View File

@ -1795,7 +1795,7 @@ child_execute_job (argv, child)
int status;
char *cmd = alloca (strlen (argv) + 512), *p, *q;
char ifile[256], ofile[256], efile[256];
char comname[50];
char *comname = 0;
char procname[100];
/* Parse IO redirection. */
@ -1944,8 +1944,6 @@ child_execute_job (argv, child)
is desired. Forcing commands with newlines into DCLs allows to
store search lists on user mode logicals. */
comname[0] = '\0';
if (strlen (cmd) > MAXCMDLEN
|| (have_redirection != 0)
|| (have_newline != 0))
@ -1962,12 +1960,9 @@ child_execute_job (argv, child)
return 0;
}
strcpy (comname, "sys$scratch:CMDXXXXXX.COM");
(void) mktemp (comname);
outfile = fopen (comname, "w");
outfile = open_tmpfile (&comname, "sys$scratch:CMDXXXXXX.COM");
if (outfile == 0)
pfatal_with_name (comname);
pfatal_with_name (_("fopen (temporary file)"));
if (ifile[0])
{
@ -2150,7 +2145,7 @@ child_execute_job (argv, child)
fflush (stdout);
}
if (comname[0] && !ISDB (DB_JOBS))
if (comname && !ISDB (DB_JOBS))
unlink (comname);
return (status & 1);
@ -2465,10 +2460,10 @@ construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr)
slow_flag = strcmp((s1 ? s1 : ""), (s2 ? s2 : ""));
if (s1);
free(s1);
if (s2);
free(s2);
if (s1)
free (s1);
if (s2)
free (s2);
}
if (slow_flag)
goto slow;

79
main.c
View File

@ -68,7 +68,6 @@ extern void exit PARAMS ((int)) __attribute__ ((noreturn));
# endif
extern double atof ();
#endif
extern char *mktemp ();
static void print_data_base PARAMS ((void));
static void print_version PARAMS ((void));
@ -728,6 +727,51 @@ msdos_return_to_initial_directory ()
}
#endif
extern char *mktemp ();
extern int mkstemp ();
FILE *
open_tmpfile(name, template)
char **name;
const char *template;
{
int fd;
#if defined HAVE_MKSTEMP || defined HAVE_MKTEMP
# define TEMPLATE_LEN strlen (template)
#else
# define TEMPLATE_LEN L_tmpnam
#endif
*name = xmalloc (TEMPLATE_LEN + 1);
strcpy (*name, template);
#if defined HAVE_MKSTEMP && defined HAVE_FDOPEN
/* It's safest to use mkstemp(), if we can. */
fd = mkstemp (*name);
if (fd == -1)
return 0;
return fdopen (fd, "w");
#else
# ifdef HAVE_MKTEMP
(void) mktemp (*name);
# else
(void) tmpnam (*name);
# endif
# ifdef HAVE_FDOPEN
/* Can't use mkstemp(), but guard against a race condition. */
fd = open (*name, O_CREAT|O_EXCL|O_WRONLY, 0600);
if (fd == -1)
return 0;
return fdopen (fd, "w");
# else
/* Not secure, but what can we do? */
return fopen (*name, "w");
# endif
#endif
}
#ifndef _AMIGA
int
main (argc, argv, envp)
@ -1212,24 +1256,16 @@ int main (int argc, char ** argv)
into a temporary file and read from that. */
FILE *outfile;
/* Make a unique filename. */
#ifdef HAVE_MKTEMP
#ifdef VMS
static char name[] = "sys$scratch:GmXXXXXX";
#else
static char name[] = "/tmp/GmXXXXXX";
#endif
(void) mktemp (name);
#else
static char name[L_tmpnam];
(void) tmpnam (name);
#endif
if (stdin_nm)
fatal (NILF, _("Makefile from standard input specified twice."));
outfile = fopen (name, "w");
#ifdef VMS
# define TMP_TEMPLATE "sys$scratch:GmXXXXXX"
#else
# define TMP_TEMPLATE "/tmp/GmXXXXXX"
#endif
outfile = open_tmpfile (&stdin_nm, TMP_TEMPLATE);
if (outfile == 0)
pfatal_with_name (_("fopen (temporary file)"));
while (!feof (stdin))
@ -1243,16 +1279,9 @@ int main (int argc, char ** argv)
/* Replace the name that read_all_makefiles will
see with the name of the temporary file. */
{
char *temp;
/* SGI compiler requires alloca's result be assigned simply. */
temp = (char *) alloca (sizeof (name));
bcopy (name, temp, sizeof (name));
makefiles->list[i] = temp;
}
makefiles->list[i] = xstrdup (stdin_nm);
/* Make sure the temporary file will not be remade. */
stdin_nm = savestring (name, sizeof (name) -1);
f = enter_file (stdin_nm);
f->updated = 1;
f->update_status = 0;
@ -2683,7 +2712,7 @@ die (status)
print_version ();
/* Wait for children to die. */
for (err = status != 0; job_slots_used > 0; err = 0)
for (err = (status != 0); job_slots_used > 0; err = 0)
reap_children (1, err);
/* Let the remote job module clean up its state. */

1
make.h
View File

@ -407,6 +407,7 @@ extern int alpha_compare PARAMS ((const void *, const void *));
extern void print_spaces PARAMS ((unsigned int));
extern char *find_char_unquote PARAMS ((char *, char *, int));
extern char *find_percent PARAMS ((char *));
extern FILE *open_tmpfile PARAMS ((char **, const char *));
#ifndef NO_ARCHIVES
extern int ar_name PARAMS ((char *));

View File

@ -43,6 +43,18 @@ Boston, MA 02111-1307, USA. */
extern int try_implicit_rule PARAMS ((struct file *file, unsigned int depth));
/* The test for circular dependencies is based on the 'updating' bit in
`struct file'. However, double colon targets have seperate `struct
file's; make sure we always use the base of the double colon chain. */
#define start_updating(_f) (((_f)->double_colon ? (_f)->double_colon : (_f))\
->updating = 1)
#define finish_updating(_f) (((_f)->double_colon ? (_f)->double_colon : (_f))\
->updating = 0)
#define is_updating(_f) (((_f)->double_colon ? (_f)->double_colon : (_f))\
->updating)
/* Incremented when a command is started (under -n, when one would be). */
unsigned int commands_started = 0;
@ -282,7 +294,7 @@ update_file (file, depth)
if (f->considered == considered)
{
DBF (DB_VERBOSE, _("Pruning file `%s'.\n"));
return 0;
return f->command_state == cs_finished ? f->update_status : 0;
}
/* This loop runs until we start commands for a double colon rule, or until
@ -368,7 +380,7 @@ update_file_1 (file, depth)
++depth;
/* Notice recursive update of the same file. */
file->updating = 1;
start_updating (file);
/* Looking at the file's modtime beforehand allows the possibility
that its name may be changed by a VPATH search, and thus it may
@ -416,7 +428,7 @@ update_file_1 (file, depth)
mtime = file_mtime (d->file);
check_renamed (d->file);
if (d->file->updating)
if (is_updating (d->file))
{
error (NILF, _("Circular %s <- %s dependency dropped."),
file->name, d->file->name);
@ -494,7 +506,7 @@ update_file_1 (file, depth)
}
}
file->updating = 0;
finish_updating (file);
DBF (DB_VERBOSE, _("Finished prerequisites of target file `%s'.\n"));
@ -788,7 +800,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
int dep_status = 0;
++depth;
file->updating = 1;
start_updating (file);
if (!file->intermediate)
/* If this is a non-intermediate file, update it and record
@ -840,7 +852,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
d = file->deps;
while (d != 0)
{
if (d->file->updating)
if (is_updating (d->file))
{
error (NILF, _("Circular %s <- %s dependency dropped."),
file->name, d->file->name);
@ -879,7 +891,7 @@ check_dep (file, depth, this_mtime, must_make_ptr)
}
}
file->updating = 0;
finish_updating (file);
return dep_status;
}

View File

@ -1,8 +1,28 @@
2000-03-27 Paul D. Smith <psmith@gnu.org>
* scripts/features/reinvoke: Make more robust by touching "b"
first, to ensure it's not newer than "a".
Reported by Marco Franzen <Marco.Franzen@Thyron.com>.
* scripts/functions/call: Whoops. The fix to PR/1527 caused
recursive invocations of $(call ...) to break. I can't come up
with any way to get both working at the same time, so I backed out
the fix to 1527 and added a test case for recursive calls.
* scripts/features/double_colon: Test that circular dependencies
in double-colon rule sets are detected correctly (PR/1671).
2000-03-26 Paul D. Smith <psmith@gnu.org>
* scripts/targets/INTERMEDIATE: Test that make doesn't remove
.INTERMEDIATE files when given on the command line (PR/1669).
2000-03-08 Paul D. Smith <psmith@gnu.org>
* scripts/options/dash-k: Add a test for error detection by
multiple targets depending on the same prerequisite with -k.
For PR/1634.
2000-02-07 Paul D. Smith <psmith@gnu.org>
* scripts/features/escape: Add a test for backslash-escaped spaces

View File

@ -36,6 +36,9 @@ two: ; @echo two
f1.h f2.h: ; @echo $@
d :: ; @echo ok
d :: d ; @echo oops
EOF
close(MAKEFILE);
@ -95,6 +98,12 @@ $answer = "f2.h\nfoo SECOND\n";
$answer = "f2.h\nfoo SECOND\n";
&compare_output($answer, &get_logfile(1));
# TEST 8: Test circular dependency check; PR/1671
&run_make_with_options($makefile, "d", &get_logfile, 0);
$answer = "ok\n$make_name: Circular d <- d dependency dropped.\noops\n";
&compare_output($answer, &get_logfile(1));
# TEST 8: I don't grok why this is different than the above, but it is...
#
# Hmm... further testing indicates this might be timing-dependent?

View File

@ -65,7 +65,8 @@ EOM
close(MAKEFILE);
&touch('a','b');
&touch('b');
&touch('a');
sleep(2);
&touch('c');

View File

@ -26,23 +26,35 @@ my-notdir = $(call notdir,$(1))
my-foreach = $(foreach $(1),$(2),$(3))
my-if = $(if $(1),$(2),$(3))
# Test recursive invocations of call with different arguments
#
one = $(1) $(2) $(3)
two = $(call one,$(1),foo,$(2))
all: ; @echo '$(call reverse,bar,foo)'; \
echo '$(call map,origin,MAKE reverse map)'; \
echo '$(call my-notdir,a/b c/d e/f)'; \
echo '$(call my-foreach)'; \
echo '$(call my-foreach,a,,,)'; \
echo '$(call my-foreach,a,x y z,$(a)$(a))'; \
echo '$(call my-if,a,b,c)'; \
echo '$(call my-if,,$(warning don't print this),ok)'
echo '$(call two,bar,baz)'
EOMAKE
# These won't work until/unless PR/1527 is resolved.
# echo '$(call my-foreach,a,x y z,$(a)$(a))'; \
# echo '$(call my-if,,$(warning don't print this),ok)'
#
# $answer = "xx yy zz\nok\n";
# END of Contents of MAKEFILE
close(MAKEFILE);
&run_make_with_options($makefile, "", &get_logfile);
$answer = "foo bar\ndefault file file\nb d f\n\n\nxx yy zz\nb\nok\n";
$answer = "foo bar\ndefault file file\nb d f\n\n\nb\nbar foo baz\n";
&compare_output($answer, &get_logfile(1));
1;

View File

@ -1,36 +1,37 @@
$description = "The following test creates a makefile to test the -k option.\n"
."Normally, make gives up immediately if an error happens \n"
."that make has not been told to ignore. However, if the -k\n"
."option is specified, make continues to consider the other\n"
."dependencies of the pending targets.";
# -*-perl-*-
$details = "The makefile created in this test is a simulation of building \n"
."a small product. However, the trick to this one is that one \n"
."of the dependencies of the main target does not exist. \n"
."Without the -k option, make would fail immediately and not \n"
."build any part of the target. What we are looking for here, \n"
."is that make builds the rest of the dependencies even though \n"
."it knows that at the end it will fail to rebuild the main target.";
$description = "Test the make -k (don't stop on error) option.\n";
$details = "\
The makefile created in this test is a simulation of building
a small product. However, the trick to this one is that one
of the dependencies of the main target does not exist.
Without the -k option, make would fail immediately and not
build any part of the target. What we are looking for here,
is that make builds the rest of the dependencies even though
it knows that at the end it will fail to rebuild the main target.";
open(MAKEFILE,"> $makefile");
# The Contents of the MAKEFILE ...
print MAKEFILE "VPATH = $workdir\n";
print MAKEFILE "edit: main.o kbd.o commands.o display.o \n";
print MAKEFILE "\t\@echo cc -o edit main.o kbd.o commands.o display.o \n";
print MAKEFILE <<EOF;
VPATH = $workdir
edit: main.o kbd.o commands.o display.o
\t\@echo cc -o edit main.o kbd.o commands.o display.o
print MAKEFILE "main.o : main.c defs.h\n";
print MAKEFILE "\t\@echo cc -c main.c\n";
main.o : main.c defs.h
\t\@echo cc -c main.c
print MAKEFILE "kbd.o : kbd.c defs.h command.h\n";
print MAKEFILE "\t\@echo cc -c kbd.c\n";
kbd.o : kbd.c defs.h command.h
\t\@echo cc -c kbd.c
print MAKEFILE "commands.o : command.c defs.h command.h\n";
print MAKEFILE "\t\@echo cc -c commands.c\n";
commands.o : command.c defs.h command.h
\t\@echo cc -c commands.c
print MAKEFILE "display.o : display.c defs.h buffer.h\n";
print MAKEFILE "\t\@echo cc -c display.c\n";
display.o : display.c defs.h buffer.h
\t\@echo cc -c display.c
EOF
# END of Contents of MAKEFILE
@ -45,29 +46,55 @@ close(MAKEFILE);
&touch(@files_to_touch);
if ($vos)
{
$error_code = 3307;
if ($vos) {
$error_code = 3307;
}
else
{
$error_code = 512;
else {
$error_code = 512;
}
&run_make_with_options($makefile,"-k",&get_logfile,$error_code);
&run_make_with_options($makefile, "-k", &get_logfile, $error_code);
# Create the answer to what should be produced by this Makefile
$answer = "cc -c main.c\n"
."$make_name: *** No rule to make target `kbd.c', needed by `kbd.o'.\n"
."cc -c commands.c\n"
."cc -c display.c\n"
."$make_name: Target `edit' not remade because of errors.\n";
$answer = "cc -c main.c
$make_name: *** No rule to make target `kbd.c', needed by `kbd.o'.
cc -c commands.c
cc -c display.c
$make_name: Target `edit' not remade because of errors.\n";
# COMPARE RESULTS
if (&compare_output($answer,&get_logfile(1)))
{
unlink @files_to_touch;
}
&compare_output($answer, &get_logfile(1));
unlink(@files_to_touch) unless $keep;
# TEST 1: Make sure that top-level targets that depend on targets that
# previously failed to build, aren't attempted. Regression for PR/1634.
$makefile2 = &get_tmpfile;
open(MAKEFILE, "> $makefile2");
print MAKEFILE <<'EOF';
.SUFFIXES:
all: exe1 exe2; @echo making $@
exe1 exe2: lib; @echo cp $^ $@
lib: foo.o; @echo cp $^ $@
foo.o: ; exit 1
EOF
close(MAKEFILE);
&run_make_with_options($makefile2, "-k", &get_logfile, $error_code);
$answer = "exit 1
$make_name: *** [foo.o] Error 1
$make_name: Target `all' not remade because of errors.\n";
&compare_output($answer, &get_logfile(1));
1;

View File

@ -136,17 +136,18 @@ define_variable_in_set (name, length, value, origin, recursive, set, flocp)
Returns address of the `struct variable' containing all info
on the variable, or nil if no such variable is defined.
If LISTP is not nil, return a pointer to the setlist where
the variable was found. If the variable wasn't found, the
value of LISTP is unchanged. */
If we find a variable which is in the process of being expanded,
try to find one further up the set_list chain. If we don't find
one that isn't being expanded, return a pointer to whatever we
_did_ find. */
struct variable *
lookup_variable_setlist (name, length, listp)
lookup_variable (name, length)
char *name;
unsigned int length;
struct variable_set_list **listp;
{
register struct variable_set_list *setlist;
struct variable *firstv = 0;
register unsigned int i;
register unsigned int rawhash = 0;
@ -161,21 +162,31 @@ lookup_variable_setlist (name, length, listp)
register unsigned int hashval = rawhash % set->buckets;
register struct variable *v;
/* Look through this set list. */
for (v = set->table[hashval]; v != 0; v = v->next)
if (*v->name == *name
&& strneq (v->name + 1, name + 1, length - 1)
&& v->name[length] == 0)
{
if (listp)
*listp = setlist;
return v;
}
&& v->name[length] == '\0')
break;
/* If we didn't find anything, go to the next set list. */
if (!v)
continue;
/* If it's not being expanded already, we're done. */
if (!v->expanding)
return v;
/* It is, so try to find another one. If this is the first one we've
seen, keep a pointer in case we don't find anything else. */
if (!firstv)
firstv = v;
}
#ifdef VMS
/* since we don't read envp[] on startup, try to get the
variable via getenv() here. */
if (!firstv)
{
char *vname = alloca (length + 1);
char *value;
@ -229,10 +240,9 @@ lookup_variable_setlist (name, length, listp)
return define_variable (vname, length, value, o_env, 1);
}
}
#endif /* VMS */
return 0;
return firstv;
}
/* Lookup a variable whose name is a string starting at NAME

View File

@ -95,10 +95,7 @@ extern char *patsubst_expand PARAMS ((char *o, char *text, char *pattern, char *
char *pattern_percent, char *replace_percent));
/* expand.c */
extern char *recursively_expand_setlist PARAMS ((struct variable *v,
struct variable_set_list *l));
#define recursively_expand(v) recursively_expand_setlist((v),(struct variable_set_list *)0)
extern char *recursively_expand PARAMS ((struct variable *v));
/* variable.c */
extern struct variable_set_list *create_new_variable_set PARAMS ((void));
@ -111,12 +108,7 @@ extern void print_variable_set PARAMS ((struct variable_set *set, char *prefix))
extern void merge_variable_set_lists PARAMS ((struct variable_set_list **setlist0, struct variable_set_list *setlist1));
extern struct variable *try_variable_definition PARAMS ((const struct floc *flocp, char *line, enum variable_origin origin, int target_var));
extern struct variable *lookup_variable_setlist
PARAMS ((char *name, unsigned int length,
struct variable_set_list **lisp));
#define lookup_variable(n,l) lookup_variable_setlist((n),(l),\
(struct variable_set_list **)0)
extern struct variable *lookup_variable PARAMS ((char *name, unsigned int length));
extern struct variable *define_variable_in_set
PARAMS ((char *name, unsigned int length, char *value,