From 364f97c2e174f5969bbea65a13ba91a83ce6b635 Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Fri, 30 Nov 2018 12:55:18 +0100 Subject: [PATCH] makefiles: Output rules for building generated .rc files. Signed-off-by: Alexandre Julliard --- programs/winetest/Makefile.in | 5 ++--- tools/makedep.c | 23 +++++++++++++---------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index 85eacb91d9c..d74a27996a6 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -16,7 +16,7 @@ SVG_SRCS = winetest.svg EXTRA_OBJS = build.res -EXTRA_TARGETS = build.rc build.nfo +EXTRA_TARGETS = build.nfo INSTALL_LIB = none @@ -26,8 +26,7 @@ build.rc: dummy build.nfo: -$(CC) -v 2>$@ -build.res: build.rc build.nfo - $(WRC) -o $@ build.rc +build.res: build.nfo dummy: .PHONY: dummy diff --git a/tools/makedep.c b/tools/makedep.c index e2f6d23d9eb..1afac8d65a7 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -1805,7 +1805,9 @@ static struct makefile *parse_makefile( const char *path ) */ static void add_generated_sources( struct makefile *make ) { + unsigned int i; struct incl_file *source, *next, *file; + struct strarray objs = get_expanded_make_var_array( make, "EXTRA_OBJS" ); LIST_FOR_EACH_ENTRY_SAFE( source, next, &make->sources, struct incl_file, entry ) { @@ -1904,6 +1906,16 @@ static void add_generated_sources( struct makefile *make ) add_dependency( file->file, "wine/test.h", INCL_NORMAL ); add_all_includes( make, file, file->file ); } + for (i = 0; i < objs.count; i++) + { + /* default to .c for unknown extra object files */ + if (strendswith( objs.str[i], ".o" )) + add_generated_source( make, objs.str[i], replace_extension( objs.str[i], ".o", ".c" )); + else if (strendswith( objs.str[i], ".res" )) + add_generated_source( make, replace_extension( objs.str[i], ".res", ".rc" ), NULL ); + else + add_generated_source( make, objs.str[i], NULL ); + } } @@ -2514,6 +2526,7 @@ static void output_source_rc( struct makefile *make, struct incl_file *source, c struct strarray extradefs = get_expanded_file_local_var( make, obj, "EXTRADEFS" ); unsigned int i; + if (source->file->flags & FLAG_GENERATED) strarray_add( &make->clean_files, source->name ); strarray_add( &make->object_files, strmake( "%s.res", obj )); if (crosstarget) strarray_add( &make->crossobj_files, strmake( "%s.res", obj )); output( "%s.res: %s\n", obj_dir_path( make, obj ), source->filename ); @@ -4086,16 +4099,6 @@ static void load_sources( struct makefile *make ) add_generated_sources( make ); - value = get_expanded_make_var_array( make, "EXTRA_OBJS" ); - for (i = 0; i < value.count; i++) - { - /* default to .c for unknown extra object files */ - if (strendswith( value.str[i], ".o" )) - add_generated_source( make, value.str[i], replace_extension( value.str[i], ".o", ".c" ) ); - else - add_generated_source( make, value.str[i], NULL ); - } - LIST_FOR_EACH_ENTRY( file, &make->includes, struct incl_file, entry ) parse_file( make, file, 0 ); LIST_FOR_EACH_ENTRY( file, &make->sources, struct incl_file, entry ) get_dependencies( file, file ); }