Commit dea28ee4 authored by Alexandre Julliard's avatar Alexandre Julliard

makedep: Don't add dependencies for system headers.

parent b7ef1b2e
...@@ -203,7 +203,7 @@ $(SUBDIRS:%=%/__depend__): dummy ...@@ -203,7 +203,7 @@ $(SUBDIRS:%=%/__depend__): dummy
cd `dirname $@` && $(MAKE) depend cd `dirname $@` && $(MAKE) depend
depend: $(IDL_SRCS:.idl=.h) $(SUBDIRS:%=%/__depend__) depend: $(IDL_SRCS:.idl=.h) $(SUBDIRS:%=%/__depend__)
$(MAKEDEP) $(INCLUDES) -C$(SRCDIR) $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(IDL_SRCS) $(EXTRA_SRCS) $(MAKEDEP) -C$(SRCDIR) -S$(TOPSRCDIR) -T$(TOPOBJDIR) $(INCLUDES) $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(IDL_SRCS) $(EXTRA_SRCS)
.PHONY: depend $(SUBDIRS:%=%/__depend__) .PHONY: depend $(SUBDIRS:%=%/__depend__)
......
...@@ -60,7 +60,9 @@ typedef struct _INCL_PATH ...@@ -60,7 +60,9 @@ typedef struct _INCL_PATH
static struct list paths = LIST_INIT(paths); static struct list paths = LIST_INIT(paths);
static const char *SrcDir = NULL; static const char *src_dir;
static const char *top_src_dir;
static const char *top_obj_dir;
static const char *OutputFileName = "Makefile"; static const char *OutputFileName = "Makefile";
static const char *Separator = "### Dependencies"; static const char *Separator = "### Dependencies";
static const char *ProgramName; static const char *ProgramName;
...@@ -71,6 +73,8 @@ static const char Usage[] = ...@@ -71,6 +73,8 @@ static const char Usage[] =
"Options:\n" "Options:\n"
" -Idir Search for include files in directory 'dir'\n" " -Idir Search for include files in directory 'dir'\n"
" -Cdir Search for source files in directory 'dir'\n" " -Cdir Search for source files in directory 'dir'\n"
" -Sdir Set the top source directory\n"
" -Sdir Set the top object directory\n"
" -fxxx Store output in file 'xxx' (default: Makefile)\n" " -fxxx Store output in file 'xxx' (default: Makefile)\n"
" -sxxx Use 'xxx' as separator (default: \"### Dependencies\")\n"; " -sxxx Use 'xxx' as separator (default: \"### Dependencies\")\n";
...@@ -299,10 +303,10 @@ static FILE *open_src_file( INCL_FILE *pFile ) ...@@ -299,10 +303,10 @@ static FILE *open_src_file( INCL_FILE *pFile )
return file; return file;
} }
/* now try in source dir */ /* now try in source dir */
if (SrcDir) if (src_dir)
{ {
pFile->filename = xmalloc( strlen(SrcDir) + strlen(pFile->name) + 2 ); pFile->filename = xmalloc( strlen(src_dir) + strlen(pFile->name) + 2 );
strcpy( pFile->filename, SrcDir ); strcpy( pFile->filename, src_dir );
strcat( pFile->filename, "/" ); strcat( pFile->filename, "/" );
strcat( pFile->filename, pFile->name ); strcat( pFile->filename, pFile->name );
file = fopen( pFile->filename, "r" ); file = fopen( pFile->filename, "r" );
...@@ -580,8 +584,13 @@ static void parse_option( const char *opt ) ...@@ -580,8 +584,13 @@ static void parse_option( const char *opt )
if (opt[2]) add_include_path( opt + 2 ); if (opt[2]) add_include_path( opt + 2 );
break; break;
case 'C': case 'C':
if (opt[2]) SrcDir = opt + 2; src_dir = opt + 2;
else SrcDir = NULL; break;
case 'S':
top_src_dir = opt + 2;
break;
case 'T':
top_obj_dir = opt + 2;
break; break;
case 'f': case 'f':
if (opt[2]) OutputFileName = opt + 2; if (opt[2]) OutputFileName = opt + 2;
...@@ -604,18 +613,40 @@ static void parse_option( const char *opt ) ...@@ -604,18 +613,40 @@ static void parse_option( const char *opt )
int main( int argc, char *argv[] ) int main( int argc, char *argv[] )
{ {
INCL_FILE *pFile; INCL_FILE *pFile;
INCL_PATH *path, *next;
int i, j;
ProgramName = argv[0]; ProgramName = argv[0];
while (argc > 1)
i = 1;
while (i < argc)
{ {
if (*argv[1] == '-') parse_option( argv[1] ); if (argv[i][0] == '-')
else
{ {
pFile = add_src_file( argv[1] ); parse_option( argv[i] );
parse_file( pFile, 1 ); for (j = i; j < argc; j++) argv[j] = argv[j+1];
}
argc--; argc--;
argv++; }
else i++;
}
/* get rid of absolute paths that don't point into the source dir */
LIST_FOR_EACH_ENTRY_SAFE( path, next, &paths, INCL_PATH, entry )
{
if (path->name[0] != '/') continue;
if (top_src_dir)
{
if (!strncmp( path->name, top_src_dir, strlen(top_src_dir) )) continue;
if (path->name[strlen(top_src_dir)] == '/') continue;
}
list_remove( &path->entry );
free( path );
}
for (i = 1; i < argc; i++)
{
pFile = add_src_file( argv[i] );
parse_file( pFile, 1 );
} }
LIST_FOR_EACH_ENTRY( pFile, &includes, INCL_FILE, entry ) parse_file( pFile, 0 ); LIST_FOR_EACH_ENTRY( pFile, &includes, INCL_FILE, entry ) parse_file( pFile, 0 );
if (!list_empty( &sources )) output_dependencies(); if (!list_empty( &sources )) output_dependencies();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment