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