Article View: gnu.utils.bug
Article #664Bug in make -t
From: John Martin
Date: Tue, 18 Aug 1992 16:03
Date: Tue, 18 Aug 1992 16:03
94 lines
2997 bytes
2997 bytes
GNU make 3.62 has a discrepancy between the documentation and the
action of the -t switch. The info file says:
The `-n', `-t', and `-q' options do not affect command lines that
begin with `+' characters or contain the strings `$(MAKE)' or
`${MAKE}'. Note that only the line containing the `+' character or
the strings `$(MAKE)' or `${MAKE}' is run regardless of these options.
Other lines in the same rule are not run unless they too begin with
`+' or contain `$(MAKE)' or `${MAKE}'.
But what make did was to execute the entire rule if any of its lines
sets the recursive flag. E.g.:
% gnumake -rtf -
all:
rm -rf all
$(MAKE) -$(MAKEFLAGS) foo
rm -rf all
gnumake -rt foo
gnumake[1]: *** No way to make target `foo'. Stop.
gnumake: *** [all] Error 1
According to the documentation, the rm command should not have been
executed.
The patches I made to get the behavior to match the documentation,
which seems preferable to documenting the current actual behavior,
are:
In remake.c:
*** 758,765 ****
{
chop_commands (file->cmds);
! if (touch_flag && !file->cmds->any_recurse)
{
if (file->phony)
file->update_status = 0;
else
--- 758,767 ----
{
chop_commands (file->cmds);
! if (touch_flag)
{
+ if (file->cmds->any_recurse)
+ execute_file_commands( file);
if (file->phony)
file->update_status = 0;
else
In job.c:
*** 631,637 ****
/* Print out the command. */
! if (just_print_flag || (!noprint && !silent_flag))
puts (p);
if (argv == 0)
--- 631,637 ----
/* Print out the command. */
! if (just_print_flag || (!noprint && !silent_flag && !(touch_flag && !recursive)))
puts (p);
if (argv == 0)
***************
*** 643,649 ****
/* If -n was given, recurse to get the next line in the sequence. */
! if (just_print_flag && !recursive)
{
free (argv[0]);
free ((char *) argv);
--- 643,649 ----
/* If -n was given, recurse to get the next line in the sequence. */
! if ((just_print_flag || touch_flag) && !recursive)
{
free (argv[0]);
free ((char *) argv);
---
John H. Martin, johnm@ksr.com, ksr!johnm@uunet.uu.net <The Usual Disclaimer>
The most wonderful things are brought about in many instances by
means the most absurd and ridiculous, in the most ridiculous modes,
and apparently by the most contemptible instruments. -- Edmund Burke
Technical Details
Message-ID:
<9208181603.AA06044@kaos.ksr.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!ksr.COM!johnmShow Full Headers
Complete Article Headers
Newsgroups: gnu.utils.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!ksr.COM!johnm From: johnm@ksr.COM (John Martin) Subject: Bug in make -t Message-ID: <9208181603.AA06044@kaos.ksr.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Tue, 18 Aug 1992 16:03:57 GMT Approved: bug-gnu-utils@prep.ai.mit.edu Lines: 96