2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-17 13:42:14 +00:00

Implement ISFILE for real

[SVN r41980]
This commit is contained in:
Vladimir Prus
2007-12-11 19:45:37 +00:00
parent 41fb30678f
commit 01f97eaedd
8 changed files with 30 additions and 13 deletions

View File

@@ -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 );

View File

@@ -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();

View File

@@ -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) {

View File

@@ -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

View File

@@ -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 );
}

View File

@@ -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;
}

View File

@@ -20,6 +20,7 @@
# include "compile.h"
# include "strings.h"
# include "hash.h"
# include "filesys.h"
# include <string.h>
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 );

View File

@@ -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 );