Blame SOURCES/make-3.82-stem_glob.patch

71dafe
diff -up make-3.82/default.c~ make-3.82/default.c
71dafe
--- make-3.82/default.c~	2010-07-13 03:20:39.000000000 +0200
71dafe
+++ make-3.82/default.c	2013-07-26 19:28:27.372056421 +0200
71dafe
@@ -542,9 +542,8 @@ set_default_suffixes (void)
71dafe
   else
71dafe
     {
71dafe
       char *p = default_suffixes;
71dafe
-      suffix_file->deps = enter_prereqs(PARSE_FILE_SEQ (&p, struct dep, '\0',
71dafe
-                                                        NULL, 0),
71dafe
-                                        NULL);
71dafe
+      suffix_file->deps = enter_prereqs (PARSE_SIMPLE_SEQ (&p, struct dep),
71dafe
+                                         NULL);
71dafe
       define_variable_cname ("SUFFIXES", default_suffixes, o_default, 0);
71dafe
     }
71dafe
 }
71dafe
diff -up make-3.82/dep.h~ make-3.82/dep.h
71dafe
--- make-3.82/dep.h~	2010-07-13 03:20:39.000000000 +0200
71dafe
+++ make-3.82/dep.h	2013-07-26 19:40:03.121285291 +0200
71dafe
@@ -65,6 +65,8 @@ struct nameseq
71dafe
 
71dafe
 #define PARSE_FILE_SEQ(_s,_t,_c,_p,_f) \
71dafe
             (_t *)parse_file_seq ((_s),sizeof (_t),(_c),(_p),(_f))
71dafe
+#define PARSE_SIMPLE_SEQ(_s,_t) \
71dafe
+            (_t *)parse_file_seq ((_s),sizeof (_t),'\0',NULL,PARSEFS_NONE)
71dafe
 
71dafe
 #ifdef VMS
71dafe
 void *parse_file_seq ();
71dafe
diff -up make-3.82/file.c~ make-3.82/file.c
71dafe
--- make-3.82/file.c~	2010-07-13 03:20:39.000000000 +0200
71dafe
+++ make-3.82/file.c	2013-07-26 19:40:47.067541216 +0200
71dafe
@@ -426,7 +426,7 @@ remove_intermediates (int sig)
71dafe
 struct dep *
71dafe
 split_prereqs (char *p)
71dafe
 {
71dafe
-  struct dep *new = PARSE_FILE_SEQ (&p, struct dep, '|', NULL, 0);
71dafe
+  struct dep *new = PARSE_FILE_SEQ (&p, struct dep, '|', NULL, PARSEFS_NONE);
71dafe
 
71dafe
   if (*p)
71dafe
     {
71dafe
@@ -435,7 +435,7 @@ split_prereqs (char *p)
71dafe
       struct dep *ood;
71dafe
 
71dafe
       ++p;
71dafe
-      ood = PARSE_FILE_SEQ (&p, struct dep, '\0', NULL, 0);
71dafe
+      ood = PARSE_SIMPLE_SEQ (&p, struct dep);
71dafe
 
71dafe
       if (! new)
71dafe
         new = ood;
71dafe
diff -up make-3.82/implicit.c~ make-3.82/implicit.c
71dafe
--- make-3.82/implicit.c~	2010-07-13 03:20:40.000000000 +0200
71dafe
+++ make-3.82/implicit.c	2013-07-26 19:42:33.650161869 +0200
71dafe
@@ -254,8 +254,6 @@ pattern_search (struct file *file, int a
71dafe
      that is not just `%'.  */
71dafe
   int specific_rule_matched = 0;
71dafe
 
71dafe
-  struct dep dep_simple;
71dafe
-
71dafe
   unsigned int ri;  /* uninit checks OK */
71dafe
   struct rule *rule;
71dafe
 
71dafe
@@ -530,11 +528,9 @@ pattern_search (struct file *file, int a
71dafe
               /* If we don't need a second expansion, just replace the %.  */
71dafe
               if (! dep->need_2nd_expansion)
71dafe
                 {
71dafe
-                  dep_simple = *dep;
71dafe
-                  dep_simple.next = 0;
71dafe
                   p = strchr (nptr, '%');
71dafe
                   if (p == 0)
71dafe
-                    dep_simple.name = nptr;
71dafe
+                    strcpy (depname, nptr);
71dafe
                   else
71dafe
                     {
71dafe
                       char *o = depname;
71dafe
@@ -548,13 +544,19 @@ pattern_search (struct file *file, int a
71dafe
                       memcpy (o, stem_str, stemlen);
71dafe
                       o += stemlen;
71dafe
                       strcpy (o, p + 1);
71dafe
-                      dep_simple.name = strcache_add (depname);
71dafe
                     }
71dafe
-                  dl = &dep_simple;
71dafe
+
71dafe
+                  /* Parse the expanded string.  It might have wildcards.  */
71dafe
+                  p = depname;
71dafe
+                  dl = PARSE_SIMPLE_SEQ (&p, struct dep);
71dafe
+                  for (d = dl; d != NULL; d = d->next)
71dafe
+                    {
71dafe
+                      ++deps_found;
71dafe
+                      d->ignore_mtime = dep->ignore_mtime;
71dafe
+                    }
71dafe
 
71dafe
                   /* We've used up this dep, so next time get a new one.  */
71dafe
                   nptr = 0;
71dafe
-                  ++deps_found;
71dafe
                 }
71dafe
 
71dafe
               /* We have to perform second expansion on this prereq.  In an
71dafe
@@ -633,7 +635,7 @@ pattern_search (struct file *file, int a
71dafe
 
71dafe
                   /* Parse the expanded string. */
71dafe
                   dl = PARSE_FILE_SEQ (&p, struct dep, order_only ? '\0' : '|',
71dafe
-                                       add_dir ? dir : NULL, 0);
71dafe
+                                       add_dir ? dir : NULL, PARSEFS_NONE);
71dafe
 
71dafe
                   for (d = dl; d != NULL; d = d->next)
71dafe
                     {
71dafe
@@ -777,8 +779,7 @@ pattern_search (struct file *file, int a
71dafe
                 }
71dafe
 
71dafe
               /* Free the ns chain.  */
71dafe
-              if (dl != &dep_simple)
71dafe
-                free_dep_chain (dl);
71dafe
+	      free_dep_chain (dl);
71dafe
 
71dafe
               if (failed)
71dafe
                 break;
71dafe
diff -up make-3.82/main.c~ make-3.82/main.c
71dafe
--- make-3.82/main.c~	2013-07-26 19:27:26.076702728 +0200
71dafe
+++ make-3.82/main.c	2013-07-26 19:42:57.476300585 +0200
71dafe
@@ -2276,7 +2276,7 @@ main (int argc, char **argv, char **envp
71dafe
             {
71dafe
               struct nameseq *ns;
71dafe
 
71dafe
-              ns = PARSE_FILE_SEQ (&p, struct nameseq, '\0', NULL, 0);
71dafe
+              ns = PARSE_SIMPLE_SEQ (&p, struct nameseq);
71dafe
               if (ns)
71dafe
                 {
71dafe
                   /* .DEFAULT_GOAL should contain one target. */
71dafe
diff -up make-3.82/read.c~ make-3.82/read.c
71dafe
--- make-3.82/read.c~	2013-07-26 19:27:26.122702993 +0200
71dafe
+++ make-3.82/read.c	2013-07-26 19:43:42.004559875 +0200
71dafe
@@ -1033,7 +1033,7 @@ eval (struct ebuffer *ebuf, int set_defa
71dafe
         /* Make the colon the end-of-string so we know where to stop
71dafe
            looking for targets.  */
71dafe
         *colonp = '\0';
71dafe
-        filenames = PARSE_FILE_SEQ (&p2, struct nameseq, '\0', NULL, 0);
71dafe
+        filenames = PARSE_SIMPLE_SEQ (&p2, struct nameseq);
71dafe
         *p2 = ':';
71dafe
 
71dafe
         if (!filenames)
71dafe
diff -up make-3.82/rule.c~ make-3.82/rule.c
71dafe
--- make-3.82/rule.c~	2010-07-19 09:10:54.000000000 +0200
71dafe
+++ make-3.82/rule.c	2013-07-26 19:44:03.956687696 +0200
71dafe
@@ -377,7 +377,7 @@ install_pattern_rule (struct pspec *p, i
71dafe
   ++r->suffixes[0];
71dafe
 
71dafe
   ptr = p->dep;
71dafe
-  r->deps = PARSE_FILE_SEQ (&ptr, struct dep, '\0', NULL, 0);
71dafe
+  r->deps = PARSE_SIMPLE_SEQ (&ptr, struct dep);
71dafe
 
71dafe
   if (new_pattern_rule (r, 0))
71dafe
     {
71dafe
diff --git a/tests/scripts/features/rule_glob b/tests/scripts/features/rule_glob
71dafe
new file mode 100644
71dafe
index 0000000..2d377e7
71dafe
--- /dev/null
71dafe
+++ b/tests/scripts/features/rule_glob
71dafe
@@ -0,0 +1,37 @@
71dafe
+#                                                                    -*-perl-*-
71dafe
+
71dafe
+$description = "Test globbing in targets and prerequisites.";
71dafe
+
71dafe
+$details = "";
71dafe
+
71dafe
+touch(qw(a.one a.two a.three));
71dafe
+
71dafe
+# Test wildcards in regular targets and prerequisites
71dafe
+run_make_test(q{
71dafe
+.PHONY: all a.one a.two a.three
71dafe
+all: a.one* a.t[a-z0-9]o a.th[!q]ee
71dafe
+a.o[Nn][Ee] a.t*: ; @echo $@
71dafe
+},
71dafe
+              '', "a.one\na.two\na.three");
71dafe
+
71dafe
+# Test wildcards in pattern targets and prerequisites
71dafe
+run_make_test(q{
71dafe
+.PHONY: all
71dafe
+all: a.four
71dafe
+%.four : %.t* ; @echo $@: $(sort $^)
71dafe
+},
71dafe
+              '', "a.four: a.three a.two");
71dafe
+
71dafe
+# Test wildcards in second expansion targets and prerequisites
71dafe
+run_make_test(q{
71dafe
+.PHONY: all
71dafe
+all: a.four
71dafe
+.SECONDEXPANSION:
71dafe
+%.four : $$(sort %.t*) ; @echo $@: $(sort $^)
71dafe
+},
71dafe
+              '', "a.four: a.three a.two");
71dafe
+
71dafe
+unlink(qw(a.one a.two a.three));
71dafe
+
71dafe
+# This tells the test driver that the perl test script executed properly.
71dafe
+1;