Commit 45104d9c authored by Alexandre Julliard's avatar Alexandre Julliard

makefiles: Determine module type based on the defined variables, and add some sanity checks.

parent b1928795
...@@ -269,7 +269,7 @@ sub parse_makefile($) ...@@ -269,7 +269,7 @@ sub parse_makefile($)
$make{"=rules"} = $makerules{$var} || $var; $make{"=rules"} = $makerules{$var} || $var;
next; next;
} }
if (/^\s*(MODULE|IMPORTLIB|TESTDLL|PARENTSRC)\s*=\s*(.*)/) if (/^\s*(MODULE|IMPORTLIB|TESTDLL|PARENTSRC|APPMODE)\s*=\s*(.*)/)
{ {
my $var = $1; my $var = $1;
$make{$var} = $2; $make{$var} = $2;
...@@ -302,9 +302,7 @@ sub parse_makefile($) ...@@ -302,9 +302,7 @@ sub parse_makefile($)
${$make{"=flags"}}{"installbin"} = 1 if $bin_install{$1}; ${$make{"=flags"}}{"installbin"} = 1 if $bin_install{$1};
} }
if (defined $make{"=flags"} && defined $make{"=rules"} && if (defined $make{"=flags"} && defined $make{"MODULE"})
($make{"=rules"} eq "MAKE_DLL_RULES" ||
$make{"=rules"} eq "MAKE_PROG_RULES"))
{ {
die "Custom install-lib rule not allowed in $file" if defined ${$make{"=flags"}}{"install-lib"}; die "Custom install-lib rule not allowed in $file" if defined ${$make{"=flags"}}{"install-lib"};
die "Custom install-dev rule not allowed in $file" if defined ${$make{"=flags"}}{"install-dev"}; die "Custom install-dev rule not allowed in $file" if defined ${$make{"=flags"}}{"install-dev"};
...@@ -486,56 +484,67 @@ sub update_makefiles(@) ...@@ -486,56 +484,67 @@ sub update_makefiles(@)
foreach my $file (sort @_) foreach my $file (sort @_)
{ {
my %make = %{$makefiles{$file}}; my %make = %{$makefiles{$file}};
next unless defined $make{"=rules"};
my $rules = $make{"=rules"};
my $args = ""; my $args = "";
my $is_win16 = $make{"MODULE"} && ($make{"MODULE"} =~ /16$/ || $modules16{$make{"MODULE"}}); my $is_win16 = $make{"MODULE"} && ($make{"MODULE"} =~ /16$/ || $modules16{$make{"MODULE"}});
my $flag_args = defined $make{"=flags"} ? ",[" . join(",",sort keys %{$make{"=flags"}}) ."]" : ""; my $flag_args = defined $make{"=flags"} ? ",[" . join(",",sort keys %{$make{"=flags"}}) ."]" : "";
if ($rules eq "MAKE_DLL_RULES") 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";
}
elsif (defined($make{"MODULE"}) && $make{"MODULE"} =~ /\.a$/) # import lib
{
die "MODULE should not be defined as static lib in $file" unless $file =~ /^dlls\//;
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/; (my $name = $file) =~ s/^dlls\/(.*)\/Makefile/$1/;
push @lines, "WINE_CONFIG_LIB($name$flag_args)\n";
}
elsif (defined($make{"MODULE"}) && defined($make{"APPMODE"})) # program
{
die "APPMODE should not be defined in $file" unless $file =~ /^programs\//;
die "STATICLIB should not be defined in $file" if defined $make{"STATICLIB"};
(my $name = $file) =~ s/^programs\/(.*)\/Makefile/$1/;
if ($name =~ /\./) if ($name =~ /\./)
{ {
die "Invalid MODULE in $file" unless $make{"MODULE"} eq $name; die "Invalid MODULE in $file" unless $make{"MODULE"} eq $name;
} }
else else
{ {
die "Invalid MODULE in $file" unless $make{"MODULE"} eq "$name.dll"; die "Invalid MODULE in $file" unless $make{"MODULE"} eq "$name.exe";
} }
my $implib = $make{"IMPORTLIB"} || "";
$args .= "," if $is_win16 || defined $make{"=flags"}; $args .= "," if $is_win16 || defined $make{"=flags"};
$args .= "enable_win16" if $is_win16; $args .= "enable_win16" if $is_win16;
$args .= $flag_args; push @lines, "WINE_CONFIG_PROGRAM($name$args$flag_args)\n";
$args .= ",[$implib]" if $implib && $implib ne $name;
push @lines, "WINE_CONFIG_DLL($name$args)\n";
} }
elsif ($rules eq "MAKE_PROG_RULES") elsif (defined($make{"MODULE"})) # dll
{ {
(my $name = $file) =~ s/^programs\/(.*)\/Makefile/$1/; die "APPMODE should be defined in $file" if $file =~ /^programs\//;
die "MODULE should not be defined in $file" unless $file =~ /^dlls\//;
die "STATICLIB should not be defined in $file" if defined $make{"STATICLIB"};
(my $name = $file) =~ s/^dlls\/(.*)\/Makefile/$1/;
if ($name =~ /\./) if ($name =~ /\./)
{ {
die "Invalid MODULE in $file" unless $make{"MODULE"} eq $name; die "Invalid MODULE in $file" unless $make{"MODULE"} eq $name;
} }
else else
{ {
die "Invalid MODULE in $file" unless $make{"MODULE"} eq "$name.exe"; die "Invalid MODULE in $file" unless $make{"MODULE"} eq "$name.dll";
} }
my $implib = $make{"IMPORTLIB"} || "";
$args .= "," if $is_win16 || defined $make{"=flags"}; $args .= "," if $is_win16 || defined $make{"=flags"};
$args .= "enable_win16" if $is_win16; $args .= "enable_win16" if $is_win16;
push @lines, "WINE_CONFIG_PROGRAM($name$args$flag_args)\n"; $args .= $flag_args;
} $args .= ",[$implib]" if $implib && $implib ne $name;
elsif ($rules eq "MAKE_TEST_RULES") push @lines, "WINE_CONFIG_DLL($name$args)\n";
{
(my $dir = $file) =~ s/^(.*)\/Makefile/$1/;
push @lines, "WINE_CONFIG_TEST($dir$flag_args)\n";
}
elsif ($rules eq "MAKE_IMPLIB_RULES")
{
(my $name = $file) =~ s/^dlls\/(.*)\/Makefile/$1/;
push @lines, "WINE_CONFIG_LIB($name$flag_args)\n";
} }
elsif ($file =~ /^tools.*\/Makefile$/) elsif ($file =~ /^tools.*\/Makefile$/)
{ {
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/; (my $name = $file) =~ s/^(.*)\/Makefile/$1/;
push @lines, "WINE_CONFIG_TOOL($name$flag_args)\n"; push @lines, "WINE_CONFIG_TOOL($name$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