Changeset 2591 for trunk/src/kmk/vpath.c
- Timestamp:
- Jun 17, 2012, 10:45:31 PM (13 years ago)
- Location:
- trunk/src/kmk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk
- Property svn:ignore
-
old new 13 13 stamp-* 14 14 makebook* 15 15 16 .*gdbinit 17 .gdb_history 18 16 19 *.dep 17 20 *.dvi … … 31 34 *.pg 32 35 *.pgs 36 33 37 README 34 38 README.DOS 35 39 README.W32 40 README.OS2 36 41 aclocal.m4 37 42 autom4te.cache … … 52 57 config.h.W32 53 58 config.h-vms 59 54 60 loadavg 55 61 loadavg.c 56 62 make 63 57 64 .deps 58 65 .dep_segment 66 ID 67 TAGS 68 59 69 _* 60 70 sun4 … … 72 82 sol2 73 83 i486-linux 84 74 85 customs 86 75 87 install-sh 76 88 mkinstalldirs 89 90 .directive.asc
-
- Property svn:ignore
-
trunk/src/kmk/vpath.c
r1993 r2591 1 1 /* Implementation of pattern-matching file search paths for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software4 Foundation, Inc.3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 4 2010 Free Software Foundation, Inc. 5 5 This file is part of GNU Make. 6 6 … … 150 150 151 151 152 /* Construct the VPATH listing for the pattern and searchpathgiven.152 /* Construct the VPATH listing for the PATTERN and DIRPATH given. 153 153 154 154 This function is called to generate selective VPATH lists and also for … … 158 158 variable. 159 159 160 If SEARCHPATH is nil, remove all previous listings with the same160 If DIRPATH is nil, remove all previous listings with the same 161 161 pattern. If PATTERN is nil, remove all VPATH listings. Existing 162 and readable directories that are not "." given in the searchpath162 and readable directories that are not "." given in the DIRPATH 163 163 separated by the path element separator (defined in make.h) are 164 164 loaded into the directory hash table if they are not there already … … 205 205 206 206 /* Free its unused storage. */ 207 free (path->searchpath); 207 /* MSVC erroneously warns without a cast here. */ 208 free ((void *)path->searchpath); 208 209 free (path); 209 210 } … … 310 311 else 311 312 /* There were no entries, so free whatever space we allocated. */ 312 free (vpath); 313 /* MSVC erroneously warns without a cast here. */ 314 free ((void *)vpath); 313 315 } 314 316 … … 335 337 FILE exists. If it is found, we return a cached name of the existing file 336 338 and set *MTIME_PTR (if MTIME_PTR is not NULL) to its modtime (or zero if no 337 stat call was done). Otherwise we return NULL. */ 339 stat call was done). Also set the matching directory index in PATH_INDEX 340 if it is not NULL. Otherwise we return NULL. */ 338 341 339 342 static const char * 340 343 selective_vpath_search (struct vpath *path, const char *file, 341 FILE_TIMESTAMP *mtime_ptr )344 FILE_TIMESTAMP *mtime_ptr, unsigned int* path_index) 342 345 { 343 346 int not_target; … … 519 522 /* Store the name we found and return it. */ 520 523 524 if (path_index) 525 *path_index = i; 526 521 527 return strcache_add_len (name, (p + 1 - name) + flen); 522 528 } … … 530 536 exists. If it is found, return the cached name of an existing file, and 531 537 set *MTIME_PTR (if MTIME_PTR is not NULL) to its modtime (or zero if no 532 stat call was done). Otherwise we return 0. */ 538 stat call was done). Also set the matching directory index in VPATH_INDEX 539 and PATH_INDEX if they are not NULL. Otherwise we return 0. */ 533 540 534 541 const char * 535 vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr) 542 vpath_search (const char *file, FILE_TIMESTAMP *mtime_ptr, 543 unsigned int* vpath_index, unsigned int* path_index) 536 544 { 537 545 struct vpath *v; … … 547 555 return 0; 548 556 557 if (vpath_index) 558 { 559 *vpath_index = 0; 560 *path_index = 0; 561 } 562 549 563 for (v = vpaths; v != 0; v = v->next) 550 if (pattern_matches (v->pattern, v->percent, file)) 551 { 552 const char *p = selective_vpath_search (v, file, mtime_ptr); 553 if (p) 554 return p; 555 } 564 { 565 if (pattern_matches (v->pattern, v->percent, file)) 566 { 567 const char *p = selective_vpath_search ( 568 v, file, mtime_ptr, path_index); 569 if (p) 570 return p; 571 } 572 573 if (vpath_index) 574 ++*vpath_index; 575 } 576 556 577 557 578 if (general_vpath != 0) 558 579 { 559 const char *p = selective_vpath_search (general_vpath, file, mtime_ptr); 580 const char *p = selective_vpath_search ( 581 general_vpath, file, mtime_ptr, path_index); 560 582 if (p) 561 583 return p; … … 564 586 return 0; 565 587 } 588 589 590 566 591 567 592
Note:
See TracChangeset
for help on using the changeset viewer.