From 5c83e8eb3d5c9da965eb312e90238d22edcc67ad Mon Sep 17 00:00:00 2001 From: psmith Date: Fri, 23 Jun 2000 15:55:46 +0000 Subject: [PATCH] * Fix -q so it works more correctly. * Don't print "nothing to do" messages for ":" commands * Update the version to 3.79.1 --- ChangeLog | 17 +++++++++++ README.template | 11 +++++++ configure.in | 16 ++++++++-- job.c | 59 +++++++++++++++++++++---------------- tests/ChangeLog | 5 ++++ tests/scripts/options/dash-q | 70 ++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 149 insertions(+), 29 deletions(-) create mode 100644 tests/scripts/options/dash-q diff --git a/ChangeLog b/ChangeLog index cd917b6..00b809f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2000-06-23 Paul D. Smith + + * 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 + + * 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 * read.c (read_makefile): If we find a semicolon in the target diff --git a/README.template b/README.template index f131fd6..6581046 100644 --- a/README.template +++ b/README.template @@ -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. diff --git a/configure.in b/configure.in index 736afb6..d554e49 100644 --- a/configure.in +++ b/configure.in @@ -1,9 +1,9 @@ dnl Process this file with autoconf to produce a configure script. -AC_REVISION([$Id: configure.in,v 1.99 2000/06/20 05:48:40 psmith Exp $]) +AC_REVISION([$Id: configure.in,v 1.100 2000/06/23 15:55:46 psmith Exp $]) 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 1c11a38..d517711 100644 --- 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)) diff --git a/tests/ChangeLog b/tests/ChangeLog index 458b0e0..2a19bcb 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,8 @@ +2000-06-22 Paul D. Smith + + * scripts/options/dash-q: New file; test the -q option. Includes + a test for PR/1780. + 2000-06-21 Paul D. Smith * 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 index 0000000..923e4c4 --- /dev/null +++ b/tests/scripts/options/dash-q @@ -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; -- 2.11.4.GIT