/[make]/make/implicit.c
ViewVC logotype

Diff of /make/implicit.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.51 by bosk, Fri Dec 9 16:46:20 2005 UTC revision 1.52 by psmith, Sun Dec 11 15:41:17 2005 UTC
# Line 502  pattern_search (struct file *file, int a Line 502  pattern_search (struct file *file, int a
502                    if (p == 0)                    if (p == 0)
503                      break; /* No more words */                      break; /* No more words */
504    
505                    /* If the dependency name has %, substitute the stem.                    /* Is there a pattern in this prerequisite?  */
                      Watch out, we are going to do something tricky here. If  
                      we just replace % with the stem value, later, when we do  
                      the second expansion, we will re-expand this stem value  
                      once again. This is not good especially if you have  
                      certain characters in your stem (like $).  
   
                      Instead, we will replace % with $* and allow the second  
                      expansion to take care of it for us. This way (since $*  
                      is a simple variable) there won't be additional  
                      re-expansion of the stem.  */  
506    
507                    for (p2 = p; p2 < p + len && *p2 != '%'; ++p2)                    for (p2 = p; p2 < p + len && *p2 != '%'; ++p2)
508                      ;                      ;
509    
510                    if (p2 < p + len)                    if (dep->need_2nd_expansion)
511                      {                      {
512                        register unsigned int i = p2 - p;                        /* If the dependency name has %, substitute the stem.
                       bcopy (p, depname, i);  
                       bcopy ("$*", depname + i, 2);  
                       bcopy (p2 + 1, depname + i + 2, len - i - 1);  
                       depname[len + 2 - 1] = '\0';  
513    
514                        if (check_lastslash)                           Watch out, we are going to do something tricky
515                          add_dir = 1;                           here. If we just replace % with the stem value,
516                             later, when we do the second expansion, we will
517                             re-expand this stem value once again. This is not
518                             good especially if you have certain characters in
519                             your stem (like $).
520    
521                             Instead, we will replace % with $* and allow the
522                             second expansion to take care of it for us. This way
523                             (since $* is a simple variable) there won't be
524                             additional re-expansion of the stem.  */
525    
526                          if (p2 < p + len)
527                            {
528                              register unsigned int i = p2 - p;
529                              bcopy (p, depname, i);
530                              bcopy ("$*", depname + i, 2);
531                              bcopy (p2 + 1, depname + i + 2, len - i - 1);
532                              depname[len + 2 - 1] = '\0';
533    
534                              if (check_lastslash)
535                                add_dir = 1;
536    
537                              had_stem = 1;
538                            }
539                          else
540                            {
541                              bcopy (p, depname, len);
542                              depname[len] = '\0';
543                            }
544    
545                        had_stem = 1;                        p2 = variable_expand_for_file (depname, file);
546                      }                      }
547                    else                    else
548                      {                      {
549                        bcopy (p, depname, len);                         if (p2 < p + len)
550                        depname[len] = '\0';                          {
551                      }                            register unsigned int i = p2 - p;
552                              bcopy (p, depname, i);
553                              bcopy (stem_str, depname + i, stemlen);
554                              bcopy (p2 + 1, depname + i + stemlen, len - i - 1);
555                              depname[len + stemlen - 1] = '\0';
556    
557                              if (check_lastslash)
558                                add_dir = 1;
559    
560                              had_stem = 1;
561                            }
562                          else
563                            {
564                              bcopy (p, depname, len);
565                              depname[len] = '\0';
566                            }
567    
568                    p2 = variable_expand_for_file (depname, file);                         p2 = depname;
569                        }
570    
571                    /* Parse the dependencies. */                    /* Parse the dependencies. */
572    

Legend:
Removed from v.1.51  
changed lines
  Added in v.1.52

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26