From d9a75184c77b292e5ac028cb0bb6158a89630162 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Tue, 15 Oct 2013 12:30:54 +0200 Subject: [PATCH] makefiles: Generate explicit build rules for idl files from makedep. --- Make.rules.in | 32 ++---------------------- tools/makedep.c | 65 ++++++++++++++++++++++++++++++------------------- 2 files changed, 42 insertions(+), 55 deletions(-) diff --git a/Make.rules.in b/Make.rules.in index ee512084d37..83797ba64eb 100644 --- a/Make.rules.in +++ b/Make.rules.in @@ -36,7 +36,7 @@ CROSSOBJS = $(OBJS:.o=.cross.o) # Implicit rules -.SUFFIXES: .idl .tlb .h .ok .man.in .man _c.c _i.c _p.c _s.c _r.res _t.res .cross.o .po .mo @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp +.SUFFIXES: .ok .man.in .man .cross.o .po .mo @MAINTAINER_MODE@ .sfd .ttf .svg .ico .bmp .c.o: $(CC) -c $(ALLCFLAGS) -o $@ $< @@ -47,30 +47,6 @@ CROSSOBJS = $(OBJS:.o=.cross.o) .c.cross.o: $(CROSSCC) -c $(INCLUDES) $(DEFS) -DWINE_CROSSTEST $(CPPFLAGS) $(CFLAGS) -o $@ $< -.idl.h: - $(WIDL) $(IDLFLAGS) -h -o $@ $< - -.idl_c.c: - $(WIDL) $(IDLFLAGS) -c -o $@ $< - -.idl_i.c: - $(WIDL) $(IDLFLAGS) -u -o $@ $< - -.idl_p.c: - $(WIDL) $(IDLFLAGS) -p -o $@ $< - -.idl_r.res: - $(WIDL) $(IDLFLAGS) -r -o $@ $< - -.idl_s.c: - $(WIDL) $(IDLFLAGS) -s -o $@ $< - -.idl.tlb: - $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $< - -.idl_t.res: - $(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ $< - .c.ok: $(RUNTEST) $(RUNTESTFLAGS) $< && touch $@ @@ -129,7 +105,7 @@ $(IMPORTLIB:%=lib%.cross.a): $(MAINSPEC) $(IMPLIB_SRCS:.c=.cross.o) # Rules for dependencies DEPEND_SRCS = $(C_SRCS) $(OBJC_SRCS) $(RC_SRCS) $(MC_SRCS) $(PO_SRCS:.rc=.pot) \ - $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_S_SRCS) \ + $(IDL_H_SRCS) $(IDL_C_SRCS) $(IDL_I_SRCS) $(IDL_P_SRCS) $(IDL_R_SRCS) $(IDL_S_SRCS) \ $(IDL_GEN_C_SRCS) $(IDL_R_SRCS:.idl=_r.res) $(IDL_TLB_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) \ $(BISON_SRCS) $(LEX_SRCS) $(EXTRA_OBJS) @@ -207,8 +183,4 @@ install install-lib install-dev uninstall:: .PHONY: install install-lib install-dev uninstall -# Misc. rules - -$(IDL_GEN_HEADERS) $(IDL_GEN_C_SRCS) $(IDL_TLB_SRCS:.idl=.tlb) $(IDL_TLB_RES) $(IDL_R_SRCS:.idl=_r.res): $(WIDL) - # End of global rules diff --git a/tools/makedep.c b/tools/makedep.c index dcf74141e39..384a1a2128f 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -1005,36 +1005,51 @@ static void output_sources(void) } else if (!strcmp( ext, "idl" )) /* IDL file */ { - char *name; - int got_header = 0; - const char *suffix = "cips"; + char *targets[8]; + int nb_targets = 0; + char ending[] = "_?.c"; + const char *suffix; + char *header = strmake( "%s.h", obj ); - name = strmake( "%s.tlb", obj ); - if (find_src_file( name )) column += output( "%s %s_t.res", name, obj ); - else + if (find_target_src_file( source->name, ".tlb" )) { - got_header = 1; - column += output( "%s.h", obj ); - } - free( name ); - - while (*suffix) - { - name = strmake( "%s_%c.c", obj, *suffix ); - if (find_src_file( name )) - { - if (!got_header++) column += output( " %s.h", obj ); - column += output( " %s", name ); - } - free( name ); - suffix++; + output( "%s.tlb %s_t.res: $(WIDL)\n", obj, obj ); + output( "\t$(WIDL) $(TARGETFLAGS) $(IDLFLAGS) -t -o $@ %s\n", source->filename ); + targets[nb_targets++] = strmake( "%s.tlb", obj ); + targets[nb_targets++] = strmake( "%s_t.res", obj ); } - name = strmake( "%s_r.res", obj ); - if (find_src_file( name )) column += output( " %s", name ); - free( name ); + for (suffix = "cips"; *suffix; suffix++) + { + ending[1] = *suffix; + if (!find_target_src_file( source->name, ending )) continue; + output( "%s%s: $(WIDL)\n", obj, ending ); + output( "\t$(WIDL) $(IDLFLAGS) -%c -o $@ %s\n", + *suffix == 'i' ? 'u' : *suffix, source->filename ); + targets[nb_targets++] = strmake( "%s%s", obj, ending ); + } - column += output( ": %s", source->filename ); + if (find_target_src_file( source->name, "_r.res" )) + { + output( "%s_r.res: $(WIDL)\n", obj ); + output( "\t$(WIDL) $(IDLFLAGS) -r -o $@ %s\n", source->filename ); + targets[nb_targets++] = strmake( "%s_r.res", obj ); + } + + if (!nb_targets || find_include_file( header )) + { + output( "%s.h: $(WIDL)\n", obj ); + output( "\t$(WIDL) $(IDLFLAGS) -h -o $@ %s\n", source->filename ); + targets[nb_targets++] = header; + } + else free( header ); + + for (i = 0; i < nb_targets; i++) + { + column += output( "%s%c", targets[i], i < nb_targets - 1 ? ' ' : ':' ); + free( targets[i] ); + } + column += output( " %s", source->filename ); } else if (!strcmp( ext, "tlb" ) || !strcmp( ext, "res" ) || !strcmp( ext, "pot" )) {