diff --git a/historic/jam/src/compile.c b/historic/jam/src/compile.c index 4d64bb987..1d04efecf 100644 --- a/historic/jam/src/compile.c +++ b/historic/jam/src/compile.c @@ -372,8 +372,9 @@ compile_include( pushsettings( t->settings ); /* We don't expect that file to be included is generated by some - action. Therefore, pass 0 as third argument. */ - t->boundname = search( t->name, &t->time, 0 ); + action. Therefore, pass 0 as third argument. + If the name resolves to directory, let it error out. */ + t->boundname = search( t->name, &t->time, 0, 0 ); popsettings( t->settings ); parse_file( t->boundname, frame ); diff --git a/historic/jam/src/filesys.h b/historic/jam/src/filesys.h index a442d8268..d93b3c5ab 100644 --- a/historic/jam/src/filesys.h +++ b/historic/jam/src/filesys.h @@ -41,8 +41,13 @@ struct file_info_t { } ; typedef struct file_info_t file_info_t ; +/* Creates a pointer to information about file + 'filename', creating it as necessary. If + created, the structure will be default initialized. */ file_info_t * file_info(char * filename); +/* Returns information about a file, queries the OS + if needed. */ file_info_t * file_query(char * filename); void file_done(); diff --git a/historic/jam/src/hcache.c b/historic/jam/src/hcache.c index 5d2f24140..e4e0a2f03 100644 --- a/historic/jam/src/hcache.c +++ b/historic/jam/src/hcache.c @@ -80,9 +80,11 @@ cache_name(void) TARGET *t = bindtarget( hcachevar->string ); pushsettings( t->settings ); - /* Don't expect cache file to be generated, so pass 0 - as third argument to search. */ - t->boundname = search( t->name, &t->time, 0 ); + /* Don't expect cache file to be generated, so pass 0 + as third argument to search. + Expect the location to be specified via LOCATE, + so pass 0 as fourth arugment. */ + t->boundname = search( t->name, &t->time, 0, 0 ); popsettings( t->settings ); if (hcachevar) { diff --git a/historic/jam/src/make.c b/historic/jam/src/make.c index 5bb5dc34b..5463143e3 100644 --- a/historic/jam/src/make.c +++ b/historic/jam/src/make.c @@ -289,7 +289,8 @@ make0( if( t->binding == T_BIND_UNBOUND && !( t->flags & T_FLAG_NOTFILE ) ) { char* another_target; - t->boundname = search( t->name, &t->time, &another_target ); + t->boundname = search( t->name, &t->time, &another_target, + (t->flags & T_FLAG_ISFILE)); /* If it was detected that this target refers to an already existing and bound one, we add include dependency, so that every target which depends on us will depend on that other diff --git a/historic/jam/src/make1.c b/historic/jam/src/make1.c index 485a41caf..decb3eeb8 100644 --- a/historic/jam/src/make1.c +++ b/historic/jam/src/make1.c @@ -1145,7 +1145,8 @@ make1bind( return; pushsettings( t->settings ); - t->boundname = search( t->name, &t->time, 0 ); + t->boundname = search( t->name, &t->time, 0, + (t->flags & T_FLAG_ISFILE) ); t->binding = t->time ? T_BIND_EXISTS : T_BIND_MISSING; popsettings( t->settings ); } diff --git a/historic/jam/src/rules.c b/historic/jam/src/rules.c index 40d54b53f..8e7ccc092 100644 --- a/historic/jam/src/rules.c +++ b/historic/jam/src/rules.c @@ -165,7 +165,7 @@ static void bind_explicitly_located_target(void* xtarget, void* data) /* We're binding a target with explicit LOCATE. So third argument is of now use: nothing will be returned through it. */ - t->boundname = search( t->name, &t->time, 0 ); + t->boundname = search( t->name, &t->time, 0, 0 ); popsettings(t->settings); break; } diff --git a/historic/jam/src/search.c b/historic/jam/src/search.c index d8f77b383..7111c9e01 100644 --- a/historic/jam/src/search.c +++ b/historic/jam/src/search.c @@ -20,6 +20,7 @@ # include "compile.h" # include "strings.h" # include "hash.h" +# include "filesys.h" # include typedef struct _binding { @@ -89,7 +90,8 @@ char * search( char *target, time_t *time, - char **another_target + char **another_target, + int file ) { PATHNAME f[1]; @@ -135,6 +137,7 @@ search( while( varlist ) { BINDING b, *ba = &b; + file_info_t *ff; f->f_root.ptr = varlist->string; f->f_root.len = strlen( varlist->string ); @@ -145,6 +148,7 @@ search( if( DEBUG_SEARCH ) printf( "search %s: %s\n", target, buf->value ); + ff = file_query(buf->value); timestamp( buf->value, time ); b.binding = buf->value; @@ -159,10 +163,13 @@ search( found = 1; break; } - else if( *time ) + else if( ff && ff->time ) { - found = 1; - break; + if (!file || ff->is_file) + { + found = 1; + break; + } } varlist = list_next( varlist ); diff --git a/historic/jam/src/search.h b/historic/jam/src/search.h index af3e890fd..d54897db3 100644 --- a/historic/jam/src/search.h +++ b/historic/jam/src/search.h @@ -8,4 +8,4 @@ * search.h - find a target along $(SEARCH) or $(LOCATE) */ -char *search( char *target, time_t *time, char **another_target ); +char *search( char *target, time_t *time, char **another_target, int file );