Commit 11ecc76d authored by Alexandre Julliard's avatar Alexandre Julliard

makefiles: Generate the clean rule using the subdirs file lists.

parent 3e6c12e7
......@@ -116,9 +116,6 @@ include/stamp-h: $(srcdir)/include/config.h.in config.status
# Rules for cleaning
.PHONY: clean distclean __clean__
clean:: __clean__
distclean:: clean
$(RM) -r autom4te.cache documentation/html documentation/api-guide documentation/api-guide-xml documentation/man$(api_manext)
......
......@@ -277,36 +277,10 @@ install-dev:: $ac_dir/install-dev"
fi
}
wine_fn_clean_rules ()
{
ac_clean=$[@]
if wine_fn_has_flag clean
then
wine_fn_append_rule \
"$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"
}
wine_fn_disabled_rules ()
{
ac_clean=$[@]
wine_fn_append_file SUBDIRS $ac_dir
wine_fn_append_file DISABLED_SUBDIRS $ac_dir
wine_fn_append_rule \
"__clean__: $ac_dir/clean
.PHONY: $ac_dir/clean
$ac_dir/clean: dummy
\$(RM) \$(CLEAN_FILES:%=$ac_dir/%) $ac_clean"
}
wine_fn_config_makefile ()
......@@ -322,7 +296,6 @@ wine_fn_config_makefile ()
AS_VAR_IF([$ac_enable],[no],[wine_fn_disabled_rules; return])
wine_fn_all_rules
wine_fn_install_rules
wine_fn_clean_rules
}
wine_fn_config_lib ()
......@@ -334,7 +307,6 @@ wine_fn_config_lib ()
AS_VAR_IF([enable_tools],[no],,[ac_deps="tools/widl tools/winebuild tools/winegcc $ac_deps"])
wine_fn_all_rules
wine_fn_clean_rules
wine_fn_append_rule \
".PHONY: $ac_dir/install $ac_dir/uninstall
......@@ -367,24 +339,18 @@ wine_fn_config_dll ()
*) ac_dll=$ac_dll.dll ;;
esac
ac_clean=
wine_fn_has_flag implib && ac_clean="$ac_clean $ac_file.$IMPLIBEXT"
test -n "$DLLEXT" || ac_clean="$ac_clean $ac_dir/$ac_dll"
AS_VAR_IF([$ac_enable],[no],
dnl enable_win16 is special in that it disables import libs too
[if test "$ac_enable" != enable_win16
then
wine_fn_clean_rules $ac_clean
wine_fn_append_file SUBDIRS $ac_dir
wine_fn_append_file DISABLED_SUBDIRS $ac_dir
else
wine_fn_disabled_rules $ac_clean
wine_fn_disabled_rules
return
fi],
[wine_fn_all_rules
wine_fn_clean_rules $ac_clean
wine_fn_append_rule \
"$ac_dir: __builddeps__
manpages htmlpages sgmlpages xmlpages::
......@@ -469,14 +435,9 @@ wine_fn_config_program ()
*) ac_program=$ac_program.exe ;;
esac
ac_clean=
wine_fn_has_flag manpage && ac_clean="$ac_clean $ac_dir/$ac_name.man"
test -n "$DLLEXT" || ac_clean="$ac_clean $ac_dir/$ac_program"
AS_VAR_IF([$ac_enable],[no],[wine_fn_disabled_rules $ac_clean; return])
AS_VAR_IF([$ac_enable],[no],[wine_fn_disabled_rules; return])
wine_fn_all_rules
wine_fn_clean_rules $ac_clean
wine_fn_append_rule "$ac_dir: __builddeps__"
wine_fn_has_flag install || return
......@@ -526,15 +487,10 @@ wine_fn_config_test ()
ac_name=$[2]
ac_flags=$[3]
ac_clean=
test -n "$CROSSTARGET" && ac_clean=`expr $ac_dir/${ac_name} : "\\(.*\\)_test"`_crosstest.exe
test -n "$DLLEXT" || ac_clean="$ac_dir/${ac_name}.exe $ac_dir/${ac_name}-stripped.exe"
AS_VAR_IF([enable_tests],[no],[wine_fn_disabled_rules $ac_clean; return])
AS_VAR_IF([enable_tests],[no],[wine_fn_disabled_rules; return])
wine_fn_append_file ALL_TEST_RESOURCES $ac_name.res
wine_fn_all_rules
wine_fn_clean_rules $ac_clean
wine_fn_append_rule \
"$ac_dir: __builddeps__
......@@ -562,7 +518,6 @@ wine_fn_config_tool ()
wine_fn_all_rules
wine_fn_install_rules
wine_fn_clean_rules
wine_fn_append_rule "__tooldeps__: $ac_dir"
wine_fn_append_rule "$ac_dir: libs/port"
......
......@@ -245,11 +245,6 @@ sub parse_makefile($)
$make{$var} = \@list;
next;
}
if (/(install-lib|install-dev|clean)\s*:/)
{
${$make{"=flags"}}{$1} = 1;
next;
}
if (/^\s*(TOPSRCDIR|TOPOBJDIR|SRCDIR|VPATH)\s*=\s*(.*)/)
{
die "Variable $1 in $file.in is obsolete";
......@@ -275,7 +270,6 @@ sub parse_makefile($)
${$make{"=flags"}}{"install-lib"} = 1 if defined $make{"INSTALL_LIB"};
${$make{"=flags"}}{"install-dev"} = 1 if defined $make{"INSTALL_DEV"};
}
${$make{"=flags"}}{"clean"} = 1 if defined $make{"PROGRAMS"} || defined $make{"EXTRA_TARGETS"} || defined $make{"EXTRA_OBJS"};
if (defined $make{"=flags"} && defined $make{"MODULE"})
{
......@@ -379,15 +373,12 @@ sub assign_sources_to_makefiles(@)
next if $file =~ /^include\/wine\// && !%flags && !$exported_wine_headers{$name};
${$make}{"=flags"}{"clean"} = 1 if $subdir;
if ($name =~ /\.m$/) { push @{${$make}{"=OBJC_SRCS"}}, $name; }
elsif ($name =~ /\.l$/) { push @{${$make}{"=LEX_SRCS"}}, $name; }
elsif ($name =~ /\.y$/) { push @{${$make}{"=BISON_SRCS"}}, $name; }
elsif ($name =~ /\.svg$/) { push @{${$make}{"=SVG_SRCS"}}, $name; }
elsif ($name =~ /\.sfd$/)
{
${${$make}{"=flags"}}{"clean"} = 1 if defined $flags{"font"};
${${$make}{"=flags"}}{"install-lib"} = 1 if defined $flags{"install"};
push @{${$make}{"=FONT_SRCS"}}, $name;
}
......@@ -403,29 +394,25 @@ sub assign_sources_to_makefiles(@)
}
elsif ($name =~ /\.rc$/)
{
${${$make}{"=flags"}}{"clean"} = 1 if defined $flags{"po"};
push @{${$make}{"=RC_SRCS"}}, $name;
}
elsif ($name =~ /\.mc$/)
{
push @{${$make}{"=MC_SRCS"}}, $name;
${${$make}{"=flags"}}{"clean"} = 1;
}
elsif ($name =~ /\.po$/)
{
push @{${$make}{"=PO_SRCS"}}, $name;
${${$make}{"=flags"}}{"clean"} = 1;
}
elsif ($name =~ /\.idl$/)
{
die "no makedep flags specified in $file" unless %flags || $dir eq "include";
push @{${$make}{"=IDL_SRCS"}}, $name;
${${$make}{"=flags"}}{"clean"} = 1;
}
elsif ($name =~ /\.man\.in$/)
{
push @{${$make}{"=MANPAGES"}}, $name;
${${$make}{"=flags"}}{($file =~ /^programs\//) ? "manpage" : "clean"} = 1;
${${$make}{"=flags"}}{"manpage"} = 1 if ($file =~ /^programs\//);
}
elsif ($name =~ /\.in$/)
{
......@@ -452,7 +439,6 @@ sub assign_sources_to_makefiles(@)
preserve_shared_source_files( $makefiles{$file}, $makefiles{$parent}, "IDL_SRCS" );
preserve_shared_source_files( $makefiles{$file}, $makefiles{$parent}, "LEX_SRCS" );
preserve_shared_source_files( $makefiles{$file}, $makefiles{$parent}, "BISON_SRCS" );
${${$make}{"=flags"}}{"clean"} = 1 if defined ${$make}{"=IDL_SRCS"} && @{${$make}{"=IDL_SRCS"}};
}
}
......
......@@ -3326,6 +3326,7 @@ static void output_subdirs( struct makefile *make )
{
struct strarray build_deps = empty_strarray;
struct strarray makefile_deps = empty_strarray;
struct strarray clean_files = empty_strarray;
struct strarray testclean_files = empty_strarray;
struct strarray distclean_files = get_expanded_make_var_array( make, "CONFIGURE_TARGETS" );
unsigned int i, j;
......@@ -3340,6 +3341,8 @@ static void output_subdirs( struct makefile *make )
strmake ( "%s.in", output_makefile_name ))));
strarray_add( &distclean_files, base_dir_path( submake, output_makefile_name ));
if (!make->src_dir) strarray_add( &distclean_files, base_dir_path( submake, ".gitignore" ));
for (j = 0; j < submake->clean_files.count; j++)
strarray_add( &clean_files, base_dir_path( submake, submake->clean_files.str[j] ));
if (submake->testdll)
{
for (j = 0; j < submake->ok_files.count; j++)
......@@ -3353,6 +3356,8 @@ static void output_subdirs( struct makefile *make )
output( "\n" );
output_filenames( makefile_deps );
output( ":\n" );
output( "clean::\n");
output_rm_filenames( clean_files );
output( "testclean::\n");
output_rm_filenames( testclean_files );
output( "distclean::\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment