From 8f57dfedf8a01351a8824eb57d39912d90fa768a Mon Sep 17 00:00:00 2001 From: Alexandre Julliard <julliard@winehq.org> Date: Mon, 11 Jan 2016 16:05:51 +0900 Subject: [PATCH] makefiles: Generate all makefiles at once. Signed-off-by: Alexandre Julliard <julliard@winehq.org> --- Makefile.in | 1 + aclocal.m4 | 57 +++++++++++++++++++++---------------------- configure | 65 ++++++++++++++++++++++++++----------------------- configure.ac | 6 +++-- tools/makedep.c | 62 +++++++++++++++++++++++++++++----------------- 5 files changed, 107 insertions(+), 84 deletions(-) diff --git a/Makefile.in b/Makefile.in index 1c5a44d2416..65ef0c74b64 100644 --- a/Makefile.in +++ b/Makefile.in @@ -72,6 +72,7 @@ ICOTOOL = @ICOTOOL@ MSGFMT = @MSGFMT@ CROSSTARGET = @CROSSTARGET@ LINGUAS = @LINGUAS@ +SUBDIRS = @SUBDIRS@ RUNTESTFLAGS = -q -P wine MAKEDEP = $(TOOLSDIR)/tools/makedep$(TOOLSEXT) WINEBUILD = $(TOOLSDIR)/tools/winebuild/winebuild$(TOOLSEXT) diff --git a/aclocal.m4 b/aclocal.m4 index ded8ec6b918..406f3b4cccd 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -201,6 +201,7 @@ AC_DEFUN([WINE_CONFIG_HELPERS], rm -f $wine_rules_file ALL_POT_FILES="" GITIGNORE="# Automatically generated by configure; DO NOT EDIT!!" +AC_SUBST(SUBDIRS,"") AC_SUBST(ALL_TEST_RESOURCES,"") wine_fn_append_file () @@ -229,13 +230,9 @@ wine_fn_has_flag () wine_fn_depend_rules () { + wine_fn_append_file SUBDIRS $ac_dir wine_fn_append_rule \ -"$ac_dir/Makefile: $srcdir/$ac_dir/Makefile.in Makefile \$(MAKEDEP) - \$(MAKEDEP) $ac_dir -depend: $ac_dir/depend -.PHONY: $ac_dir/depend -$ac_dir/depend: \$(MAKEDEP) dummy - \$(MAKEDEP) $ac_dir" +"Makefile: $srcdir/$ac_dir/Makefile.in" } wine_fn_pot_rules () @@ -246,7 +243,7 @@ wine_fn_pot_rules () then wine_fn_append_file ALL_POT_FILES $ac_dir/msg.pot wine_fn_append_rule \ -"$ac_dir/msg.pot: $ac_dir/Makefile dummy +"$ac_dir/msg.pot: dummy @cd $ac_dir && \$(MAKE) msg.pot $ac_dir/msg.pot: tools/wmc include" fi @@ -254,7 +251,7 @@ $ac_dir/msg.pot: tools/wmc include" then wine_fn_append_file ALL_POT_FILES $ac_dir/rsrc.pot wine_fn_append_rule \ -"$ac_dir/rsrc.pot: $ac_dir/Makefile dummy +"$ac_dir/rsrc.pot: dummy @cd $ac_dir && \$(MAKE) rsrc.pot $ac_dir/rsrc.pot: tools/wrc include" fi @@ -266,7 +263,7 @@ wine_fn_all_rules () wine_fn_append_rule \ "all: $ac_dir .PHONY: $ac_dir -$ac_dir: $ac_dir/Makefile dummy +$ac_dir: dummy @cd $ac_dir && \$(MAKE)" } @@ -278,7 +275,7 @@ wine_fn_install_rules () ".PHONY: $ac_dir/install $ac_dir/uninstall $ac_dir/install:: $ac_dir @cd $ac_dir && \$(MAKE) install -$ac_dir/uninstall:: $ac_dir/Makefile +$ac_dir/uninstall:: @cd $ac_dir && \$(MAKE) uninstall install:: $ac_dir/install __uninstall__: $ac_dir/uninstall" @@ -314,18 +311,18 @@ wine_fn_clean_rules () if wine_fn_has_flag clean then wine_fn_append_rule \ -"__clean__: $ac_dir/clean -.PHONY: $ac_dir/clean -$ac_dir/clean: $ac_dir/Makefile - @cd $ac_dir && \$(MAKE) clean - \$(RM) $ac_extraclean" +"$ac_dir/clean: dummy + @cd $ac_dir && \$(MAKE) clean" else wine_fn_append_rule \ +"$ac_dir/clean: dummy + \$(RM) \$(CLEAN_FILES:%=$ac_dir/%) $ac_clean" + fi + wine_fn_append_rule \ "__clean__: $ac_dir/clean .PHONY: $ac_dir/clean -$ac_dir/clean: dummy - \$(RM) \$(CLEAN_FILES:%=$ac_dir/%) $ac_clean $ac_extraclean" - fi +distclean:: + \$(RM) $ac_extraclean" } wine_fn_disabled_rules () @@ -338,7 +335,9 @@ wine_fn_disabled_rules () "__clean__: $ac_dir/clean .PHONY: $ac_dir/clean $ac_dir/clean: dummy - \$(RM) \$(CLEAN_FILES:%=$ac_dir/%) $ac_clean $ac_extraclean" + \$(RM) \$(CLEAN_FILES:%=$ac_dir/%) $ac_clean +distclean:: + \$(RM) $ac_extraclean" } wine_fn_config_makefile () @@ -417,7 +416,7 @@ wine_fn_config_dll () wine_fn_clean_rules $ac_clean wine_fn_append_rule \ "$ac_dir: __builddeps__ -manpages htmlpages sgmlpages xmlpages:: $ac_dir/Makefile +manpages htmlpages sgmlpages xmlpages:: @cd $ac_dir && \$(MAKE) \$[@] .PHONY: $ac_dir/install-lib $ac_dir/uninstall install install-lib:: $ac_dir/install-lib @@ -445,9 +444,9 @@ $ac_dir/uninstall:: wine_fn_append_rule \ "__builddeps__: $ac_file.$IMPLIBEXT $ac_file.$STATIC_IMPLIBEXT $ac_file.$IMPLIBEXT $ac_file.$STATIC_IMPLIBEXT $ac_file.cross.a: $ac_deps -$ac_file.def: $srcdir/$ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD) +$ac_file.def: $srcdir/$ac_dir/$ac_name.spec \$(WINEBUILD) \$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --def -o \$[@] --export $srcdir/$ac_dir/$ac_name.spec -$ac_file.$STATIC_IMPLIBEXT: $ac_dir/Makefile dummy +$ac_file.$STATIC_IMPLIBEXT: dummy @cd $ac_dir && \$(MAKE) lib$ac_implib.$STATIC_IMPLIBEXT .PHONY: $ac_dir/install-dev $ac_dir/uninstall $ac_dir/install-dev:: $ac_file.$IMPLIBEXT @@ -470,7 +469,7 @@ $ac_dir/uninstall:: then wine_fn_append_rule \ "__builddeps__: $ac_file.cross.a -$ac_file.cross.a: $ac_dir/Makefile dummy +$ac_file.cross.a: dummy @cd $ac_dir && \$(MAKE) lib$ac_implib.cross.a" fi @@ -478,9 +477,9 @@ $ac_file.cross.a: $ac_dir/Makefile dummy then wine_fn_append_rule \ "__builddeps__: $ac_file.$IMPLIBEXT -$ac_file.def: $srcdir/$ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD) +$ac_file.def: $srcdir/$ac_dir/$ac_name.spec \$(WINEBUILD) \$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --def -o \$[@] --export $srcdir/$ac_dir/$ac_name.spec -$ac_file.a: $srcdir/$ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD) +$ac_file.a: $srcdir/$ac_dir/$ac_name.spec \$(WINEBUILD) \$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --implib -o \$[@] --export $srcdir/$ac_dir/$ac_name.spec .PHONY: $ac_dir/install-dev $ac_dir/uninstall $ac_dir/install-dev:: $ac_file.$IMPLIBEXT @@ -493,7 +492,7 @@ __uninstall__: $ac_dir/uninstall" then wine_fn_append_rule \ "__builddeps__: $ac_file.cross.a -$ac_file.cross.a: $srcdir/$ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD) +$ac_file.cross.a: $srcdir/$ac_dir/$ac_name.spec \$(WINEBUILD) \$(WINEBUILD) \$(CROSSTARGET:%=-b %)$ac_implibflags -w --implib -o \$[@] --export $srcdir/$ac_dir/$ac_name.spec" fi @@ -604,7 +603,7 @@ wine_fn_config_test () wine_fn_clean_rules $ac_clean wine_fn_append_rule \ -"$ac_dir: programs/winetest/Makefile __builddeps__ +"$ac_dir: __builddeps__ programs/winetest: $ac_dir check test: $ac_dir/test .PHONY: $ac_dir/test @@ -618,7 +617,7 @@ testclean:: wine_fn_append_rule \ "crosstest: $ac_dir/crosstest .PHONY: $ac_dir/crosstest -$ac_dir/crosstest: $ac_dir/Makefile __builddeps__ dummy +$ac_dir/crosstest: __builddeps__ dummy @cd $ac_dir && \$(MAKE) crosstest" fi } @@ -656,7 +655,7 @@ distclean:: \$(RM) $ac_links" for f in $ac_links; do wine_fn_ignore_file $f; done test -n "$ac_linkdir" || return - wine_fn_append_rule "$ac_linkdir/Makefile $ac_linkdir/depend: $ac_links" + wine_fn_append_rule "$ac_linkdir/depend: $ac_links" }]) dnl **** Define helper function to append a file to a makefile file list **** diff --git a/configure b/configure index ed87ea5aa51..41000054cd1 100755 --- a/configure +++ b/configure @@ -714,6 +714,7 @@ SOCKET_LIBS DLLTOOL WINELOADER_PROGRAMS ALL_TEST_RESOURCES +SUBDIRS READELF OTOOL LDD @@ -7393,6 +7394,8 @@ wine_rules_file=conf$$rules.make rm -f $wine_rules_file ALL_POT_FILES="" GITIGNORE="# Automatically generated by configure; DO NOT EDIT!!" +SUBDIRS="" + ALL_TEST_RESOURCES="" @@ -7422,13 +7425,9 @@ wine_fn_has_flag () wine_fn_depend_rules () { + wine_fn_append_file SUBDIRS $ac_dir wine_fn_append_rule \ -"$ac_dir/Makefile: $srcdir/$ac_dir/Makefile.in Makefile \$(MAKEDEP) - \$(MAKEDEP) $ac_dir -depend: $ac_dir/depend -.PHONY: $ac_dir/depend -$ac_dir/depend: \$(MAKEDEP) dummy - \$(MAKEDEP) $ac_dir" +"Makefile: $srcdir/$ac_dir/Makefile.in" } wine_fn_pot_rules () @@ -7439,7 +7438,7 @@ wine_fn_pot_rules () then wine_fn_append_file ALL_POT_FILES $ac_dir/msg.pot wine_fn_append_rule \ -"$ac_dir/msg.pot: $ac_dir/Makefile dummy +"$ac_dir/msg.pot: dummy @cd $ac_dir && \$(MAKE) msg.pot $ac_dir/msg.pot: tools/wmc include" fi @@ -7447,7 +7446,7 @@ $ac_dir/msg.pot: tools/wmc include" then wine_fn_append_file ALL_POT_FILES $ac_dir/rsrc.pot wine_fn_append_rule \ -"$ac_dir/rsrc.pot: $ac_dir/Makefile dummy +"$ac_dir/rsrc.pot: dummy @cd $ac_dir && \$(MAKE) rsrc.pot $ac_dir/rsrc.pot: tools/wrc include" fi @@ -7459,7 +7458,7 @@ wine_fn_all_rules () wine_fn_append_rule \ "all: $ac_dir .PHONY: $ac_dir -$ac_dir: $ac_dir/Makefile dummy +$ac_dir: dummy @cd $ac_dir && \$(MAKE)" } @@ -7471,7 +7470,7 @@ wine_fn_install_rules () ".PHONY: $ac_dir/install $ac_dir/uninstall $ac_dir/install:: $ac_dir @cd $ac_dir && \$(MAKE) install -$ac_dir/uninstall:: $ac_dir/Makefile +$ac_dir/uninstall:: @cd $ac_dir && \$(MAKE) uninstall install:: $ac_dir/install __uninstall__: $ac_dir/uninstall" @@ -7507,18 +7506,18 @@ wine_fn_clean_rules () if wine_fn_has_flag clean then wine_fn_append_rule \ -"__clean__: $ac_dir/clean -.PHONY: $ac_dir/clean -$ac_dir/clean: $ac_dir/Makefile - @cd $ac_dir && \$(MAKE) clean - \$(RM) $ac_extraclean" +"$ac_dir/clean: dummy + @cd $ac_dir && \$(MAKE) clean" else wine_fn_append_rule \ +"$ac_dir/clean: dummy + \$(RM) \$(CLEAN_FILES:%=$ac_dir/%) $ac_clean" + fi + wine_fn_append_rule \ "__clean__: $ac_dir/clean .PHONY: $ac_dir/clean -$ac_dir/clean: dummy - \$(RM) \$(CLEAN_FILES:%=$ac_dir/%) $ac_clean $ac_extraclean" - fi +distclean:: + \$(RM) $ac_extraclean" } wine_fn_disabled_rules () @@ -7531,7 +7530,9 @@ wine_fn_disabled_rules () "__clean__: $ac_dir/clean .PHONY: $ac_dir/clean $ac_dir/clean: dummy - \$(RM) \$(CLEAN_FILES:%=$ac_dir/%) $ac_clean $ac_extraclean" + \$(RM) \$(CLEAN_FILES:%=$ac_dir/%) $ac_clean +distclean:: + \$(RM) $ac_extraclean" } wine_fn_config_makefile () @@ -7619,7 +7620,7 @@ else wine_fn_clean_rules $ac_clean wine_fn_append_rule \ "$ac_dir: __builddeps__ -manpages htmlpages sgmlpages xmlpages:: $ac_dir/Makefile +manpages htmlpages sgmlpages xmlpages:: @cd $ac_dir && \$(MAKE) \$@ .PHONY: $ac_dir/install-lib $ac_dir/uninstall install install-lib:: $ac_dir/install-lib @@ -7648,9 +7649,9 @@ fi wine_fn_append_rule \ "__builddeps__: $ac_file.$IMPLIBEXT $ac_file.$STATIC_IMPLIBEXT $ac_file.$IMPLIBEXT $ac_file.$STATIC_IMPLIBEXT $ac_file.cross.a: $ac_deps -$ac_file.def: $srcdir/$ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD) +$ac_file.def: $srcdir/$ac_dir/$ac_name.spec \$(WINEBUILD) \$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --def -o \$@ --export $srcdir/$ac_dir/$ac_name.spec -$ac_file.$STATIC_IMPLIBEXT: $ac_dir/Makefile dummy +$ac_file.$STATIC_IMPLIBEXT: dummy @cd $ac_dir && \$(MAKE) lib$ac_implib.$STATIC_IMPLIBEXT .PHONY: $ac_dir/install-dev $ac_dir/uninstall $ac_dir/install-dev:: $ac_file.$IMPLIBEXT @@ -7673,7 +7674,7 @@ $ac_dir/uninstall:: then wine_fn_append_rule \ "__builddeps__: $ac_file.cross.a -$ac_file.cross.a: $ac_dir/Makefile dummy +$ac_file.cross.a: dummy @cd $ac_dir && \$(MAKE) lib$ac_implib.cross.a" fi @@ -7681,9 +7682,9 @@ $ac_file.cross.a: $ac_dir/Makefile dummy then wine_fn_append_rule \ "__builddeps__: $ac_file.$IMPLIBEXT -$ac_file.def: $srcdir/$ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD) +$ac_file.def: $srcdir/$ac_dir/$ac_name.spec \$(WINEBUILD) \$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --def -o \$@ --export $srcdir/$ac_dir/$ac_name.spec -$ac_file.a: $srcdir/$ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD) +$ac_file.a: $srcdir/$ac_dir/$ac_name.spec \$(WINEBUILD) \$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --implib -o \$@ --export $srcdir/$ac_dir/$ac_name.spec .PHONY: $ac_dir/install-dev $ac_dir/uninstall $ac_dir/install-dev:: $ac_file.$IMPLIBEXT @@ -7696,7 +7697,7 @@ __uninstall__: $ac_dir/uninstall" then wine_fn_append_rule \ "__builddeps__: $ac_file.cross.a -$ac_file.cross.a: $srcdir/$ac_dir/$ac_name.spec $ac_dir/Makefile \$(WINEBUILD) +$ac_file.cross.a: $srcdir/$ac_dir/$ac_name.spec \$(WINEBUILD) \$(WINEBUILD) \$(CROSSTARGET:%=-b %)$ac_implibflags -w --implib -o \$@ --export $srcdir/$ac_dir/$ac_name.spec" fi @@ -7811,7 +7812,7 @@ fi wine_fn_clean_rules $ac_clean wine_fn_append_rule \ -"$ac_dir: programs/winetest/Makefile __builddeps__ +"$ac_dir: __builddeps__ programs/winetest: $ac_dir check test: $ac_dir/test .PHONY: $ac_dir/test @@ -7825,7 +7826,7 @@ testclean:: wine_fn_append_rule \ "crosstest: $ac_dir/crosstest .PHONY: $ac_dir/crosstest -$ac_dir/crosstest: $ac_dir/Makefile __builddeps__ dummy +$ac_dir/crosstest: __builddeps__ dummy @cd $ac_dir && \$(MAKE) crosstest" fi } @@ -7865,7 +7866,7 @@ distclean:: \$(RM) $ac_links" for f in $ac_links; do wine_fn_ignore_file $f; done test -n "$ac_linkdir" || return - wine_fn_append_rule "$ac_linkdir/Makefile $ac_linkdir/depend: $ac_links" + wine_fn_append_rule "$ac_linkdir/depend: $ac_links" } wine_binary="wine" @@ -17230,7 +17231,9 @@ CLEAN_FILES = *.o *.a *.so *.res *.fake *.ok *.tab.[ch] *.yy.c .MAKEFILEDEPS: all: Makefile Makefile: $srcdir/Makefile.in config.status \$(MAKEDEP) - @./config.status Make.tmp Makefile" + @./config.status Make.tmp Makefile +depend: \$(MAKEDEP) dummy + \$(MAKEDEP)" test "$srcdir" = . && wine_fn_append_rule "all: .gitignore .gitignore: config.status @@ -19026,7 +19029,7 @@ wine_fn_output_makedep () } wine_fn_output_makefile () { - cat Make.tmp - <<\_WINE_EOF >\$tmp/makefile && mv -f \$tmp/makefile \$1 && rm -f Make.tmp && "$wine_makedep" . && return + cat Make.tmp - <<\_WINE_EOF >\$tmp/makefile && mv -f \$tmp/makefile \$1 && rm -f Make.tmp && "$wine_makedep" && return `cat $wine_rules_file` _WINE_EOF as_fn_error $? "could not create Makefile" "$LINENO" 5 diff --git a/configure.ac b/configure.ac index 2b1dd8117ee..6f6423b9476 100644 --- a/configure.ac +++ b/configure.ac @@ -2573,7 +2573,9 @@ CLEAN_FILES = *.o *.a *.so *.res *.fake *.ok *.tab.[[ch]] *.yy.c .MAKEFILEDEPS: all: Makefile Makefile: $srcdir/Makefile.in config.status \$(MAKEDEP) - @./config.status Make.tmp Makefile]) + @./config.status Make.tmp Makefile +depend: \$(MAKEDEP) dummy + \$(MAKEDEP)]) test "$srcdir" = . && WINE_APPEND_RULE( [all: .gitignore @@ -3575,7 +3577,7 @@ fi AC_CONFIG_COMMANDS([Makefile], [wine_fn_output_makefile Makefile], [wine_fn_output_makefile () { - cat Make.tmp - <<\_WINE_EOF >\$tmp/makefile && mv -f \$tmp/makefile \$[]1 && rm -f Make.tmp && "$wine_makedep" . && return + cat Make.tmp - <<\_WINE_EOF >\$tmp/makefile && mv -f \$tmp/makefile \$[]1 && rm -f Make.tmp && "$wine_makedep" && return `cat $wine_rules_file` _WINE_EOF AS_ERROR([could not create Makefile]) diff --git a/tools/makedep.c b/tools/makedep.c index 14a26ef4f89..aa6e16101d1 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -156,6 +156,7 @@ struct makefile struct strarray scripts; struct strarray appmode; struct strarray imports; + struct strarray subdirs; struct strarray delayimports; struct strarray extradllflags; struct strarray install_lib; @@ -175,6 +176,7 @@ struct makefile const char *importlib; int use_msvcrt; int is_win16; + struct makefile **submakes; }; static struct makefile *top_makefile; @@ -189,7 +191,7 @@ static int output_column; static FILE *output_file; static const char Usage[] = - "Usage: makedep [options] directories\n" + "Usage: makedep [options] [directories]\n" "Options:\n" " -R from to Compute the relative path between two directories\n" " -fxxx Store output in file 'xxx' (default: Makefile)\n"; @@ -2842,13 +2844,6 @@ static struct strarray output_sources( const struct makefile *make, struct strar strarray_add( &phony_targets, obj_dir_path( make, "clean" )); } - if (make->top_obj_dir) - { - output( "depend:\n" ); - output( "\t@cd %s && $(MAKE) %s\n", make->top_obj_dir, base_dir_path( make, "depend" )); - strarray_add( &phony_targets, "depend" ); - } - if (phony_targets.count) { output( ".PHONY:" ); @@ -3013,7 +3008,10 @@ static void output_top_variables( const struct makefile *make ) output( "# Automatically generated by make depend; DO NOT EDIT!!\n\n" ); output( "all:\n\n" ); for (i = 0; i < vars->count; i += 2) + { + if (!strcmp( vars->str[i], "SUBDIRS" )) continue; /* not inherited */ output( "%s = %s\n", vars->str[i], get_make_variable( make, vars->str[i] )); + } output( "\n" ); } @@ -3023,9 +3021,11 @@ static void output_top_variables( const struct makefile *make ) */ static void output_dependencies( const struct makefile *make ) { + static const char separator[] = "### Dependencies"; struct strarray targets, testlist_files = empty_strarray, ignore_files = empty_strarray; char buffer[1024]; FILE *src_file; + int found = 0; output_file_name = base_dir_path( make, output_makefile_name ); output_file = create_temp_file( output_file_name ); @@ -3033,11 +3033,15 @@ static void output_dependencies( const struct makefile *make ) /* copy the contents of the source makefile */ src_file = open_input_makefile( make ); - while (fgets( buffer, sizeof(buffer), src_file )) + while (fgets( buffer, sizeof(buffer), src_file ) && !found) + { if (fwrite( buffer, 1, strlen(buffer), output_file ) != strlen(buffer)) fatal_perror( "write" ); + found = !strncmp( buffer, separator, strlen(separator) ); + } if (fclose( src_file )) fatal_perror( "close" ); input_file_name = NULL; + if (!found) output( "\n%s (everything below this line is auto-generated; DO NOT EDIT!!)\n", separator ); targets = output_sources( make, &testlist_files ); fclose( output_file ); @@ -3059,9 +3063,9 @@ static void output_dependencies( const struct makefile *make ) /******************************************************************* - * update_makefile + * load_sources */ -static void update_makefile( const char *path ) +static void load_sources( struct makefile *make ) { static const char *source_vars[] = { @@ -3084,9 +3088,6 @@ static void update_makefile( const char *path ) unsigned int i; struct strarray value; struct incl_file *file; - struct makefile *make; - - make = parse_makefile( path, NULL ); if (root_src_dir) { @@ -3161,8 +3162,6 @@ static void update_makefile( const char *path ) } LIST_FOR_EACH_ENTRY( file, &make->includes, struct incl_file, entry ) parse_file( make, file, 0 ); - - output_dependencies( make ); } @@ -3250,11 +3249,6 @@ int main( int argc, char *argv[] ) exit( 0 ); } - if (argc <= 1) - { - fprintf( stderr, "%s", Usage ); - exit( 1 ); - } atexit( cleanup_files ); signal( SIGTERM, exit_on_signal ); signal( SIGINT, exit_on_signal ); @@ -3294,6 +3288,30 @@ int main( int argc, char *argv[] ) if (!tools_ext) tools_ext = ""; if (!man_ext) man_ext = "3w"; - for (i = 1; i < argc; i++) update_makefile( argv[i] ); + if (argc == 1) + { + top_makefile->subdirs = get_expanded_make_var_array( top_makefile, "SUBDIRS" ); + top_makefile->submakes = xmalloc( top_makefile->subdirs.count * sizeof(*top_makefile->submakes) ); + + for (i = 0; i < top_makefile->subdirs.count; i++) + top_makefile->submakes[i] = parse_makefile( top_makefile->subdirs.str[i], NULL ); + + load_sources( top_makefile ); + for (i = 0; i < top_makefile->subdirs.count; i++) + load_sources( top_makefile->submakes[i] ); + + for (i = 0; i < top_makefile->subdirs.count; i++) + output_dependencies( top_makefile->submakes[i] ); + + output_dependencies( top_makefile ); + return 0; + } + + for (i = 1; i < argc; i++) + { + struct makefile *make = parse_makefile( argv[i], NULL ); + load_sources( make ); + output_dependencies( make ); + } return 0; } -- GitLab