* Fix -q so it works more correctly.
authorPaul Smith <psmith@gnu.org>
Fri, 23 Jun 2000 15:55:46 +0000 (15:55 +0000)
committerPaul Smith <psmith@gnu.org>
Fri, 23 Jun 2000 15:55:46 +0000 (15:55 +0000)
* Don't print "nothing to do" messages for ":" commands
* Update the version to 3.79.1

ChangeLog
README.template
configure.in
job.c
tests/ChangeLog
tests/scripts/options/dash-q [new file with mode: 0644]

index cd917b6fc1f754c9527a51dd2c45c3c54872c519..00b809f21886938075f491f771866b526abf964a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2000-06-23  Paul D. Smith  <psmith@gnu.org>
+
+       * Version 3.79.1 released.
+
+       * configure.in: Add a new option, --disable-nsec-timestamps, to
+       avoid using sub-second timestamps on systems that support it.  It
+       can lead to problems, e.g. if your makefile relies on "cp -p".
+       * README.template: Document the issue with "cp -p".
+
+2000-06-22  Paul D. Smith  <psmith@gnu.org>
+
+       * job.c (start_job_command): Increment commands_started before the
+       special check for ":" (empty command) to avoid spurious "is up to
+       date" messages.  Also move the test for question_flag after we
+       expand arguments, and only stop if the expansion provided an
+       actual command to run, not just whitespace.  This fixes PR/1780.
+
 2000-06-21  Paul D. Smith  <psmith@gnu.org>
 
        * read.c (read_makefile): If we find a semicolon in the target
index f131fd6c55c2b7d7f67876de63360e1b79fb1a64..6581046d24c4a5489b4c1142ba6fc39856fbb43b 100644 (file)
@@ -121,3 +121,14 @@ files (LFS) in configure for those operating systems that provide it.
 Please report any bugs that you find in this area.  If you run into
 difficulties, then as a workaround you should be able to disable LFS by
 adding the `--disable-largefile' option to the `configure' script.
+
+On systems that support micro- and nano-second timestamp values and
+where stat(2) provides this information, GNU make will use it when
+comparing timestamps to get the most accurate possible result.  However,
+at the moment there is no system call (that I'm aware of) that will
+allow you to *set* a timestamp to a micro- or nano-second granularity.
+This means that "cp -p" and other similar tools (tar, etc.) cannot
+exactly duplicate timestamps with micro- and nano-second granularity.
+If your build system contains rules that depend on proper behavior of
+tools like "cp -p", you should configure make to not use micro- and
+nano-second timestamps with the --disable-nsec-timestamps flag.
index 2f61d248d7042d29475bbf760732b1c2be9eb3a9..56346f07251049553c25da47e163cd48de9e1387 100644 (file)
@@ -3,7 +3,7 @@ AC_REVISION([$Id$])
 AC_PREREQ(2.13)dnl             dnl Minimum Autoconf version required.
 AC_INIT(vpath.c)dnl            dnl A distinctive file to look for in srcdir.
 
-AM_INIT_AUTOMAKE(make, 3.79.0.2)
+AM_INIT_AUTOMAKE(make, 3.79.1)
 AM_CONFIG_HEADER(config.h)
 
 dnl Regular configure stuff
@@ -45,7 +45,17 @@ dnl Handle internationalization
 ALL_LINGUAS="de es fr ja ko nl pl pt_BR ru"
 pds_WITH_GETTEXT
 
-AC_STRUCT_ST_MTIM_NSEC
+
+dnl See if the user wants nsec timestamps
+
+AC_ARG_ENABLE(nsec-timestamps,
+  [  --disable-nsec-timestamps disable use of sub-second timestamps],
+  [make_cv_nsec_timestamps="$enableval"],
+  [make_cv_nsec_timestamps="yes"])
+
+if test "x$make_cv_nsec_timestamps" != xno; then
+  AC_STRUCT_ST_MTIM_NSEC
+fi
 jm_AC_TYPE_UINTMAX_T
 
 AC_SUBST(LIBOBJS)
diff --git a/job.c b/job.c
index 1c11a38a0071189b360f046ee39b1dc13a53f62f..d51771126acef58a38baf0fa6376e9a9235f25b7 100644 (file)
--- a/job.c
+++ b/job.c
@@ -898,20 +898,6 @@ start_job_command (child)
   /* Update the file's command flags with any new ones we found.  */
   child->file->cmds->lines_flags[child->command_line - 1] |= flags;
 
-  /* If -q was given, just say that updating `failed'.  The exit status of
-     1 tells the user that -q is saying `something to do'; the exit status
-     for a random error is 2.  */
-  if (question_flag && !(flags & COMMANDS_RECURSE))
-    {
-      child->file->update_status = 1;
-      notice_finished_file (child->file);
-      return;
-    }
-
-  /* There may be some preceding whitespace left if there
-     was nothing but a backslash on the first line.  */
-  p = next_token (p);
-
   /* Figure out an argument list from this command line.  */
 
   {
@@ -930,13 +916,31 @@ start_job_command (child)
       }
   }
 
+  /* If -q was given, say that updating `failed' if there was any text on the
+     command line, or `succeeded' otherwise.  The exit status of 1 tells the
+     user that -q is saying `something to do'; the exit status for a random
+     error is 2.  */
+  if (argv != 0 && question_flag && !(flags & COMMANDS_RECURSE))
+    {
+#ifndef VMS
+      free (argv[0]);
+      free ((char *) argv);
+#endif
+      child->file->update_status = 1;
+      notice_finished_file (child->file);
+      return;
+    }
+
   if (touch_flag && !(flags & COMMANDS_RECURSE))
     {
       /* Go on to the next command.  It might be the recursive one.
         We construct ARGV only to find the end of the command line.  */
 #ifndef VMS
-      free (argv[0]);
-      free ((char *) argv);
+      if (argv)
+        {
+          free (argv[0]);
+          free ((char *) argv);
+        }
 #endif
       argv = 0;
     }
@@ -968,8 +972,20 @@ start_job_command (child)
   message (0, (just_print_flag || (!(flags & COMMANDS_SILENT) && !silent_flag))
           ? "%s" : (char *) 0, p);
 
+  /* Tell update_goal_chain that a command has been started on behalf of
+     this target.  It is important that this happens here and not in
+     reap_children (where we used to do it), because reap_children might be
+     reaping children from a different target.  We want this increment to
+     guaranteedly indicate that a command was started for the dependency
+     chain (i.e., update_file recursion chain) we are processing.  */
+
+  ++commands_started;
+
   /* Optimize an empty command.  People use this for timestamp rules,
-     so avoid forking a useless shell.  */
+     so avoid forking a useless shell.  Do this after we increment
+     commands_started so make still treats this special case as if it
+     performed some action (makes a difference as to what messages are
+     printed, etc.  */
 
 #if !defined(VMS) && !defined(_AMIGA)
   if (
@@ -989,15 +1005,6 @@ start_job_command (child)
     }
 #endif  /* !VMS && !_AMIGA */
 
-  /* Tell update_goal_chain that a command has been started on behalf of
-     this target.  It is important that this happens here and not in
-     reap_children (where we used to do it), because reap_children might be
-     reaping children from a different target.  We want this increment to
-     guaranteedly indicate that a command was started for the dependency
-     chain (i.e., update_file recursion chain) we are processing.  */
-
-  ++commands_started;
-
   /* If -n was given, recurse to get the next line in the sequence.  */
 
   if (just_print_flag && !(flags & COMMANDS_RECURSE))
index 458b0e038f679989e098254040602659b9ec8154..2a19bcb7067d8b1089eb1b5b2dea4ad4ad8fc2cd 100644 (file)
@@ -1,3 +1,8 @@
+2000-06-22  Paul D. Smith  <psmith@gnu.org>
+
+       * scripts/options/dash-q: New file; test the -q option.  Includes
+       a test for PR/1780.
+
 2000-06-21  Paul D. Smith  <psmith@gnu.org>
 
        * scripts/features/targetvars: Added a test for PR/1709: allowing
diff --git a/tests/scripts/options/dash-q b/tests/scripts/options/dash-q
new file mode 100644 (file)
index 0000000..923e4c4
--- /dev/null
@@ -0,0 +1,70 @@
+#                                                                    -*-perl-*-
+$description = "Test the -q option.\n";
+
+$details = "Try various uses of -q and ensure they all give the correct results.\n";
+
+open(MAKEFILE, "> $makefile");
+
+# The Contents of the MAKEFILE ...
+
+print MAKEFILE <<'EOMAKE';
+one:
+two: ;
+three: ; :
+four: ; $(.XY)
+five: ; \
+ $(.XY)
+six: ; \
+ $(.XY)
+       $(.XY)
+seven: ; \
+ $(.XY)
+       : foo
+       $(.XY)
+EOMAKE
+
+close(MAKEFILE);
+
+# TEST 0
+
+&run_make_with_options($makefile, "-q one", &get_logfile);
+$answer = "";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 1
+
+&run_make_with_options($makefile, "-q two", &get_logfile);
+$answer = "";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 2
+
+&run_make_with_options($makefile, "-q three", &get_logfile, 256);
+$answer = "";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 3
+
+&run_make_with_options($makefile, "-q four", &get_logfile);
+$answer = "";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 4
+
+&run_make_with_options($makefile, "-q five", &get_logfile);
+$answer = "";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 5
+
+&run_make_with_options($makefile, "-q six", &get_logfile);
+$answer = "";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 6
+
+&run_make_with_options($makefile, "-q seven", &get_logfile, 256);
+$answer = "";
+&compare_output($answer, &get_logfile(1));
+
+1;