makefiles: Also look for generated includes in the source file directory.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-01-21 09:49:19 +01:00
parent 9da1813651
commit 5d4ca2225e
1 changed files with 25 additions and 1 deletions

View File

@ -1203,6 +1203,28 @@ static struct file *open_file_same_dir( const struct incl_file *parent, const ch
}
/*******************************************************************
* open_same_dir_generated_file
*
* Open a generated_file in the same directory as the parent.
*/
static struct file *open_same_dir_generated_file( const struct makefile *make,
const struct incl_file *parent, struct incl_file *file,
const char *ext, const char *src_ext )
{
char *filename;
struct file *ret = NULL;
if (strendswith( file->name, ext ) &&
(ret = open_file_same_dir( parent, replace_extension( file->name, ext, src_ext ), &filename )))
{
file->sourcename = filename;
file->filename = obj_dir_path( make, replace_filename( parent->name, file->name ));
}
return ret;
}
/*******************************************************************
* open_local_file
*
@ -1426,7 +1448,9 @@ static struct file *open_include_file( const struct makefile *make, struct incl_
if (pFile->type == INCL_SYSTEM) return NULL; /* ignore system files we cannot find */
/* try in src file directory */
if ((file = open_file_same_dir( pFile->included_by, pFile->name, &pFile->filename )))
if ((file = open_same_dir_generated_file( make, pFile->included_by, pFile, ".tab.h", ".y" )) ||
(file = open_same_dir_generated_file( make, pFile->included_by, pFile, ".h", ".idl" )) ||
(file = open_file_same_dir( pFile->included_by, pFile->name, &pFile->filename )))
{
pFile->is_external = pFile->included_by->is_external;
return file;