From 5d4ca2225e8edecbaab25545d6a08d40e54cfca9 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 21 Jan 2022 09:49:19 +0100 Subject: [PATCH] makefiles: Also look for generated includes in the source file directory. Signed-off-by: Alexandre Julliard --- tools/makedep.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tools/makedep.c b/tools/makedep.c index a4557785f3a..04cb14504b5 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -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;