From da19122f1448d78a27ba194ad046b40f8444638d Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 24 Apr 2008 22:13:57 +0200 Subject: [PATCH] makefiles: Add support for generating correct dependencies for tlb files. --- Make.rules.in | 11 ++++++----- configure | 1 + configure.ac | 2 ++ tools/makedep.c | 42 +++++++++++++++++++++++++++--------------- 4 files changed, 36 insertions(+), 20 deletions(-) diff --git a/Make.rules.in b/Make.rules.in index 76a4d42703..1d038416b4 100644 --- a/Make.rules.in +++ b/Make.rules.in @@ -207,10 +207,6 @@ filter: dummy dlldata.c: $(WIDL) Makefile.in $(WIDL) $(IDLFLAGS) --dlldata-only --dlldata=$@ $(IDL_P_SRCS) -# Rules for resources - -$(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res): $(WRC) $(IDL_TLB_SRCS:.idl=.tlb) - # Rule for linting $(MODULE).ln : $(LINTS) @@ -233,7 +229,10 @@ winapi_check:: dummy # Rules for dependencies -DEPEND_SRCS = $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) $(IDL_GEN_C_SRCS) $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS) +DEPEND_SRCS = $(C_SRCS) $(C_SRCS16) $(RC_SRCS) $(RC_SRCS16) $(MC_SRCS) \ + $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \ + $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \ + $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_SRCS) $(SUBDIRS:%=%/__depend__): dummy @cd `dirname $@` && $(MAKE) depend @@ -323,6 +322,8 @@ $(MC_SRCS:.mc=.mc.rc): $(WMC) $(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb): $(WIDL) +$(RC_SRCS:.rc=.res) $(RC_SRCS16:.rc=.res): $(WRC) + $(SUBDIRS): dummy @cd $@ && $(MAKE) diff --git a/configure b/configure index bfb0880140..45c98c6b8b 100755 --- a/configure +++ b/configure @@ -21436,6 +21436,7 @@ Makefile: dummy \$(OBJS): \$(IDL_GEN_HEADERS) \$(IDL_GEN_C_SRCS:.c=.o): \$(IDL_GEN_C_SRCS) +\$(RC_SRCS:.rc=.res): \$(IDL_TLB_SRCS:.idl=.tlb) \$(LEX_SRCS:.l=.yy.o): \$(LEX_SRCS:.l=.yy.c) \$(BISON_SRCS:.y=.tab.o): \$(BISON_SRCS:.y=.tab.c)" diff --git a/configure.ac b/configure.ac index 31bf9ce5c3..da31303b98 100644 --- a/configure.ac +++ b/configure.ac @@ -1634,6 +1634,7 @@ Makefile: dummy\\ \\ \$(OBJS): \$(IDL_GEN_HEADERS)\\ \$(IDL_GEN_C_SRCS:.c=.o): \$(IDL_GEN_C_SRCS)\\ +\$(RC_SRCS:.rc=.res): \$(IDL_TLB_SRCS:.idl=.tlb)\\ \$(LEX_SRCS:.l=.yy.o): \$(LEX_SRCS:.l=.yy.c)\\ \$(BISON_SRCS:.y=.tab.o): \$(BISON_SRCS:.y=.tab.c)"], ["### Dependencies: @@ -1645,6 +1646,7 @@ Makefile: dummy \$(OBJS): \$(IDL_GEN_HEADERS) \$(IDL_GEN_C_SRCS:.c=.o): \$(IDL_GEN_C_SRCS) +\$(RC_SRCS:.rc=.res): \$(IDL_TLB_SRCS:.idl=.tlb) \$(LEX_SRCS:.l=.yy.o): \$(LEX_SRCS:.l=.yy.c) \$(BISON_SRCS:.y=.tab.o): \$(BISON_SRCS:.y=.tab.c)"])) diff --git a/tools/makedep.c b/tools/makedep.c index 2a8c14df8c..e311058640 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -791,7 +791,7 @@ static void output_include( FILE *file, INCL_FILE *pFile, /******************************************************************* * output_src */ -static void output_src( FILE *file, INCL_FILE *pFile, int *column ) +static int output_src( FILE *file, INCL_FILE *pFile, int *column ) { char *obj = xstrdup( pFile->name ); char *ext = get_extension( obj ); @@ -817,30 +817,42 @@ static void output_src( FILE *file, INCL_FILE *pFile, int *column ) else if (!strcmp( ext, "idl" )) /* IDL file */ { char *name; + int got_header = 0; + const char *suffix = "cips"; - *column += fprintf( file, "%s.h", obj ); - - name = strmake( "%s_c.c", obj ); - if (find_src_file( name )) *column += fprintf( file, " %s", name ); - free( name ); - name = strmake( "%s_i.c", obj ); - if (find_src_file( name )) *column += fprintf( file, " %s", name ); - free( name ); - name = strmake( "%s_p.c", obj ); - if (find_src_file( name )) *column += fprintf( file, " %s", name ); - free( name ); - name = strmake( "%s_s.c", obj ); - if (find_src_file( name )) *column += fprintf( file, " %s", name ); + name = strmake( "%s.tlb", obj ); + if (find_src_file( name )) *column += fprintf( file, "%s", name ); + else + { + got_header = 1; + *column += fprintf( file, "%s.h", obj ); + } free( name ); + while (*suffix) + { + name = strmake( "%s_%c.c", obj, *suffix ); + if (find_src_file( name )) + { + if (!got_header++) *column += fprintf( file, " %s.h", obj ); + *column += fprintf( file, " %s", name ); + } + free( name ); + suffix++; + } *column += fprintf( file, ": %s", pFile->filename ); } + else if (!strcmp( ext, "tlb" )) + { + return 0; /* nothing to do for typelib files */ + } else { *column += fprintf( file, "%s.o: %s", obj, pFile->filename ); } } free( obj ); + return 1; } @@ -875,7 +887,7 @@ static void output_dependencies(void) LIST_FOR_EACH_ENTRY( pFile, &sources, INCL_FILE, entry ) { column = 0; - output_src( file, pFile, &column ); + if (!output_src( file, pFile, &column )) continue; for (i = 0; i < MAX_INCLUDES; i++) if (pFile->files[i]) output_include( file, pFile->files[i], pFile, &column );