* Various changes and fixes. See ChangeLog.
authorPaul Smith <psmith@gnu.org>
Wed, 8 Dec 1999 20:13:50 +0000 (20:13 +0000)
committerPaul Smith <psmith@gnu.org>
Wed, 8 Dec 1999 20:13:50 +0000 (20:13 +0000)
12 files changed:
ChangeLog
Makefile.am
NEWS
acinclude.m4
configure.in
function.c
remake.c
tests/ChangeLog
tests/scripts/features/double_colon
tests/scripts/options/dash-n
variable.c
w32/subproc/misc.c

index b79d6f3..75f37c9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,30 @@
+1999-12-08  Paul D. Smith  <psmith@gnu.org>
+
+       * dir.c (dir_setup_glob): On 64 bit ReliantUNIX (5.44 and above)
+       in LFS mode, stat() is actually a macro for stat64().  Assignment
+       doesn't work in that case.  So, stat is a macro, make a local
+       wrapper function to invoke it.
+       (local_stat): Wrapper function, if needed.
+       Reported by Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>.
+
+1999-12-02  Paul D. Smith  <psmith@gnu.org>
+
+       * remake.c (update_file): Move the considered test outside the
+       double-colon loop, _but_ make sure we test the double_colon target
+       not the "current" target.  If we stop early because one
+       double-colon target is running, mark all the rest considered and
+       try to start their prerequisites (so they're marked considered).
+       Fix for PR/1476 suggested by Tim Magill <tim.magill@telops.gte.com>.
+
+1999-11-22  Rob Tulloh  <rob_tulloh@dev.tivoli.com>
+
+       * function.c (windows32_openpipe, func_shell): Correct Windows32
+       problem where $(shell nosuchfile) would incorrectly exit make. The
+       fix is to print the error and let make continue.
+       Reported by David Masterson <David.Masterson@kla-tencor.com>.
+
+       * w32/subproc/misc.c (arr2envblk): Memory leak fix.
+
 1999-11-21  Paul D. Smith  <psmith@gnu.org>
 
        Rework GNU make debugging to provide different levels of output.
@@ -9,6 +36,12 @@
        debug_flag with invocations of debugging macros.
        * make.h: Remove debug_flag and DEBUGPR, add db_level.
 
+1999-11-18  Paul Eggert  <eggert@twinsun.com>
+
+       * acinclude.m4 (AC_SYS_LARGEFILE_FLAGS): Work around a problem
+       with the QNX 4.25 shell, which doesn't propagate exit status of
+       failed commands inside shell assignments.
+
 1999-11-17  Paul D. Smith  <psmith@gnu.org>
 
        * function.c (func_if): Find the end of the arg list by testing
index df78820..0aeb7e8 100644 (file)
@@ -8,7 +8,7 @@ make_SOURCES =  main.c commands.c job.c dir.c file.c misc.c read.c remake.c \
                rule.c implicit.c default.c variable.c expand.c function.c \
                vpath.c version.c ar.c arscan.c remote-$(REMOTE).c \
                commands.h dep.h filedef.h job.h make.h rule.h variable.h \
-               signame.c signame.h \
+               debug.h signame.c signame.h \
                getopt.c getopt1.c getopt.h
 make_LDADD =   $(LIBOBJS) @ALLOCA@ $(GLOBLIB)
 
diff --git a/NEWS b/NEWS
index ec49770..628b478 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -32,11 +32,11 @@ Version 3.79
   makefile is always run serially regardless of the value of -j.  Any
   submakes will still be run in parallel if -j was specified.
 
-* The -d (--debug) option has changed: it now takes an optional numeric
-  argument.  By default only a minimal set of debugging output is
-  generated, displaying information about what "normal" files (not
-  makefiles) were deemed out of date and in need of being rebuilt.
-  Various values control the amount of detail in the debugging output.
+* The -d (--debug) option has changed: it now allows optional flags
+  controlling the amount and type of debugging output.  By default only
+  a minimal amount information is generated, displaying the names of
+  "normal" targets (not makefiles) were deemed out of date and in need
+  of being rebuilt.
 \f
 Version 3.78
 
index 3f4f9ad..9b8255b 100644 (file)
@@ -101,7 +101,10 @@ dnl AC_SYS_LARGEFILE_FLAGS(FLAGSNAME)
 AC_DEFUN(AC_SYS_LARGEFILE_FLAGS,
   [AC_CACHE_CHECK([for $1 value to request large file support],
      ac_cv_sys_largefile_$1,
-     [ac_cv_sys_largefile_$1=`($GETCONF LFS_$1) 2>/dev/null` || {
+     [if ($GETCONF LFS_$1) >conftest.1 2>conftest.2 && test ! -s conftest.2
+      then
+        ac_cv_sys_largefile_$1=`cat conftest.1`
+      else
        ac_cv_sys_largefile_$1=no
        ifelse($1, CFLAGS,
          [case "$host_os" in
@@ -127,7 +130,8 @@ changequote([, ])dnl
             AC_TRY_LINK(, , , ac_cv_sys_largefile_CFLAGS=no)
             CC="$ac_save_CC"
           fi])
-      }])])
+      fi
+      rm -f conftest*])])
 
 dnl Internal subroutine of AC_SYS_LARGEFILE.
 dnl AC_SYS_LARGEFILE_SPACE_APPEND(VAR, VAL)
index 7a0aed4..4362b6c 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.78.1)
+AM_INIT_AUTOMAKE(make, 3.78.90a)
 AM_CONFIG_HEADER(config.h)
 
 dnl Regular configure stuff
index 988ea7f..90ab76a 100644 (file)
@@ -1,5 +1,5 @@
 /* Builtin function expansion for GNU Make.
-Copyright (C) 1988,89,91,92,93,94,95,96,97 Free Software Foundation, Inc.
+Copyright (C) 1988,1989,1991-1997,1999 Free Software Foundation, Inc.
 This file is part of GNU Make.
 
 GNU Make is free software; you can redistribute it and/or modify
@@ -1232,30 +1232,42 @@ windows32_openpipe (int *pipedes, int *pid_p, char **command_argv, char **envp)
   if (!CreatePipe(&hChildOutRd, &hChildOutWr, &saAttr, 0))
     fatal (NILF, _("CreatePipe() failed (e=%d)\n"), GetLastError());
 
-
-
   hProcess = process_init_fd(hIn, hChildOutWr, hErr);
 
   if (!hProcess)
     fatal (NILF, _("windows32_openpipe (): process_init_fd() failed\n"));
 
-  else
-    process_register(hProcess);
-
   /* make sure that CreateProcess() has Path it needs */
   sync_Path_environment();
 
-  if (!process_begin(hProcess, command_argv, envp, command_argv[0], NULL))
+  if (!process_begin(hProcess, command_argv, envp, command_argv[0], NULL)) {
+    /* register process for wait */
+    process_register(hProcess);
+
+    /* set the pid for returning to caller */
     *pid_p = (int) hProcess;
-  else
-    fatal (NILF, _("windows32_openpipe (): unable to launch process (e=%d)\n"),
-          process_last_err(hProcess));
 
   /* set up to read data from child */
   pipedes[0] = _open_osfhandle((long) hChildOutRd, O_RDONLY);
 
   /* this will be closed almost right away */
   pipedes[1] = _open_osfhandle((long) hChildOutWr, O_APPEND);
+  } else {
+    /* reap/cleanup the failed process */
+       process_cleanup(hProcess);
+
+    /* close handles which were duplicated, they weren't used */
+       CloseHandle(hIn);
+       CloseHandle(hErr);
+
+       /* close pipe handles, they won't be used */
+       CloseHandle(hChildOutRd);
+       CloseHandle(hChildOutWr);
+
+    /* set status for return */
+    pipedes[0] = pipedes[1] = -1;
+    *pid_p = -1;
+  }
 }
 #endif
 
@@ -1374,6 +1386,13 @@ func_shell (o, argv, funcname)
 
 #ifdef WINDOWS32
   windows32_openpipe (pipedes, &pid, command_argv, envp);
+
+  if (pipedes[0] < 0) {
+       /* open of the pipe failed, mark as failed execution */
+    shell_function_completed = -1;
+
+       return o;
+  } else
 #else /* WINDOWS32 */
 
 # ifdef __MSDOS__
index 398d027..af559ac 100644 (file)
--- a/remake.c
+++ b/remake.c
@@ -311,41 +311,50 @@ update_file (file, depth)
   register int status = 0;
   register struct file *f;
 
-  for (f = file->double_colon ? file->double_colon : file; f != 0; f = f->prev)
+  f = file->double_colon ? file->double_colon : file;
+
+  /* Prune the dependency graph: if we've already been here on _this_
+     pass through the dependency graph, we don't have to go any further.
+     We won't reap_children until we start the next pass, so no state
+     change is possible below here until then.  */
+  if (f->considered == considered)
+    {
+      DBF (DB_VERBOSE, _("Pruning file `%s'.\n"));
+      return 0;
+    }
+
+  /* This loop runs until we start a double colon rule, or until the
+     chain is exhausted. */
+  for (; f != 0; f = f->prev)
     {
-      /* Prune the dependency graph: if we've already been here on _this_
-         pass through the dependency graph, we don't have to go any further.
-         We won't reap_children until we start the next pass, so no state
-         change is possible below here until then.  */
-      if (f->considered == considered)
-        {
-          DBF (DB_VERBOSE, _("Pruning file `%s'.\n"));
-          continue;
-        }
       f->considered = considered;
 
       status |= update_file_1 (f, depth);
       check_renamed (f);
 
       if (status != 0 && !keep_going_flag)
-       return status;
-
-      switch (f->command_state)
-       {
-       case cs_finished:
-         /* The file is done being remade.  */
-         break;
+       break;
 
-       case cs_running:
-       case cs_deps_running:
+      if (f->command_state == cs_running
+          || f->command_state == cs_deps_running)
+        {
          /* Don't run the other :: rules for this
             file until this rule is finished.  */
-         return 0;
+          status = 0;
+          break;
+        }
+    }
 
-       default:
-         assert (f->command_state == cs_running);
-         break;
-       }
+  /* Process the remaining rules in the double colon chain so they're marked
+     considered.  Start their prerequisites, too.  */
+  for (; f != 0 ; f = f->prev)
+    {
+      struct dep *d;
+
+      f->considered = considered;
+
+      for (d = f->deps; d != 0; d = d->next)
+        status |= update_file (d->file, depth + 1);
     }
 
   return status;
index f021491..26707d4 100644 (file)
@@ -1,3 +1,9 @@
+1999-12-01  Paul D. Smith  <psmith@gnu.org>
+
+       * scripts/features/double_colon: Add a test for PR/1476: Try
+       double-colon rules as non-goal targets and during parallel builds
+       to make sure they're handled serially.
+
 1999-11-17  Paul D. Smith  <psmith@gnu.org>
 
        * scripts/functions/if: Add a test for PR/1429: put some text
index 096fb33..b94fc57 100644 (file)
-$description = "The following test creates a makefile to test Double-Colon\n"
-              ."Rules.  They are rules which are written with '::' instead\n"
-              ."of ':' after the target names.  This tells make that each \n"
-              ."of these rules are independent of the others and each rule's\n"
-              ."commands are executed if the target is older than any \n"
-              ."dependencies of that rule.";
-
-$details = "The makefile created by this test contains two double-colon \n"
-          ."rules for foo; each with their own commands.  When make is run,\n"
-          ."each command should be executed in the sequence that they are \n"
-          ."found.  The command is a simple echo statement.";
+#                                                                    -*-perl-*-
+$description = "Test handling of double-colon rules.";
 
-open(MAKEFILE,"> $makefile");
+$details = "\
+We test these features:
+
+  - Multiple commands for the same (double-colon) target
+  - Different prerequisites for targets: only out-of-date
+    ones are rebuilt.
+  - Double-colon targets that aren't the goal target.
+
+Then we do the same thing for parallel builds: double-colon
+targets should always be built serially.";
 
 # The Contents of the MAKEFILE ...
 
-print MAKEFILE "foo:: bar.h \n"
-              ."\t\@echo Executing rule foo FIRST\n"
-              ."foo2: bar.h \n"
-              ."foo:: bar2.h \n"
-              ."\t\@echo Executing rule foo SECOND\n";
+open(MAKEFILE,"> $makefile");
+
+print MAKEFILE <<'EOF';
+
+all: baz
+
+foo:: f1.h ; @echo foo FIRST
+foo:: f2.h ; @echo foo SECOND
 
-# END of Contents of MAKEFILE
+bar:: ; @echo aaa; sleep 1; echo aaa done
+bar:: ; @echo bbb
+
+baz:: ; @echo aaa
+baz:: ; @echo bbb
+
+biz:: ; @echo aaa
+biz:: two ; @echo bbb
+
+two: ; @echo two
+
+f1.h f2.h: ; @echo $@
+
+EOF
 
 close(MAKEFILE);
 
-&touch("bar.h","bar2.h");
+# TEST 0: A simple double-colon rule that isn't the goal target.
+
+&run_make_with_options($makefile, "all", &get_logfile, 0);
+$answer = "aaa\nbbb\n";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 1: As above, in parallel
+
+&run_make_with_options($makefile, "-j10 all", &get_logfile, 0);
+$answer = "aaa\nbbb\n";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 2: A simple double-colon rule that is the goal target
+
+&run_make_with_options($makefile, "bar", &get_logfile, 0);
+$answer = "aaa\naaa done\nbbb\n";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 3: As above, in parallel
+
+&run_make_with_options($makefile, "-j10 bar", &get_logfile, 0);
+$answer = "aaa\naaa done\nbbb\n";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 4: Each double-colon rule is supposed to be run individually
+
+&touch('f2.h');
+&touch('foo');
+
+&run_make_with_options($makefile, "foo", &get_logfile, 0);
+$answer = "f1.h\nfoo FIRST\n";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 5: Again, in parallel.
+
+&run_make_with_options($makefile, "-j10 foo", &get_logfile, 0);
+$answer = "f1.h\nfoo FIRST\n";
+&compare_output($answer, &get_logfile(1));
+
+# TEST 6: Each double-colon rule is supposed to be run individually
+
+&touch('f1.h');
+unlink('f2.h');
+&touch('foo');
+
+&run_make_with_options($makefile, "foo", &get_logfile, 0);
+$answer = "f2.h\nfoo SECOND\n";
+&compare_output($answer, &get_logfile(1));
 
-&run_make_with_options($makefile,
-                       "",
-                       &get_logfile,
-                       0);
+# TEST 7: Again, in parallel.
 
+&run_make_with_options($makefile, "-j10 foo", &get_logfile, 0);
+$answer = "f2.h\nfoo SECOND\n";
+&compare_output($answer, &get_logfile(1));
 
-$answer = "Executing rule foo FIRST\n"
-         ."Executing rule foo SECOND\n";
+# TEST 8: I don't grok why this is different than the above, but it is...
 
-&compare_output($answer,&get_logfile(1));
+&run_make_with_options($makefile, "-j10 biz", &get_logfile, 0);
+$answer = "aaa\ntwo\nbbb\n";
+&compare_output($answer, &get_logfile(1));
 
-unlink("bar.h","bar2.h");
+unlink('foo','f1.h','f2.h');
 
 1;
 
index 02d7f07..73e946e 100644 (file)
@@ -58,4 +58,6 @@ $answer = "$make_name: `a' is up to date.\n";
 $answer = "$make_name: `a' is up to date.\n";
 &compare_output($answer, &get_logfile(1));
 
+unlink('a', 'b', 'c');
+
 1;
index 7ffe94b..2d73b08 100644 (file)
@@ -114,6 +114,7 @@ define_variable_in_set (name, length, value, origin, recursive, set)
   v->recursive = recursive;
   v->expanding = 0;
   v->per_target = 0;
+  v->append = 0;
   v->export = v_default;
   v->next = set->table[hashval];
   set->table[hashval] = v;
index 4e1b0c7..d0e9ad9 100644 (file)
@@ -59,5 +59,7 @@ arr2envblk(char **arr, char **envblk_out)
                ptr += strlen(tmp[arrcnt]) + 1;\r
                arrcnt++;\r
        }\r
+\r
+        free(tmp);\r
        return TRUE;\r
 }\r