Commit 1c31b75e authored by Alexandre Julliard's avatar Alexandre Julliard

makefiles: Generate the top-level import library rules from makedep.

parent 733ed056
......@@ -230,11 +230,6 @@ wine_fn_append_rule ()
AS_ECHO("$[1]") >>$wine_rules_file
}
wine_fn_has_flag ()
{
expr ",$ac_flags," : ".*,$[1],.*" >/dev/null
}
wine_fn_all_rules ()
{
wine_fn_append_file SUBDIRS $ac_dir
......@@ -283,69 +278,14 @@ wine_fn_config_dll ()
ac_name=$[1]
ac_dir=dlls/$ac_name
ac_enable=$[2]
ac_flags=$[3]
ac_implib=${4:-$ac_name}
ac_file=$ac_dir/lib$ac_implib
ac_dll=$ac_name
ac_deps="include"
ac_implibflags=""
AS_VAR_IF([enable_tools],[no],,[ac_deps="tools/widl tools/winebuild tools/winegcc $ac_deps"])
case $ac_name in
*.*16) ac_implibflags=" -m16" ;;
*.*) ;;
*) ac_dll=$ac_dll.dll ;;
esac
AS_VAR_IF([$ac_enable],[no],[wine_fn_disabled_rules; return])
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_append_file SUBDIRS $ac_dir
wine_fn_append_file DISABLED_SUBDIRS $ac_dir
else
wine_fn_disabled_rules
return
fi],
[wine_fn_all_rules
wine_fn_append_rule \
wine_fn_all_rules
wine_fn_append_rule \
"$ac_dir: __builddeps__
manpages htmlpages sgmlpages xmlpages::
@cd $ac_dir && \$(MAKE) \$[@]"])
if wine_fn_has_flag staticimplib
then
wine_fn_append_rule \
"__builddeps__: $ac_file.a
$ac_file.a $ac_file.cross.a: $ac_deps
$ac_file.a: dummy
@cd $ac_dir && \$(MAKE) lib$ac_implib.a"
if test -n "$CROSSTARGET" -a -z "$ac_implibflags"
then
wine_fn_append_rule \
"__builddeps__: $ac_file.cross.a
$ac_file.cross.a: dummy
@cd $ac_dir && \$(MAKE) lib$ac_implib.cross.a"
fi
elif wine_fn_has_flag implib
then
wine_fn_append_rule \
"__builddeps__: $ac_file.$IMPLIBEXT
$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 \$(WINEBUILD)
\$(WINEBUILD) \$(TARGETFLAGS)$ac_implibflags -w --implib -o \$[@] --export $srcdir/$ac_dir/$ac_name.spec"
if test -n "$CROSSTARGET" -a -z "$ac_implibflags"
then
wine_fn_append_rule \
"__builddeps__: $ac_file.cross.a
$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
fi
@cd $ac_dir && \$(MAKE) \$[@]"
}
wine_fn_config_program ()
......@@ -457,13 +397,13 @@ AS_VAR_POPDEF([ac_enable])])
dnl **** Create a dll makefile from config.status ****
dnl
dnl Usage: WINE_CONFIG_DLL(name,enable,flags,implib)
dnl Usage: WINE_CONFIG_DLL(name,enable)
dnl
AC_DEFUN([WINE_CONFIG_DLL],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
AS_VAR_PUSHDEF([ac_enable],m4_default([$2],[enable_]$1))dnl
m4_append_uniq([_AC_USER_OPTS],ac_enable,[
])dnl
wine_fn_config_dll [$1] ac_enable [$3] [$4]dnl
wine_fn_config_dll [$1] ac_enable[]dnl
AS_VAR_POPDEF([ac_enable])])
dnl **** Create a program makefile from config.status ****
......
......@@ -234,7 +234,6 @@ sub parse_makefile($)
{
my $var = $1;
$make{$var} = $2;
${$make{"=flags"}}{"implib"} = 1 if $var eq "IMPORTLIB";
next;
}
my $source_vars_regexp = join "|", @source_vars;
......@@ -357,7 +356,6 @@ sub assign_sources_to_makefiles(@)
}
elsif ($name =~ /\.c$/)
{
${${$make}{"=flags"}}{"staticimplib"} = 1 if defined $flags{"implib"};
push @{${$make}{"=C_SRCS"}}, $name;
}
elsif ($name =~ /\.h$/ || $name =~ /\.rh$/ || $name =~ /\.inl$/ || $name =~ /\.x$/)
......@@ -425,14 +423,13 @@ sub update_makefiles(@)
my %make = %{$makefiles{$file}};
my $args = "";
my $is_win16 = $make{"MODULE"} && ($make{"MODULE"} =~ /16$/ || $modules16{$make{"MODULE"}});
my $flag_args = defined $make{"=flags"} ? ",[" . join(",",sort keys %{$make{"=flags"}}) ."]" : "";
if (defined($make{"TESTDLL"})) # test
{
die "TESTDLL should not be defined in $file" unless $file =~ /\/tests\/Makefile$/;
die "MODULE should not be defined in $file" if defined $make{"MODULE"};
die "STATICLIB should not be defined in $file" if defined $make{"STATICLIB"};
(my $dir = $file) =~ s/^(.*)\/Makefile/$1/;
push @lines, "WINE_CONFIG_TEST($dir$flag_args)\n";
push @lines, "WINE_CONFIG_TEST($dir)\n";
}
elsif (defined($make{"MODULE"}) && $make{"MODULE"} =~ /\.a$/) # import lib
{
......@@ -440,7 +437,7 @@ sub update_makefiles(@)
die "APPMODE should not be defined in $file" if defined $make{"APPMODE"};
die "STATICLIB should not be defined in $file" if defined $make{"STATICLIB"};
(my $name = $file) =~ s/^dlls\/(.*)\/Makefile/$1/;
push @lines, "WINE_CONFIG_LIB($name$flag_args)\n";
push @lines, "WINE_CONFIG_LIB($name)\n";
}
elsif (defined($make{"MODULE"}) && defined($make{"APPMODE"})) # program
{
......@@ -455,9 +452,8 @@ sub update_makefiles(@)
{
die "Invalid MODULE in $file" unless $make{"MODULE"} eq "$name.exe";
}
$args .= "," if $is_win16 || defined $make{"=flags"};
$args .= "enable_win16" if $is_win16;
push @lines, "WINE_CONFIG_PROGRAM($name$args$flag_args)\n";
$args .= ",enable_win16" if $is_win16;
push @lines, "WINE_CONFIG_PROGRAM($name$args)\n";
}
elsif (defined($make{"MODULE"})) # dll
{
......@@ -475,10 +471,7 @@ sub update_makefiles(@)
}
my $implib = $make{"IMPORTLIB"} || "";
die "Invalid IMPORTLIB name in $file" if $implib =~ /\./;
$args .= "," if $is_win16 || defined $make{"=flags"};
$args .= "enable_win16" if $is_win16;
$args .= $flag_args;
$args .= ",[$implib]" if $implib && $implib ne $name;
$args .= ",enable_win16" if $is_win16;
push @lines, "WINE_CONFIG_DLL($name$args)\n";
}
elsif ($file =~ /^tools.*\/Makefile$/)
......@@ -486,14 +479,12 @@ sub update_makefiles(@)
die "APPMODE should not be defined in $file" if defined $make{"APPMODE"};
die "STATICLIB should not be defined in $file" if defined $make{"STATICLIB"};
(my $name = $file) =~ s/^(.*)\/Makefile/$1/;
push @lines, "WINE_CONFIG_TOOL($name$flag_args)\n";
push @lines, "WINE_CONFIG_TOOL($name)\n";
}
elsif ($file =~ /\/Makefile$/)
{
(my $name = $file) =~ s/^(.*)\/Makefile/$1/;
$args = "[$name]";
$args .= "," if defined $make{"=flags"};
push @lines, "WINE_CONFIG_MAKEFILE($args$flag_args)\n";
push @lines, "WINE_CONFIG_MAKEFILE($name)\n";
}
}
......
......@@ -3399,17 +3399,26 @@ static void output_programs( struct makefile *make )
*/
static void output_subdirs( struct makefile *make )
{
struct strarray symlinks = empty_strarray;
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 = empty_strarray;
struct strarray tools_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++)
{
const struct makefile *submake = make->submakes[i];
char *subdir = base_dir_path( submake, "" );
strarray_add( &makefile_deps, top_src_dir_path( make, base_dir_path( submake,
strmake ( "%s.in", output_makefile_name ))));
......@@ -3419,7 +3428,60 @@ static void output_subdirs( struct makefile *make )
strarray_add( &distclean_files, base_dir_path( submake, submake->distclean_files.str[j] ));
for (j = 0; j < submake->ok_files.count; j++)
strarray_add( &testclean_files, base_dir_path( submake, submake->ok_files.str[j] ));
strarray_addall( &build_deps, output_importlib_symlinks( make, submake ));
/* import libs are still created for disabled dirs, except for win16 ones */
if (submake->module && submake->importlib && !(submake->disabled && submake->is_win16))
{
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( "\t@cd %s && $(MAKE) lib%s.a\n", subdir, submake->importlib );
strarray_add( &build_deps, strmake( "%s.a", importlib_path ));
if (crosstarget)
{
output( "%s.cross.a:", importlib_path );
output_filenames( tools_deps );
output( "\n" );
output( "\t@cd %s && $(MAKE) lib%s.cross.a\n", subdir, submake->importlib );
strarray_add( &build_deps, strmake( "%s.cross.a", importlib_path ));
}
}
else
{
const char *libext = *dll_ext ? ".def" : ".a";
char *spec_file = top_src_dir_path( make, base_dir_path( submake,
replace_extension( submake->module, ".dll", ".spec" )));
output( "%s%s: %s", importlib_path, libext, spec_file );
output_filename( tools_path( make, "winebuild" ));
output( "\n" );
output( "\t%s -w -o $@", tools_path( make, "winebuild" ));
output_filename( *dll_ext ? "--def" : "--implib" );
output_filenames( target_flags );
if (submake->is_win16) output_filename( "-m16" );
output_filename( "--export" );
output_filename( spec_file );
output( "\n" );
strarray_add( &build_deps, strmake( "%s%s", importlib_path, libext ));
if (crosstarget && !submake->is_win16)
{
output( "%s.cross.a: %s", importlib_path, spec_file );
output_filename( tools_path( make, "winebuild" ));
output( "\n" );
output( "\t%s -b %s -w -o $@", tools_path( make, "winebuild" ), crosstarget );
output_filename( "--implib" );
output_filenames( target_flags );
output_filename( "--export" );
output_filename( spec_file );
output( "\n" );
strarray_add( &build_deps, strmake( "%s.cross.a", importlib_path ));
}
}
strarray_addall( &symlinks, output_importlib_symlinks( make, submake ));
}
if (submake->disabled) continue;
if (submake->install_rules[INSTALL_LIB].count)
{
......@@ -3446,12 +3508,13 @@ static void output_subdirs( struct makefile *make )
strarray_add( &make->phony_targets, "distclean" );
strarray_add( &make->phony_targets, "testclean" );
strarray_addall( &make->clean_files, symlinks );
strarray_addall( &build_deps, symlinks );
if (build_deps.count)
{
output( "__builddeps__:" );
output_filenames( build_deps );
output( "\n" );
strarray_addall( &make->clean_files, build_deps );
}
if (get_expanded_make_variable( make, "GETTEXTPO_LIBS" )) output_po_files( make );
}
......
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