Added support for generating dependencies for idl files.
This commit is contained in:
parent
a7ac73d618
commit
aa89eccc71
|
@ -188,7 +188,7 @@ $(SUBDIRS:%=%/__depend__): $(MAKEDEP) dummy
|
||||||
cd `dirname $@` && $(MAKE) depend
|
cd `dirname $@` && $(MAKE) depend
|
||||||
|
|
||||||
depend: $(MAKEDEP) $(SUBDIRS:%=%/__depend__)
|
depend: $(MAKEDEP) $(SUBDIRS:%=%/__depend__)
|
||||||
$(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(EXTRA_SRCS)
|
$(MAKEDEP) $(DIVINCL) -C$(SRCDIR) $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(IDL_SRCS) $(EXTRA_SRCS)
|
||||||
|
|
||||||
.PHONY: depend $(SUBDIRS:%=%/__depend__)
|
.PHONY: depend $(SUBDIRS:%=%/__depend__)
|
||||||
|
|
||||||
|
@ -257,6 +257,8 @@ $(RC_SRCS16:.rc=.res): $(WRC)
|
||||||
|
|
||||||
$(MC_SRCS:.mc=.mc.rc): $(WMC)
|
$(MC_SRCS:.mc=.mc.rc): $(WMC)
|
||||||
|
|
||||||
|
$(IDL_SRCS:.idl=.h): $(WIDL)
|
||||||
|
|
||||||
$(SUBDIRS): dummy
|
$(SUBDIRS): dummy
|
||||||
@cd $@ && $(MAKE)
|
@cd $@ && $(MAKE)
|
||||||
|
|
||||||
|
|
|
@ -175,6 +175,7 @@ WINDOWS_INCLUDES = \
|
||||||
wshisotp.h \
|
wshisotp.h \
|
||||||
wsipx.h \
|
wsipx.h \
|
||||||
zmouse.h \
|
zmouse.h \
|
||||||
|
$(IDL_SRCS) \
|
||||||
$(IDL_SRCS:.idl=.h)
|
$(IDL_SRCS:.idl=.h)
|
||||||
|
|
||||||
MSVCRT_INCLUDES = \
|
MSVCRT_INCLUDES = \
|
||||||
|
@ -252,8 +253,6 @@ EXTRASUBDIRS = bitmaps msvcrt msvcrt/sys wine
|
||||||
.idl.h:
|
.idl.h:
|
||||||
$(LDPATH) $(WIDL) $(DEFS) -b -h -H $@ $<
|
$(LDPATH) $(WIDL) $(DEFS) -b -h -H $@ $<
|
||||||
|
|
||||||
$(IDL_SRCS:.idl=.h): $(WIDL)
|
|
||||||
|
|
||||||
.PHONY: idl
|
.PHONY: idl
|
||||||
|
|
||||||
idl: $(IDL_SRCS:.idl=.h)
|
idl: $(IDL_SRCS:.idl=.h)
|
||||||
|
|
|
@ -100,6 +100,17 @@ static char *xstrdup( const char *str )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************
|
||||||
|
* get_extension
|
||||||
|
*/
|
||||||
|
static char *get_extension( char *filename )
|
||||||
|
{
|
||||||
|
char *ext = strrchr( filename, '.' );
|
||||||
|
if (ext && strchr( ext, '/' )) ext = NULL;
|
||||||
|
return ext;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
* is_generated
|
* is_generated
|
||||||
*
|
*
|
||||||
|
@ -271,24 +282,45 @@ static FILE *open_include_file( INCL_FILE *pFile )
|
||||||
|
|
||||||
|
|
||||||
/*******************************************************************
|
/*******************************************************************
|
||||||
* parse_file
|
* parse_idl_file
|
||||||
*/
|
*/
|
||||||
static void parse_file( INCL_FILE *pFile, int src )
|
static void parse_idl_file( INCL_FILE *pFile, FILE *file )
|
||||||
{
|
{
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
char *include;
|
char *include;
|
||||||
int line = 0;
|
int line = 0;
|
||||||
FILE *file;
|
|
||||||
|
|
||||||
if (is_generated( pFile->name ))
|
while (fgets( buffer, sizeof(buffer)-1, file ))
|
||||||
{
|
{
|
||||||
/* file is generated during make, don't try to open it */
|
char *p = buffer;
|
||||||
pFile->filename = xstrdup( pFile->name );
|
line++;
|
||||||
return;
|
while (*p && isspace(*p)) p++;
|
||||||
|
if (strncmp( p, "import", 6 )) continue;
|
||||||
|
p += 6;
|
||||||
|
while (*p && isspace(*p)) p++;
|
||||||
|
if (*p != '\"') continue;
|
||||||
|
p++;
|
||||||
|
include = p;
|
||||||
|
while (*p && (*p != '\"')) p++;
|
||||||
|
if (!*p)
|
||||||
|
{
|
||||||
|
fprintf( stderr, "%s:%d: Malformed import directive\n",
|
||||||
|
pFile->filename, line );
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
*p = 0;
|
||||||
|
add_include( pFile, include, line, 0 );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
file = src ? open_src_file( pFile ) : open_include_file( pFile );
|
/*******************************************************************
|
||||||
if (!file) return;
|
* parse_c_file
|
||||||
|
*/
|
||||||
|
static void parse_c_file( INCL_FILE *pFile, FILE *file )
|
||||||
|
{
|
||||||
|
char buffer[1024];
|
||||||
|
char *include;
|
||||||
|
int line = 0;
|
||||||
|
|
||||||
while (fgets( buffer, sizeof(buffer)-1, file ))
|
while (fgets( buffer, sizeof(buffer)-1, file ))
|
||||||
{
|
{
|
||||||
|
@ -315,6 +347,29 @@ static void parse_file( INCL_FILE *pFile, int src )
|
||||||
*p = 0;
|
*p = 0;
|
||||||
add_include( pFile, include, line, (quote == '>') );
|
add_include( pFile, include, line, (quote == '>') );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*******************************************************************
|
||||||
|
* parse_file
|
||||||
|
*/
|
||||||
|
static void parse_file( INCL_FILE *pFile, int src )
|
||||||
|
{
|
||||||
|
char *ext;
|
||||||
|
FILE *file;
|
||||||
|
|
||||||
|
if (is_generated( pFile->name ))
|
||||||
|
{
|
||||||
|
/* file is generated during make, don't try to open it */
|
||||||
|
pFile->filename = xstrdup( pFile->name );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
file = src ? open_src_file( pFile ) : open_include_file( pFile );
|
||||||
|
if (!file) return;
|
||||||
|
ext = get_extension( pFile->name );
|
||||||
|
if (ext && !strcmp( ext, ".idl" )) parse_idl_file( pFile, file );
|
||||||
|
else parse_c_file( pFile, file );
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -349,8 +404,7 @@ static void output_include( FILE *file, INCL_FILE *pFile,
|
||||||
static void output_src( FILE *file, INCL_FILE *pFile, int *column )
|
static void output_src( FILE *file, INCL_FILE *pFile, int *column )
|
||||||
{
|
{
|
||||||
char *obj = xstrdup( pFile->name );
|
char *obj = xstrdup( pFile->name );
|
||||||
char *ext = strrchr( obj, '.' );
|
char *ext = get_extension( obj );
|
||||||
if (ext && strchr( ext, '/' )) ext = NULL;
|
|
||||||
if (ext)
|
if (ext)
|
||||||
{
|
{
|
||||||
*ext++ = 0;
|
*ext++ = 0;
|
||||||
|
@ -370,6 +424,10 @@ static void output_src( FILE *file, INCL_FILE *pFile, int *column )
|
||||||
{
|
{
|
||||||
*column += fprintf( file, "%s.mc.rc: %s", obj, pFile->filename );
|
*column += fprintf( file, "%s.mc.rc: %s", obj, pFile->filename );
|
||||||
}
|
}
|
||||||
|
else if (!strcmp( ext, "idl" )) /* IDL file */
|
||||||
|
{
|
||||||
|
*column += fprintf( file, "%s.h: %s", obj, pFile->filename );
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*column += fprintf( file, "%s.o: %s", obj, pFile->filename );
|
*column += fprintf( file, "%s.o: %s", obj, pFile->filename );
|
||||||
|
|
Loading…
Reference in New Issue