makedep: Add support for magic comments in .rc files so we can generate proper dependencies for them.

This commit is contained in:
Alexandre Julliard 2006-12-26 15:02:03 +01:00
parent c290f623e0
commit f92ef1c543
9 changed files with 68 additions and 9 deletions

View File

@ -19,6 +19,4 @@ IDL_H_SRCS = \
@MAKE_DLL_RULES@
rsrc.res: atl.rgs
@DEPENDENCIES@ # everything below this line is overwritten by make depend

View File

@ -16,4 +16,5 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* @makedep: atl.rgs */
101 REGISTRY atl.rgs

View File

@ -19,6 +19,4 @@ RC_SRCS = rsrc.rc
@MAKE_DLL_RULES@
rsrc.res: itss.inf
@DEPENDENCIES@ # everything below this line is overwritten by make depend

View File

@ -16,4 +16,5 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* @makedep: itss.inf */
REGINST REGINST itss.inf

View File

@ -49,6 +49,4 @@ IDL_H_SRCS = nsiface.idl
@MAKE_DLL_RULES@
rsrc.res: mshtml.inf blank.htm
@DEPENDENCIES@ # everything below this line is overwritten by make depend

View File

@ -48,6 +48,8 @@
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
/* @makedep: mshtml.inf */
REGINST REGINST mshtml.inf
/* @makedep: blank.htm */
blank.htm HTML "blank.htm"

View File

@ -25,6 +25,4 @@ RC_SRCS = rsrc.rc
@MAKE_DLL_RULES@
rsrc.res: urlmon.inf
@DEPENDENCIES@ # everything below this line is overwritten by make depend

View File

@ -16,6 +16,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
/* @makedep: urlmon.inf */
REGINST REGINST urlmon.inf
#include "version.rc"

View File

@ -628,6 +628,63 @@ static void parse_c_file( INCL_FILE *pFile, FILE *file )
}
/*******************************************************************
* parse_rc_file
*/
static void parse_rc_file( INCL_FILE *pFile, FILE *file )
{
char *buffer, *include;
input_line = 0;
while ((buffer = get_line( file )))
{
char quote;
char *p = buffer;
while (*p && isspace(*p)) p++;
if (p[0] == '/' && p[1] == '*') /* check for magic makedep comment */
{
p += 2;
while (*p && isspace(*p)) p++;
if (strncmp( p, "@makedep:", 9 )) continue;
p += 9;
while (*p && isspace(*p)) p++;
quote = '"';
if (*p == quote)
{
include = ++p;
while (*p && *p != quote) p++;
}
else
{
include = p;
while (*p && !isspace(*p) && *p != '*') p++;
}
if (!*p)
fatal_error( "%s:%d: Malformed makedep comment\n", pFile->filename, input_line );
*p = 0;
}
else /* check for #include */
{
if (*p++ != '#') continue;
while (*p && isspace(*p)) p++;
if (strncmp( p, "include", 7 )) continue;
p += 7;
while (*p && isspace(*p)) p++;
if (*p != '\"' && *p != '<' ) continue;
quote = *p++;
if (quote == '<') quote = '>';
include = p;
while (*p && (*p != quote)) p++;
if (!*p) fatal_error( "%s:%d: Malformed #include directive\n",
pFile->filename, input_line );
*p = 0;
}
add_include( pFile, include, input_line, (quote == '>') );
}
}
/*******************************************************************
* parse_generated_idl
*/
@ -688,8 +745,13 @@ static void parse_file( INCL_FILE *pFile, int src )
parse_idl_file( pFile, file, 1 );
else if (strendswith( pFile->filename, ".idl" ))
parse_idl_file( pFile, file, 0 );
else
else if (strendswith( pFile->filename, ".c" ) ||
strendswith( pFile->filename, ".h" ) ||
strendswith( pFile->filename, ".l" ) ||
strendswith( pFile->filename, ".y" ))
parse_c_file( pFile, file );
else if (strendswith( pFile->filename, ".rc" ))
parse_rc_file( pFile, file );
fclose(file);
}