Fix some doc bugs.
Implement the --trace flag.
Show filename/linenumber on error.
2010-08-29 Paul Smith <psmith@gnu.org>
+ * doc/make.texi (Implicit Variables): Document LDLIBS and LOADLIBES.
+ Fixes Savannah bug #30807.
+ (Instead of Execution): Mention that included makefiles are still
+ rebuilt even with -n. Fixes Savannah bug #30762.
+
+ * configure.in: Bump to 3.82.90.
+
+ * make.h: Add trace_flag variable.
+ * main.c (switches): Add --trace option.
+ (trace_flag): Declare variable.
+ * job.c (start_job_command): Show recipe if trace_flag is set.
+ (new_job): Show trace messages if trace_flag is set.
+ * doc/make.texi (Options Summary): Document the new --trace option.
+ * make.1: Add --trace documentation.
+ * NEWS: Mention --trace.
+
+ * job.c (child_error): Show recipe filename/linenumber on error.
+ Also show "(ignored)" when appropriate even for signals/coredumps.
+ * NEWS: Mention file/linenumber change.
+
+ * main.c (main): Print version info when DB_BASIC is set.
+
* job.c (construct_command_argv_internal): If shellflags is not
set, choose an appropriate default value. Fixes Savannah bug #30748.
GNU make NEWS -*-indented-text-*-
History of user-visible changes.
- 28 July 2010
+ 29 August 2010
See the end of this file for copyrights and conditions.
manual, which is contained in this distribution as the file doc/make.texi.
See the README file and the GNU make manual for instructions for
reporting bugs.
+\f
+Version 3.82.90
+
+A complete list of bugs fixed in this version is available here:
+
+http://sv.gnu.org/bugs/index.php?group=make&report_id=111&fix_release_id=101&set=custom
+
+* New command line option: --trace enables tracing of targets. When enabled
+ the recipe to be invoked is printed even if it would otherwise be suppressed
+ by .SILENT or a "@" prefix character. Also before each recipe is run the
+ makefile name and linenumber where it was defined are shown as well as the
+ prerequisites that caused the target to be considered out of date.
+
+* On failure, the makefile name and linenumber of the recipe that failed are
+ shown.
+
\f
Version 3.82
# You should have received a copy of the GNU General Public License along with
# this program. If not, see <http://www.gnu.org/licenses/>.
-AC_INIT([GNU make],[3.82],[bug-make@gnu.org])
+AC_INIT([GNU make],[3.82.90],[bug-make@gnu.org])
AC_PREREQ(2.59)
AC_REVISION([[$Id$]])
Thus you no longer have to write all those rules yourself.
The compiler will do it for you.
-Note that such a prerequisite constitutes mentioning @file{main.o} in a
-makefile, so it can never be considered an intermediate file by implicit
-rule search. This means that @code{make} won't ever remove the file
-after using it; @pxref{Chained Rules, ,Chains of Implicit Rules}.
+Note that such a rule constitutes mentioning @file{main.o} in a
+makefile, so it can never be considered an intermediate file by
+implicit rule search. This means that @code{make} won't ever remove
+the file after using it; @pxref{Chained Rules, ,Chains of Implicit
+Rules}.
@cindex @code{make depend}
With old @code{make} programs, it was traditional practice to use this
@cindex @code{--recon}
@cindex @code{-n}
-``No-op''. The activity is to print what recipe would be used to make
-the targets up to date, but not actually execute it. Some recipes are
-still executed, even with this flag (@pxref{MAKE Variable, ,How the @code{MAKE} Variable Works}).
+``No-op''. Causes @code{make} to print the recipes that are needed to
+make the targets up to date, but not actually execute them. Note that
+some recipes are still executed, even with this flag (@pxref{MAKE
+Variable, ,How the @code{MAKE} Variable Works}). Also any recipes
+needed to update included makefiles are still executed
+(@pxref{Remaking Makefiles, ,How Makefiles Are Remade}).
@item -t
@itemx --touch
@cindex target, touching
@cindex @code{-t}
-``Touch''. The activity is to mark the targets as up to date without
-actually changing them. In other words, @code{make} pretends to compile
-the targets but does not really change their contents.
+``Touch''. Marks targets as up to date without actually changing
+them. In other words, @code{make} pretends to update the targets but
+does not really change their contents; instead only their modified
+times are updated.
@item -q
@itemx --question
@cindex @code{-q}
@cindex question mode
-``Question''. The activity is to find out silently whether the targets
-are up to date already; but execute no recipe in either case. In other
-words, neither compilation nor output will occur.
+``Question''. Silently check whether the targets are up to date, but
+do not execute recipes; the exit code shows whether any updates are
+needed.
@item -W @var{file}
@itemx --what-if=@var{file}
recipes were done, in order to fool future invocations of
@code{make}. @xref{Instead of Execution, ,Instead of Executing Recipes}.
+@item --trace
+@cindex @code{--trace}
+@c Extra blank line here makes the table look better.
+
+Print the entire recipe to be executed, even for recipes that are
+normally silent (due to @code{.SILENT} or @samp{@@}). Also print the
+makefile name and linenumber where the recipe was defined.
+
@item -v
@cindex @code{-v}
@itemx --version
Here is a table of some of the more common variables used as names of
programs in built-in rules:
-makefiles.
@table @code
@item AR
Extra flags to give to compilers when they are supposed to invoke the linker,
@samp{ld}.
+@item LDLIBS
+@vindex LDLIBS
+@vindex LOADLIBES
+Library flags or names given to compilers when they are supposed to
+invoke the linker, @samp{ld}. @code{LOADLIBES} is a deprecated (but
+still supported) alternative to @code{LDLIBS}.
+
@item LFLAGS
@vindex LFLAGS
Extra flags to give to Lex.
Append "(ignored)" if IGNORED is nonzero. */
static void
-child_error (const char *target_name,
+child_error (const struct file *file,
int exit_code, int exit_sig, int coredump, int ignored)
{
+ const char *nm;
+ const char *pre = "*** ";
+ const char *post = "";
+ const char *dump = "";
+ struct floc *flocp = &file->cmds->fileinfo;
+
if (ignored && silent_flag)
return;
+ if (exit_sig && coredump)
+ dump = _(" (core dumped)");
+
+ if (ignored)
+ {
+ pre = "";
+ post = _(" (ignored)");
+ }
+
+ if (! flocp->filenm)
+ nm = _("<builtin>");
+ else
+ {
+ char *a = alloca (strlen (flocp->filenm) + 1 + 11 + 1);
+ sprintf (a, "%s:%lu", flocp->filenm, flocp->lineno);
+ nm = a;
+ }
+ message (0, _("%s: recipe for target `%s' failed"), nm, file->name);
+
#ifdef VMS
if (!(exit_code & 1))
- error (NILF,
- (ignored ? _("*** [%s] Error 0x%x (ignored)")
- : _("*** [%s] Error 0x%x")),
- target_name, exit_code);
+ error (NILF, _("%s[%s] Error 0x%x%s"), pre, file->name, exit_code, post);
#else
if (exit_sig == 0)
- error (NILF, ignored ? _("[%s] Error %d (ignored)") :
- _("*** [%s] Error %d"),
- target_name, exit_code);
+ error (NILF, _("%s[%s] Error %d%s"), pre, file->name, exit_code, post);
else
- error (NILF, "*** [%s] %s%s",
- target_name, strsignal (exit_sig),
- coredump ? _(" (core dumped)") : "");
+ error (NILF, _("%s[%s] %s%s%s"),
+ pre, file->name, strsignal (exit_sig), dump, post);
#endif /* VMS */
}
\f
int remote = 0;
pid_t pid;
int exit_code, exit_sig, coredump;
- register struct child *lastc, *c;
+ struct child *lastc, *c;
int child_failed;
int any_remote, any_local;
int dontcare;
static int delete_on_error = -1;
if (!dontcare)
- child_error (c->file->name, exit_code, exit_sig, coredump, 0);
+ child_error (c->file, exit_code, exit_sig, coredump, 0);
c->file->update_status = 2;
if (delete_on_error == -1)
if (child_failed)
{
/* The commands failed, but we don't care. */
- child_error (c->file->name,
- exit_code, exit_sig, coredump, 1);
+ child_error (c->file, exit_code, exit_sig, coredump, 1);
child_failed = 0;
}
can log the working directory before the command's own error messages
appear. */
- message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
+ message (0, (just_print_flag || trace_flag
+ || (!(flags & COMMANDS_SILENT) && !silent_flag))
? "%s" : (char *) 0, p);
/* Tell update_goal_chain that a command has been started on behalf of
++jobserver_tokens;
- /* The job is now primed. Start it running.
- (This will notice if there is in fact no recipe.) */
- if (cmds->fileinfo.filenm)
- DB (DB_BASIC, (_("Invoking recipe from %s:%lu to update target `%s'.\n"),
- cmds->fileinfo.filenm, cmds->fileinfo.lineno,
- c->file->name));
- else
- DB (DB_BASIC, (_("Invoking builtin recipe to update target `%s'.\n"),
- c->file->name));
+ /* Trace the build.
+ Use message here so that changes to working directories are logged. */
+ if (trace_flag)
+ {
+ char *newer = allocated_variable_expand_for_file ("$?", c->file);
+ char *nm;
+
+ if (! cmds->fileinfo.filenm)
+ nm = _("<builtin>");
+ else
+ {
+ nm = alloca (strlen (cmds->fileinfo.filenm) + 1 + 11 + 1);
+ sprintf (nm, "%s:%lu", cmds->fileinfo.filenm, cmds->fileinfo.lineno);
+ }
+ if (newer[0] == '\0')
+ message (0, _("%s: target `%s' does not exist"), nm, c->file->name);
+ else
+ message (0, _("%s: update target `%s' due to: %s"), nm,
+ c->file->name, newer);
+ free (newer);
+ }
+
+
+ /* The job is now primed. Start it running.
+ (This will notice if there is in fact no recipe.) */
start_waiting_job (c);
if (job_slots == 1 || not_parallel)
int db_level = 0;
-/* Output level (--verbosity). */
+/* Tracing (--trace). */
-static struct stringlist *verbosity_flags;
+int trace_flag = 0;
#ifdef WINDOWS32
/* Suspend make in main for a short time to allow debugger to attach */
N_("\
-t, --touch Touch targets instead of remaking them.\n"),
N_("\
+ --trace Print tracing information.\n"),
+ N_("\
-v, --version Print the version number of make and exit.\n"),
N_("\
-w, --print-directory Print the current directory.\n"),
{ 'S', flag_off, &keep_going_flag, 1, 1, 0, 0, &default_keep_going_flag,
"no-keep-going" },
{ 't', flag, &touch_flag, 1, 1, 1, 0, 0, "touch" },
+ { CHAR_MAX+3, flag, &trace_flag, 1, 1, 0, 0, 0, "trace" },
{ 'v', flag, &print_version_flag, 1, 1, 0, 0, 0, "version" },
- { CHAR_MAX+3, string, &verbosity_flags, 1, 1, 0, 0, 0,
- "verbosity" },
{ 'w', flag, &print_directory_flag, 1, 1, 0, 0, 0, "print-directory" },
{ CHAR_MAX+4, flag, &inhibit_print_directory_flag, 1, 1, 0, 0, 0,
"no-print-directory" },
always_make_flag = always_make_set && (restarts == 0);
/* Print version information. */
- if (print_version_flag || print_data_base_flag || db_level)
+ if (print_version_flag || print_data_base_flag || ISDB (DB_BASIC))
{
print_version ();
future invocations of
.IR make .
.TP 0.5i
+.B \-\-trace
+Print information about the commands invoked by
+.IR make.
+.TP 0.5i
.BR \-v , " \-\-version"
Print the version of the
.I make
.IR "The GNU Make Manual" .
.SH AUTHOR
This manual page contributed by Dennis Morse of Stanford University.
-It has been reworked by Roland McGrath. Further updates contributed by
-Mike Frysinger.
+Further updates contributed by Mike Frysinger. It has been reworked by Roland
+McGrath. Maintained by Paul Smith.
.SH "COPYRIGHT"
-Copyright (C) 1992, 1993, 1996, 1999, 2007 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1996, 1999, 2007, 2010 Free Software Foundation, Inc.
This file is part of GNU
.IR make .
.LP
extern int print_data_base_flag, question_flag, touch_flag, always_make_flag;
extern int env_overrides, no_builtin_rules_flag, no_builtin_variables_flag;
extern int print_version_flag, print_directory_flag, check_symlink_flag;
-extern int warn_undefined_variables_flag, posix_pedantic, not_parallel;
-extern int second_expansion, clock_skew_detected, rebuilding_makefiles;
-extern int one_shell;
+extern int warn_undefined_variables_flag, trace_flag, posix_pedantic;
+extern int not_parallel, second_expansion, clock_skew_detected;
+extern int rebuilding_makefiles, one_shell;
/* can we run commands via 'sh -c xxx' or must we use batch files? */
extern int batch_mode_shell;
+2010-08-29 Paul Smith <psmith@gnu.org>
+
+ * scripts/features/errors: Add new error message to output text.
+ * scripts/variables/SHELL: Ditto.
+ * scripts/targets/POSIX: Ditto.
+ * scripts/options/dash-k: Ditto.
+ * scripts/features/vpathplus: Ditto.
+ * scripts/features/patternrules: Ditto.
+ * scripts/features/parallelism: Ditto.
+
2010-08-13 Paul Smith <psmith@gnu.org>
* scripts/features/archives: New regression tests for archive
unlink("cleanit");
$cleanit_error = `sh -c "$rm_command cleanit 2>&1"`;
+chomp $cleanit_error;
$delete_error_code = $? >> 8;
# TEST #1
# -------
-$answer = "$rm_command cleanit\n"
- . $cleanit_error
- ."$make_name: [clean] Error $delete_error_code (ignored)\n"
- ."$rm_command foo\n";
+$answer = "$rm_command cleanit
+$cleanit_error
+$makefile:2: recipe for target `clean' failed
+$make_name: [clean] Error $delete_error_code (ignored)
+$rm_command foo\n";
&run_make_with_options($makefile,"",&get_logfile);
# TEST #2
# -------
-$answer = "$rm_command cleanit\n"
- . $cleanit_error
- ."$make_name: [clean2] Error $delete_error_code (ignored)\n"
- ."$rm_command foo\n";
+$answer = "$rm_command cleanit
+$cleanit_error
+$makefile:5: recipe for target `clean2' failed
+$make_name: [clean2] Error $delete_error_code (ignored)
+$rm_command foo\n";
&run_make_with_options($makefile,"clean2 -i",&get_logfile);
ok:
\@sleep 4
\@echo Ok done",
- '-rR -j5', 'Fail
+ '-rR -j5', "Fail
+#MAKEFILE#:6: recipe for target `fail.1' failed
#MAKE#: *** [fail.1] Error 1
#MAKE#: *** Waiting for unfinished jobs....
Fail
+#MAKEFILE#:6: recipe for target `fail.2' failed
#MAKE#: *** [fail.2] Error 1
Fail
+#MAKEFILE#:6: recipe for target `fail.3' failed
#MAKE#: *** [fail.3] Error 1
-Ok done',
+Ok done",
512);
',
"dir=$dir",
-"#MAKE#: *** [$dir/foo.bar] Error 1",
+"#MAKEFILE#:6: recipe for target `$dir/foo.bar' failed
+#MAKE#: *** [$dir/foo.bar] Error 1",
512);
unlink("$dir/foo.bar");
$answer = "not creating notarget.c from notarget.d
cat notarget.c > notarget.b 2>/dev/null || exit 1
+$makefile:16: recipe for target `notarget.b' failed
$make_name: *** [notarget.b] Error 1
";
&run_make_with_options($makefile2, "-k", &get_logfile, $error_code);
$answer = "exit 1
+$makefile2:9: recipe for target `foo.o' failed
$make_name: *** [foo.o] Error 1
$make_name: Target `all' not remade because of errors.\n";
.POSIX:
all: ; \@$script
!,
- '', "#MAKE#: *** [all] Error $err\n", 512);
+ '', "#MAKEFILE#:3: recipe for target `all' failed
+#MAKE#: *** [all] Error $err\n", 512);
# User settings must override .POSIX
$flags = '-xc';
.SHELLFLAGS = $flags
all: ; \@$script
!,
- '', "$out#MAKE#: *** [all] Error $err\n", 512);
+ '', "$out#MAKEFILE#:3: recipe for target `all' failed
+#MAKE#: *** [all] Error $err\n", 512);
1;