Commit e2db7946 authored by Alexandre Julliard's avatar Alexandre Julliard

makefiles: Add a more generic handling of makefile generation flags.

parent 59d76dd3
......@@ -203,6 +203,7 @@ wine_fn_config_makefile ()
{
ac_dir=$[1]
ac_enable=$[2]
ac_flags=$[3]
AS_VAR_IF([$ac_enable],[no],[return 0])
wine_fn_all_dir_rules $ac_dir Make.rules
......@@ -224,6 +225,7 @@ uninstall:: $ac_dir/Makefile
wine_fn_config_lib ()
{
ac_name=$[1]
ac_flags=$[2]
ac_dir=dlls/$ac_name
wine_fn_all_dir_rules $ac_dir dlls/Makeimplib.rules
wine_fn_append_rule ALL_MAKEFILE_DEPENDS \
......@@ -390,6 +392,7 @@ wine_fn_config_test ()
{
ac_dir=$[1]
ac_name=$[2]
ac_flags=$[3]
wine_fn_append_file ALL_TEST_RESOURCES $ac_name.res
wine_fn_all_dir_rules $ac_dir Maketest.rules
......@@ -419,6 +422,7 @@ $ac_dir/__crosstest__: $ac_dir/Makefile __builddeps__ dummy
wine_fn_config_tool ()
{
ac_dir=$[1]
ac_flags=$[2]
AS_VAR_IF([enable_tools],[no],[return 0])
wine_fn_all_dir_rules $ac_dir Make.rules
......@@ -517,11 +521,11 @@ AC_CONFIG_FILES([$1])])
dnl **** Create a makefile from config.status ****
dnl
dnl Usage: WINE_CONFIG_MAKEFILE(file,enable)
dnl Usage: WINE_CONFIG_MAKEFILE(file,enable,flags)
dnl
AC_DEFUN([WINE_CONFIG_MAKEFILE],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
AS_VAR_PUSHDEF([ac_enable],m4_default([$2],[enable_]$1))dnl
wine_fn_config_makefile [$1] ac_enable[]dnl
wine_fn_config_makefile [$1] ac_enable [$3]dnl
AS_VAR_POPDEF([ac_enable])])
dnl **** Create a dll makefile from config.status ****
......@@ -544,28 +548,28 @@ AS_VAR_POPDEF([ac_enable])])
dnl **** Create a test makefile from config.status ****
dnl
dnl Usage: WINE_CONFIG_TEST(dir)
dnl Usage: WINE_CONFIG_TEST(dir,flags)
dnl
AC_DEFUN([WINE_CONFIG_TEST],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
m4_pushdef([ac_suffix],m4_if(m4_substr([$1],0,9),[programs/],[.exe_test],[_test]))dnl
m4_pushdef([ac_name],[m4_bpatsubst([$1],[.*/\(.*\)/tests$],[\1])])dnl
wine_fn_config_test $1 ac_name[]ac_suffix[]dnl
wine_fn_config_test $1 ac_name[]ac_suffix [$2]dnl
m4_popdef([ac_suffix])dnl
m4_popdef([ac_name])])
dnl **** Create a static lib makefile from config.status ****
dnl
dnl Usage: WINE_CONFIG_LIB(name)
dnl Usage: WINE_CONFIG_LIB(name,flags)
dnl
AC_DEFUN([WINE_CONFIG_LIB],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
wine_fn_config_lib $1])
wine_fn_config_lib [$1] [$2]])
dnl **** Create a tool makefile from config.status ****
dnl
dnl Usage: WINE_CONFIG_TOOL(name)
dnl Usage: WINE_CONFIG_TOOL(name,flags)
dnl
AC_DEFUN([WINE_CONFIG_TOOL],[AC_REQUIRE([WINE_CONFIG_HELPERS])dnl
wine_fn_config_tool $1])
wine_fn_config_tool [$1] [$2]])
dnl **** Add a message to the list displayed at the end ****
dnl
......
......@@ -312,13 +312,19 @@ sub parse_makefile($)
}
if (/^\s*(MODULE|IMPORTLIB|TESTDLL)\s*=\s*(.*)/)
{
$make{$1} = $2;
my $var = $1;
$make{$var} = $2;
push @{$make{"=flags"}}, "implib" if $var eq "IMPORTLIB";
next;
}
if (/^\s*(BISON_SRCS|LEX_SRCS|IDL_[CHIPRS]_SRCS|IDL_TLB_SRCS|IMPLIB_SRCS|C_SRCS|MC_SRCS|RC_SRCS|PO_SRCS|SVG_SRCS|PROGRAMS)\s*=\s*(.*)/)
{
my $var = $1;
my @list = split(/\s+/, $2);
$make{$1} = \@list;
$make{$var} = \@list;
push @{$make{"=flags"}}, "mc" if $var eq "MC_SRCS";
push @{$make{"=flags"}}, "po" if $var eq "PO_SRCS";
push @{$make{"=flags"}}, "staticimplib" if $var eq "IMPLIB_SRCS";
next;
}
if (/^\s*(TOPSRCDIR|TOPOBJDIR|SRCDIR|VPATH)\s*=\s*(.*)/)
......@@ -326,6 +332,13 @@ sub parse_makefile($)
die "Variable $1 in $file.in is obsolete";
}
}
if ($file =~ /^programs\/([^\/]+)\/Makefile/)
{
push @{$make{"=flags"}}, "install" unless $dont_install{$1};
push @{$make{"=flags"}}, "installbin" if $bin_install{$1};
}
return %make;
}
......@@ -412,8 +425,8 @@ sub update_makefiles(@)
my %make = %{$makefiles{$file}};
my $rules = $make{"=rules"};
my $args = "";
my @flags;
my $is_win16 = $make{"MODULE"} && ($make{"MODULE"} =~ /16$/ || $modules16{$make{"MODULE"}});
my $flag_args = defined $make{"=flags"} ? ",[" . join(",",sort @{$make{"=flags"}}) ."]" : "";
if ($rules eq $makerules{"MAKE_DLL_RULES"})
{
(my $name = $file) =~ s/^dlls\/(.*)\/Makefile/$1/;
......@@ -426,13 +439,9 @@ sub update_makefiles(@)
die "Invalid MODULE in $file" unless $make{"MODULE"} eq "$name.dll";
}
my $implib = $make{"IMPORTLIB"} || "";
push @flags, "mc" if defined $make{"MC_SRCS"};
push @flags, "po" if defined $make{"PO_SRCS"};
push @flags, "implib" if $implib;
push @flags, "staticimplib" if defined($make{"IMPLIB_SRCS"});
$args .= "," if $is_win16 || @flags;
$args .= "," if $is_win16 || defined $make{"=flags"};
$args .= "enable_win16" if $is_win16;
$args .= ",[" . join(",",@flags) ."]" if @flags;
$args .= $flag_args;
$args .= ",[$implib]" if $implib && $implib ne $name;
push @lines, "WINE_CONFIG_DLL($name$args)\n";
}
......@@ -447,34 +456,31 @@ sub update_makefiles(@)
{
die "Invalid MODULE in $file" unless $make{"MODULE"} eq "$name.exe";
}
push @flags, "mc" if defined $make{"MC_SRCS"};
push @flags, "po" if defined $make{"PO_SRCS"};
push @flags, "install" unless $dont_install{$name};
push @flags, "installbin" if $bin_install{$name};
$args .= "," if $is_win16 || @flags;
$args .= "," if $is_win16 || defined $make{"=flags"};
$args .= "enable_win16" if $is_win16;
$args .= ",[" . join(",",@flags) ."]" if @flags;
push @lines, "WINE_CONFIG_PROGRAM($name$args)\n";
push @lines, "WINE_CONFIG_PROGRAM($name$args$flag_args)\n";
}
elsif ($rules eq $makerules{"MAKE_TEST_RULES"})
{
(my $dir = $file) =~ s/^(.*)\/Makefile/$1/;
push @lines, "WINE_CONFIG_TEST($dir)\n";
push @lines, "WINE_CONFIG_TEST($dir$flag_args)\n";
}
elsif ($rules eq $makerules{"MAKE_IMPLIB_RULES"})
{
(my $name = $file) =~ s/^dlls\/(.*)\/Makefile/$1/;
push @lines, "WINE_CONFIG_LIB($name)\n";
push @lines, "WINE_CONFIG_LIB($name$flag_args)\n";
}
elsif ($file =~ /^tools.*\/Makefile$/)
{
(my $name = $file) =~ s/^(.*)\/Makefile/$1/;
push @lines, "WINE_CONFIG_TOOL($name)\n";
push @lines, "WINE_CONFIG_TOOL($name$flag_args)\n";
}
elsif ($file =~ /\/Makefile$/)
{
(my $name = $file) =~ s/^(.*)\/Makefile/$1/;
push @lines, "WINE_CONFIG_MAKEFILE([$name])\n";
$args = "[$name]";
$args .= "," if defined $make{"=flags"};
push @lines, "WINE_CONFIG_MAKEFILE($args$flag_args)\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