components/make/patches/32511.patch
author Vladimir Marek <Vladimir.Marek@oracle.com>
Mon, 16 Jul 2012 14:42:16 +0200
changeset 913 646785c43987
permissions -rw-r--r--
7183755 GNU make only expands first library path after applying 143307-03
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
913
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     1
This diff is taken from git:
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     2
https://github.com/scfc/gnumake/commit/d952d36acf66398b7fe1e3efa15af73add937ecb
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     3
minus changes in the 'Changelog' files which don't apply cleanly to our sources
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     4
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     5
and it fixes Savannah bug 32511
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     6
http://savannah.gnu.org/bugs/?32511
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     7
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     8
diff --git a/ChangeLog b/ChangeLog
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
     9
index 2345823..e2a9786 100644
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    10
diff --git a/remake.c b/remake.c
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    11
index 669eadc..5526624 100644
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    12
--- a/remake.c
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    13
+++ b/remake.c
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    14
@@ -1534,8 +1534,7 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    15
   unsigned int liblen;
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    16
 
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    17
   /* Information about the earliest (in the vpath sequence) match.  */
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    18
-  unsigned int best_vpath, best_path;
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    19
-  unsigned int std_dirs = 0;
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    20
+  unsigned int best_vpath = 0, best_path = 0;
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    21
 
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    22
   char **dp;
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    23
 
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    24
@@ -1554,6 +1553,7 @@ library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr)
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    25
       static char *buf = NULL;
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    26
       static unsigned int buflen = 0;
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    27
       static int libdir_maxlen = -1;
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    28
+      static unsigned int std_dirs = 0;
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    29
       char *libbuf = variable_expand ("");
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    30
 
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    31
       /* Expand the pattern using LIB as a replacement.  */
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    32
diff --git a/tests/scripts/features/vpath3 b/tests/scripts/features/vpath3
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    33
index 978c5ee..c6ede28 100644
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    34
--- a/tests/scripts/features/vpath3
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    35
+++ b/tests/scripts/features/vpath3
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    36
@@ -1,50 +1,35 @@
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    37
-#                                                                     -*-perl-*-
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    38
+#                                                                    -*-perl-*-
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    39
 
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    40
 $description = "Test the interaction of the -lfoo feature and vpath";
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    41
 $details = "";
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    42
 
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    43
-open(MAKEFILE,"> $makefile");
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    44
-
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    45
-# The Contents of the MAKEFILE ...
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    46
-
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    47
-print MAKEFILE "vpath %.a a1\n";
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    48
-print MAKEFILE "vpath %.so b1\n";
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    49
-print MAKEFILE "vpath % a2 b2\n";
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    50
-print MAKEFILE "vpath % b3\n";
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    51
-print MAKEFILE "all: -l1 -l2 -l3; \@echo \$^\n";
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    52
-
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    53
-# END of Contents of MAKEFILE
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    54
-
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    55
-close(MAKEFILE);
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    56
-
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    57
-mkdir("a1", 0777);
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    58
-mkdir("b1", 0777);
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    59
-mkdir("a2", 0777);
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    60
-mkdir("b2", 0777);
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    61
-mkdir("b3", 0777);
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    62
-
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    63
[email protected]_to_touch = ("a1${pathsep}lib1.a",
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    64
-		   "b1${pathsep}lib1.so",
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    65
-		   "a2${pathsep}lib2.a",
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    66
-		   "b2${pathsep}lib2.so",
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    67
-		   "lib3.a",
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    68
-		   "b3${pathsep}lib3.so");
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    69
+my @dirs_to_make = qw(a1 b1 a2 b2 b3);
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    70
+for my $d (@dirs_to_make) {
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    71
+    mkdir($d, 0777);
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    72
+}
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    73
 
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    74
+my @files_to_touch = ("a1${pathsep}lib1.a",
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    75
+                      "a1${pathsep}libc.a",
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    76
+                      "b1${pathsep}lib1.so",
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    77
+                      "a2${pathsep}lib2.a",
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    78
+                      "b2${pathsep}lib2.so",
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    79
+                      "lib3.a",
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    80
+                      "b3${pathsep}lib3.so");
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    81
 &touch(@files_to_touch);
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    82
 
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    83
-&run_make_with_options($makefile,"",&get_logfile);
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    84
-
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    85
-# Create the answer to what should be produced by this Makefile
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    86
-$answer = "a1${pathsep}lib1.a a2${pathsep}lib2.a lib3.a\n";
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    87
-
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    88
-if (&compare_output($answer,&get_logfile(1)))
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    89
-{
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    90
-  unlink @files_to_touch;
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    91
-  rmdir("a1");
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    92
-  rmdir("b1");
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    93
-  rmdir("a2");
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    94
-  rmdir("b2");
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    95
-  rmdir("b3");
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    96
+run_make_test('
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    97
+vpath %.h b3
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    98
+vpath %.a a1
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
    99
+vpath %.so b1
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   100
+vpath % a2 b2
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   101
+vpath % b3
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   102
+all: -l1 -lc -l2 -l3; @echo $^
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   103
+',
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   104
+              '', "a1${pathsep}lib1.a a1${pathsep}libc.a a2${pathsep}lib2.a lib3.a\n");
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   105
+
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   106
+unlink(@files_to_touch);
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   107
+for my $d (@dirs_to_make) {
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   108
+    rmdir($d);
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   109
 }
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   110
 
646785c43987 7183755 GNU make only expands first library path after applying 143307-03
Vladimir Marek <Vladimir.Marek@oracle.com>
parents:
diff changeset
   111
 1;