makefiles: Don't generate global rules in disabled directories.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2016-02-29 15:06:42 +09:00
parent 1510b8b92a
commit dcc16c7cac
4 changed files with 57 additions and 42 deletions

View File

@ -96,6 +96,7 @@ LIBWINE_INSTALL_DEV = @LIBWINE_INSTALL_DEV@
LIBWINE_LDFLAGS = @LIBWINE_LDFLAGS@
LIBWINE_DEPENDS = @LIBWINE_DEPENDS@
ALL_TEST_RESOURCES = @ALL_TEST_RESOURCES@
DISABLED_SUBDIRS = @DISABLED_SUBDIRS@
CONFIGURE_TARGETS = @CONFIGURE_TARGETS@
@ALL_VARS_RULES@
@SET_MAKE@

15
aclocal.m4 vendored
View File

@ -200,6 +200,7 @@ AC_DEFUN([WINE_CONFIG_HELPERS],
[wine_rules_file=conf$$rules.make
rm -f $wine_rules_file
AC_SUBST(SUBDIRS,"")
AC_SUBST(DISABLED_SUBDIRS,"")
AC_SUBST(CONFIGURE_TARGETS,"")
AC_SUBST(ALL_TEST_RESOURCES,"")
@ -218,14 +219,9 @@ wine_fn_has_flag ()
expr ",$ac_flags," : ".*,$[1],.*" >/dev/null
}
wine_fn_depend_rules ()
{
wine_fn_append_file SUBDIRS $ac_dir
}
wine_fn_all_rules ()
{
wine_fn_depend_rules
wine_fn_append_file SUBDIRS $ac_dir
wine_fn_append_rule \
"all: $ac_dir
.PHONY: $ac_dir
@ -288,6 +284,8 @@ 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
@ -357,8 +355,9 @@ wine_fn_config_dll ()
dnl enable_win16 is special in that it disables import libs too
[if test "$ac_enable" != enable_win16
then
wine_fn_depend_rules
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
return
@ -552,7 +551,7 @@ wine_fn_config_tool ()
{
ac_dir=$[1]
ac_flags=$[2]
AS_VAR_IF([enable_tools],[no],[return])
AS_VAR_IF([enable_tools],[no],[wine_fn_append_file DISABLED_SUBDIRS $ac_dir; return])
wine_fn_all_rules
wine_fn_install_rules

17
configure vendored
View File

@ -717,6 +717,7 @@ DLLTOOL
WINELOADER_PROGRAMS
ALL_TEST_RESOURCES
CONFIGURE_TARGETS
DISABLED_SUBDIRS
SUBDIRS
READELF
OTOOL
@ -7417,6 +7418,8 @@ wine_rules_file=conf$$rules.make
rm -f $wine_rules_file
SUBDIRS=""
DISABLED_SUBDIRS=""
CONFIGURE_TARGETS=""
ALL_TEST_RESOURCES=""
@ -7437,14 +7440,9 @@ wine_fn_has_flag ()
expr ",$ac_flags," : ".*,$1,.*" >/dev/null
}
wine_fn_depend_rules ()
{
wine_fn_append_file SUBDIRS $ac_dir
}
wine_fn_all_rules ()
{
wine_fn_depend_rules
wine_fn_append_file SUBDIRS $ac_dir
wine_fn_append_rule \
"all: $ac_dir
.PHONY: $ac_dir
@ -7507,6 +7505,8 @@ 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
@ -7585,8 +7585,9 @@ fi
if eval test \"x\$"$ac_enable"\" = x"no"; then :
if test "$ac_enable" != enable_win16
then
wine_fn_depend_rules
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
return
@ -7786,7 +7787,7 @@ wine_fn_config_tool ()
ac_dir=$1
ac_flags=$2
if test "x$enable_tools" = xno; then :
return
wine_fn_append_file DISABLED_SUBDIRS $ac_dir; return
fi
wine_fn_all_rules

View File

@ -134,6 +134,7 @@ static struct strarray cpp_flags;
static struct strarray unwind_flags;
static struct strarray libs;
static struct strarray cmdline_vars;
static struct strarray disabled_dirs;
static const char *root_src_dir;
static const char *tools_dir;
static const char *tools_ext;
@ -177,6 +178,7 @@ struct makefile
const char *staticlib;
const char *staticimplib;
const char *importlib;
int disabled;
int use_msvcrt;
int is_win16;
struct makefile **submakes;
@ -2178,6 +2180,7 @@ static struct strarray output_importlib_symlinks( const struct makefile *parent,
if (!make->module) return ret;
if (!make->importlib) return ret;
if (make->is_win16 && make->disabled) return ret;
if (strncmp( make->base_dir, "dlls/", 5 )) return ret;
if (!strcmp( make->module, make->importlib )) return ret;
if (!strchr( make->importlib, '.' ) &&
@ -2901,6 +2904,7 @@ static struct strarray output_sources( const struct makefile *make )
output_filenames( dep_libs );
output( "\n" );
if (!make->disabled)
output( "all: %s/%s\n", top_obj_dir_path( make, "programs/winetest" ), testres );
output( "%s/%s: %s%s\n", top_obj_dir_path( make, "programs/winetest" ), testres,
obj_dir_path( make, stripped ), dll_ext );
@ -2916,7 +2920,6 @@ static struct strarray output_sources( const struct makefile *make )
add_import_libs( make, &dep_libs, get_default_imports( make ), 1 ); /* dependencies only */
strarray_addall( &all_libs, libs );
strarray_add( &clean_files, crosstest );
output( "%s: %s\n", obj_dir_path( make, "crosstest" ), obj_dir_path( make, crosstest ));
output( "%s:", obj_dir_path( make, crosstest ));
output_filenames_obj_dir( make, crossobj_files );
output_filenames_obj_dir( make, res_files );
@ -2931,22 +2934,29 @@ static struct strarray output_sources( const struct makefile *make )
output_filenames( all_libs );
output_filename( "$(LDFLAGS)" );
output( "\n" );
if (!make->disabled)
{
output( "%s: %s\n", obj_dir_path( make, "crosstest" ), obj_dir_path( make, crosstest ));
strarray_add( &phony_targets, obj_dir_path( make, "crosstest" ));
if (make->obj_dir) output( "crosstest: %s\n", obj_dir_path( make, "crosstest" ));
}
}
output_filenames_obj_dir( make, ok_files );
output( ": %s%s ../%s%s\n", testmodule, dll_ext, make->testdll, dll_ext );
if (!make->disabled)
{
output( "check test:" );
output_filenames_obj_dir( make, ok_files );
output( "\n" );
strarray_add( &phony_targets, "check" );
strarray_add( &phony_targets, "test" );
}
output( "testclean::\n" );
output( "\trm -f" );
output_filenames_obj_dir( make, ok_files );
output( "\n" );
strarray_addall( &clean_files, ok_files );
strarray_add( &phony_targets, "check" );
strarray_add( &phony_targets, "test" );
strarray_add( &phony_targets, "testclean" );
}
@ -3014,13 +3024,14 @@ static struct strarray output_sources( const struct makefile *make )
add_install_rule( make, install_rules, make->scripts.str[i], make->scripts.str[i],
strmake( "S$(bindir)/%s", make->scripts.str[i] ));
if (!make->disabled)
{
if (all_targets.count)
{
output( "all:" );
output_filenames_obj_dir( make, all_targets );
output( "\n" );
}
strarray_addall( &uninstall_files, output_install_rules( make, install_rules[INSTALL_LIB],
"install-lib", &phony_targets ));
strarray_addall( &uninstall_files, output_install_rules( make, install_rules[INSTALL_DEV],
@ -3033,6 +3044,7 @@ static struct strarray output_sources( const struct makefile *make )
output( "\n" );
strarray_add_uniq( &phony_targets, "uninstall" );
}
}
strarray_addall( &clean_files, object_files );
strarray_addall( &clean_files, crossobj_files );
@ -3383,6 +3395,7 @@ static void load_sources( struct makefile *make )
if (make->module && strendswith( make->module, ".a" )) make->staticlib = make->module;
make->disabled = make->base_dir && strarray_exists( &disabled_dirs, make->base_dir );
make->is_win16 = strarray_exists( &make->extradllflags, "-m16" );
make->use_msvcrt = strarray_exists( &make->appmode, "-mno-cygwin" );
@ -3556,6 +3569,7 @@ int main( int argc, char *argv[] )
if (argc == 1)
{
disabled_dirs = get_expanded_make_var_array( top_makefile, "DISABLED_SUBDIRS" );
top_makefile->subdirs = get_expanded_make_var_array( top_makefile, "SUBDIRS" );
top_makefile->submakes = xmalloc( top_makefile->subdirs.count * sizeof(*top_makefile->submakes) );