From e91304e4165cd825f63b52105b3df8f70e0de54f Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 22 Feb 2018 18:17:46 +0100 Subject: [PATCH] makefiles: Generate the remaining top-level rules from makedep. Signed-off-by: Alexandre Julliard --- Makefile.in | 2 +- aclocal.m4 | 40 +++--------------------- configure | 48 ++++++---------------------- tools/makedep.c | 83 +++++++++++++++++++++++++++++++++++-------------- 4 files changed, 73 insertions(+), 100 deletions(-) diff --git a/Makefile.in b/Makefile.in index 4738d79c771..33400916fbe 100644 --- a/Makefile.in +++ b/Makefile.in @@ -131,7 +131,7 @@ install-manpages:: manpages # dependencies needed to build any dll or program __tooldeps__: libs/port libs/wpp __builddeps__: __tooldeps__ libs/wine include po -.PHONY: depend dummy check test crosstest __tooldeps__ __builddeps__ install install-lib install-dev +.PHONY: depend dummy __tooldeps__ install install-lib install-dev dummy: loader: libs/port libs/wine tools diff --git a/aclocal.m4 b/aclocal.m4 index 830ec2ff8f8..36881659f5f 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -233,11 +233,6 @@ wine_fn_append_rule () wine_fn_all_rules () { wine_fn_append_file SUBDIRS $ac_dir - wine_fn_append_rule \ -"all: $ac_dir -.PHONY: $ac_dir -$ac_dir: dummy - @cd $ac_dir && \$(MAKE)" } wine_fn_disabled_rules () @@ -255,22 +250,15 @@ wine_fn_config_makefile () dnl These are created as symlinks for wow64 builds fonts|server) test -z "$with_wine64" || return ;; esac - AS_VAR_IF([$ac_enable],[no],[wine_fn_disabled_rules; return]) - wine_fn_all_rules + AS_VAR_IF([$ac_enable],[no],[wine_fn_disabled_rules],[wine_fn_all_rules]) } wine_fn_config_lib () { ac_name=$[1] ac_dir=dlls/$ac_name - ac_deps="include" - AS_VAR_IF([enable_tools],[no],,[ac_deps="tools/widl tools/winebuild tools/winegcc $ac_deps"]) wine_fn_all_rules - - wine_fn_append_rule \ -"__builddeps__: $ac_dir -$ac_dir: $ac_deps" } wine_fn_config_dll () @@ -278,14 +266,7 @@ wine_fn_config_dll () ac_name=$[1] ac_dir=dlls/$ac_name ac_enable=$[2] - - AS_VAR_IF([$ac_enable],[no],[wine_fn_disabled_rules; return]) - - wine_fn_all_rules - wine_fn_append_rule \ -"$ac_dir: __builddeps__ -manpages htmlpages sgmlpages xmlpages:: - @cd $ac_dir && \$(MAKE) \$[@]" + AS_VAR_IF([$ac_enable],[no],[wine_fn_disabled_rules],[wine_fn_all_rules]) } wine_fn_config_program () @@ -293,11 +274,7 @@ wine_fn_config_program () ac_name=$[1] ac_dir=programs/$ac_name ac_enable=$[2] - - AS_VAR_IF([$ac_enable],[no],[wine_fn_disabled_rules; return]) - - wine_fn_all_rules - wine_fn_append_rule "$ac_dir: __builddeps__" + AS_VAR_IF([$ac_enable],[no],[wine_fn_disabled_rules],[wine_fn_all_rules]) } wine_fn_config_test () @@ -309,7 +286,6 @@ wine_fn_config_test () wine_fn_append_file ALL_TEST_RESOURCES $ac_name.res wine_fn_all_rules - wine_fn_append_rule "$ac_dir: __builddeps__" } wine_fn_config_tool () @@ -328,19 +304,11 @@ wine_fn_config_tool () wine_fn_config_symlink () { - ac_linkdir= - if test "x$[1]" = "x-d" - then - ac_linkdir=$[2] - shift; shift - fi ac_links=$[@] wine_fn_append_rule \ "$ac_links: @./config.status \$[@]" for f in $ac_links; do wine_fn_append_file CONFIGURE_TARGETS $f; done - test -n "$ac_linkdir" || return - wine_fn_append_rule "$ac_linkdir/depend: $ac_links" }]) dnl **** Define helper function to append a file to a makefile file list **** @@ -364,7 +332,7 @@ m4_ifval([$4],[if test "x$[$4]" != xno; then ])m4_foreach([f],[$3], [AC_CONFIG_LINKS(m4_ifval([$1],[$1/])f[:]m4_ifval([$2],[$2/])m4_ifval([$5],[$5],f))])dnl m4_if([$1],[$2],[test "$srcdir" = "." || ])dnl -wine_fn_config_symlink[]m4_if([$1],[$2],,m4_ifval([$1],[ -d $1]))[]m4_foreach([f],[$3],[ ]m4_ifval([$1],[$1/])f)m4_ifval([$4],[ +wine_fn_config_symlink[]m4_foreach([f],[$3],[ ]m4_ifval([$1],[$1/])f)m4_ifval([$4],[ fi])[]dnl ])]) diff --git a/configure b/configure index 4dae327e4e9..d5fce3ca47e 100755 --- a/configure +++ b/configure @@ -7729,11 +7729,6 @@ wine_fn_append_rule () wine_fn_all_rules () { wine_fn_append_file SUBDIRS $ac_dir - wine_fn_append_rule \ -"all: $ac_dir -.PHONY: $ac_dir -$ac_dir: dummy - @cd $ac_dir && \$(MAKE)" } wine_fn_disabled_rules () @@ -7751,27 +7746,18 @@ wine_fn_config_makefile () fonts|server) test -z "$with_wine64" || return ;; esac if eval test \"x\$"$ac_enable"\" = x"no"; then : - wine_fn_disabled_rules; return + wine_fn_disabled_rules +else + wine_fn_all_rules fi - wine_fn_all_rules } wine_fn_config_lib () { ac_name=$1 ac_dir=dlls/$ac_name - ac_deps="include" - if test "x$enable_tools" = xno; then : - -else - ac_deps="tools/widl tools/winebuild tools/winegcc $ac_deps" -fi wine_fn_all_rules - - wine_fn_append_rule \ -"__builddeps__: $ac_dir -$ac_dir: $ac_deps" } wine_fn_config_dll () @@ -7779,16 +7765,11 @@ wine_fn_config_dll () ac_name=$1 ac_dir=dlls/$ac_name ac_enable=$2 - if eval test \"x\$"$ac_enable"\" = x"no"; then : - wine_fn_disabled_rules; return + wine_fn_disabled_rules +else + wine_fn_all_rules fi - - wine_fn_all_rules - wine_fn_append_rule \ -"$ac_dir: __builddeps__ -manpages htmlpages sgmlpages xmlpages:: - @cd $ac_dir && \$(MAKE) \$@" } wine_fn_config_program () @@ -7796,13 +7777,11 @@ wine_fn_config_program () ac_name=$1 ac_dir=programs/$ac_name ac_enable=$2 - if eval test \"x\$"$ac_enable"\" = x"no"; then : - wine_fn_disabled_rules; return + wine_fn_disabled_rules +else + wine_fn_all_rules fi - - wine_fn_all_rules - wine_fn_append_rule "$ac_dir: __builddeps__" } wine_fn_config_test () @@ -7816,7 +7795,6 @@ fi wine_fn_append_file ALL_TEST_RESOURCES $ac_name.res wine_fn_all_rules - wine_fn_append_rule "$ac_dir: __builddeps__" } wine_fn_config_tool () @@ -7837,19 +7815,11 @@ fi wine_fn_config_symlink () { - ac_linkdir= - if test "x$1" = "x-d" - then - ac_linkdir=$2 - shift; shift - fi ac_links=$@ wine_fn_append_rule \ "$ac_links: @./config.status \$@" for f in $ac_links; do wine_fn_append_file CONFIGURE_TARGETS $f; done - test -n "$ac_linkdir" || return - wine_fn_append_rule "$ac_linkdir/depend: $ac_links" } wine_binary="wine" diff --git a/tools/makedep.c b/tools/makedep.c index a0b7ff595ad..bba25e0b10b 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -3400,7 +3400,9 @@ static void output_programs( struct makefile *make ) static void output_subdirs( struct makefile *make ) { struct strarray symlinks = empty_strarray; + struct strarray all_deps = empty_strarray; struct strarray build_deps = empty_strarray; + struct strarray builddeps_deps = empty_strarray; struct strarray makefile_deps = empty_strarray; struct strarray clean_files = empty_strarray; struct strarray testclean_files = empty_strarray; @@ -3410,12 +3412,6 @@ static void output_subdirs( struct makefile *make ) struct strarray crosstest_deps = empty_strarray; unsigned int i, j; - strarray_add( &tools_deps, tools_dir_path( make, "widl" )); - strarray_add( &tools_deps, tools_dir_path( make, "winebuild" )); - strarray_add( &tools_deps, tools_dir_path( make, "winegcc" )); - strarray_add( &tools_deps, obj_dir_path( make, "include" )); - strarray_add( &tools_deps, "dummy" ); - strarray_addall( &distclean_files, make->distclean_files ); for (i = 0; i < make->subdirs.count; i++) { @@ -3437,18 +3433,14 @@ static void output_subdirs( struct makefile *make ) char *importlib_path = base_dir_path( submake, strmake( "lib%s", submake->importlib )); if (submake->implib_objs.count) { - output( "%s.a:", importlib_path ); - output_filenames( tools_deps ); - output( "\n" ); + output( "%s.a: dummy\n", importlib_path ); output( "\t@cd %s && $(MAKE) lib%s.a\n", subdir, submake->importlib ); - strarray_add( &build_deps, strmake( "%s.a", importlib_path )); + strarray_add( &tools_deps, strmake( "%s.a", importlib_path )); if (crosstarget) { - output( "%s.cross.a:", importlib_path ); - output_filenames( tools_deps ); - output( "\n" ); + output( "%s.cross.a: dummy\n", importlib_path ); output( "\t@cd %s && $(MAKE) lib%s.cross.a\n", subdir, submake->importlib ); - strarray_add( &build_deps, strmake( "%s.cross.a", importlib_path )); + strarray_add( &tools_deps, strmake( "%s.cross.a", importlib_path )); } } else @@ -3485,20 +3477,38 @@ static void output_subdirs( struct makefile *make ) } if (submake->disabled) continue; - if (submake->testdll) + strarray_add( &all_deps, subdir ); + + if (submake->module) + { + if (!submake->staticlib) + { + strarray_add( &builddeps_deps, subdir ); + if (!make->appmode.count) + { + output( "manpages htmlpages sgmlpages xmlpages::\n" ); + output( "\t@cd %s && $(MAKE) $@\n", subdir ); + } + } + else strarray_add( &tools_deps, subdir ); + } + else if (submake->testdll) { output( "check test::\n" ); output( "\t@cd %s && $(MAKE) test\n", subdir ); strarray_add( &winetest_deps, subdir ); + strarray_add( &builddeps_deps, subdir ); if (crosstarget) { char *target = base_dir_path( submake, "crosstest" ); output( "crosstest: %s\n", target ); - output( "%s: __builddeps__ dummy\n", target ); + output( "%s: dummy\n", target ); output( "\t@cd %s && $(MAKE) crosstest\n", subdir ); strarray_add( &crosstest_deps, target ); + strarray_add( &builddeps_deps, target ); } } + if (submake->install_rules[INSTALL_LIB].count) { output( "install install-lib:: %s\n", submake->base_dir ); @@ -3510,36 +3520,61 @@ static void output_subdirs( struct makefile *make ) output_install_commands( make, submake, submake->install_rules[INSTALL_DEV] ); } } + output( "all:" ); + output_filenames( all_deps ); + output( "\n" ); + output_filenames( all_deps ); + output( ": dummy\n" ); + output( "\t@cd $@ && $(MAKE)\n" ); output( "Makefile:" ); output_filenames( makefile_deps ); output( "\n" ); output_filenames( makefile_deps ); output( ":\n" ); - output( "programs/winetest:" ); - output_filenames( winetest_deps ); - output( "\n" ); - output( "crosstest:" ); - output_filenames( crosstest_deps ); - output( "\n" ); + if (winetest_deps.count) + { + output( "programs/winetest:" ); + output_filenames( winetest_deps ); + output( "\n" ); + strarray_add( &make->phony_targets, "check" ); + strarray_add( &make->phony_targets, "test" ); + } + if (crosstest_deps.count) + { + output( "crosstest:" ); + output_filenames( crosstest_deps ); + output( "\n" ); + strarray_add( &make->phony_targets, "crosstest" ); + } output( "clean::\n"); output_rm_filenames( clean_files ); output( "testclean::\n"); output_rm_filenames( testclean_files ); output( "distclean::\n"); output_rm_filenames( distclean_files ); - strarray_add( &make->phony_targets, "check" ); - strarray_add( &make->phony_targets, "test" ); + output_filenames( tools_deps ); + output( ":" ); + output_filename( tools_dir_path( make, "widl" )); + output_filename( tools_dir_path( make, "winebuild" )); + output_filename( tools_dir_path( make, "winegcc" )); + output_filename( obj_dir_path( make, "include" )); + output( "\n" ); + output_filenames( builddeps_deps ); + output( ": __builddeps__\n" ); strarray_add( &make->phony_targets, "distclean" ); strarray_add( &make->phony_targets, "testclean" ); + strarray_addall( &make->phony_targets, all_deps ); strarray_addall( &make->phony_targets, crosstest_deps ); strarray_addall( &make->clean_files, symlinks ); + strarray_addall( &build_deps, tools_deps ); strarray_addall( &build_deps, symlinks ); if (build_deps.count) { output( "__builddeps__:" ); output_filenames( build_deps ); output( "\n" ); + strarray_add( &make->phony_targets, "__builddeps__" ); } if (get_expanded_make_variable( make, "GETTEXTPO_LIBS" )) output_po_files( make ); }