winemaker: Fix conversion of C++ filenames into object names.

oldstable
André Hentschel 2012-03-10 17:46:35 +01:00 committed by Alexandre Julliard
parent 02b3700779
commit c6008a06ac
1 changed files with 28 additions and 8 deletions

View File

@ -20,7 +20,7 @@ use strict;
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
#
my $version="0.8.1";
my $version="0.8.2";
use Cwd;
use File::Basename;
@ -277,6 +277,10 @@ my $TF_NOMSVCRT=32;
# This target has a def file (only use it with TT_DLL)
my $TF_HASDEF=64;
##
# This target has C++ files named *.cxx (instead of *.cpp)
my $TF_HASCXX=128;
##
# Initialize a target:
# - set the target type to TT_SETTINGS, i.e. no real target will
@ -805,13 +809,16 @@ sub source_scan_project_file($$$)
if (!defined $sfilet) { next; }
if ($sfilet =~ /\.c$/i and $sfilet !~ /\.(dbg|spec)\.c$/) {
push @sources_c,$sfilet;
} elsif ($sfilet =~ /\.(cpp|cxx)$/i) {
} elsif ($sfilet =~ /\.cpp$/i) {
if ($sfilet =~ /^stdafx.cpp$/i && !(@$project_settings[$T_FLAGS] & $TF_NOMFC)) {
push @sources_misc,$sfilet;
@$project_settings[$T_FLAGS]|=$TF_MFC;
} else {
push @sources_cxx,$sfilet;
}
} elsif ($sfilet =~ /\.cxx$/i) {
@$project_settings[$T_FLAGS]|=$TF_HASCXX;
push @sources_cxx,$sfilet;
} elsif ($sfilet =~ /\.rc$/i) {
push @sources_rc,$sfilet;
} elsif ($sfilet =~ /\.def$/i) {
@ -896,13 +903,16 @@ sub source_scan_project_file($$$)
$sfilet=~s/\\/\//g; #make slashes out of backslashes
if ($sfilet =~ /\.c$/i and $sfilet !~ /\.(dbg|spec)\.c$/) {
push @sources_c,$sfilet;
} elsif ($sfilet =~ /\.(cpp|cxx)$/i) {
} elsif ($sfilet =~ /\.cpp$/i) {
if ($sfilet =~ /^stdafx.cpp$/i && !(@$project_settings[$T_FLAGS] & $TF_NOMFC)) {
push @sources_misc,$sfilet;
@$project_settings[$T_FLAGS]|=$TF_MFC;
} else {
push @sources_cxx,$sfilet;
}
} elsif ($sfilet =~ /\.cxx$/i) {
@$project_settings[$T_FLAGS]|=$TF_HASCXX;
push @sources_cxx,$sfilet;
} elsif ($sfilet =~ /\.rc$/i) {
push @sources_rc,$sfilet;
} elsif ($sfilet =~ /\.def$/i) {
@ -1318,13 +1328,16 @@ sub source_scan_directory($$$$)
$targets{$dentry}=1;
} elsif ($dentry =~ /\.c$/i and $dentry !~ /\.(dbg|spec)\.c$/) {
push @sources_c,"$dentry";
} elsif ($dentry =~ /\.(cpp|cxx)$/i) {
} elsif ($dentry =~ /\.cpp$/i) {
if ($dentry =~ /^stdafx.cpp$/i && !(@$project_settings[$T_FLAGS] & $TF_NOMFC)) {
push @sources_misc,"$dentry";
@$project_settings[$T_FLAGS]|=$TF_MFC;
} else {
push @sources_cxx,"$dentry";
}
} elsif ($dentry =~ /\.cxx$/i) {
@$project_settings[$T_FLAGS]|=$TF_HASCXX;
push @sources_cxx,"$dentry";
} elsif ($dentry =~ /\.rc$/i) {
push @sources_rc,"$dentry";
} elsif ($dentry =~ /\.def$/i) {
@ -2378,6 +2391,13 @@ sub generate_project_files($)
return;
}
my $cpp_to_object;
if (@$project_settings[$T_FLAGS] & $TF_HASCXX) {
$cpp_to_object=".cxx=.o";
} else {
$cpp_to_object=".cpp=.o";
}
print FILEO "### Generated by Winemaker $version\n";
print FILEO "###\n";
print FILEO "### Invocation command line was\n";
@ -2439,7 +2459,7 @@ sub generate_project_files($)
generate_list("EXTRA_CXX_SRCS",1,@$project_settings[$T_SOURCES_CXX]);
generate_list("EXTRA_RC_SRCS",1,@$project_settings[$T_SOURCES_RC]);
print FILEO "\n";
generate_list("EXTRA_OBJS",1,["\$(EXTRA_C_SRCS:.c=.o)","\$(EXTRA_CXX_SRCS:.cpp=.o)"]);
generate_list("EXTRA_OBJS",1,["\$(EXTRA_C_SRCS:.c=.o)","\$(EXTRA_CXX_SRCS:$cpp_to_object)"]);
print FILEO "\n\n\n";
}
@ -2460,7 +2480,7 @@ sub generate_project_files($)
generate_list("${canon}_LIBRARY_PATH",1,@$target[$T_LIBRARY_PATH]);
generate_list("${canon}_LIBRARIES",1,@$target[$T_LIBRARIES]);
print FILEO "\n";
generate_list("${canon}_OBJS",1,["\$(${canon}_C_SRCS:.c=.o)","\$(${canon}_CXX_SRCS:.cpp=.o)","\$(${canon}_RC_SRCS:.rc=.res)"]);
generate_list("${canon}_OBJS",1,["\$(${canon}_C_SRCS:.c=.o)","\$(${canon}_CXX_SRCS:$cpp_to_object)","\$(${canon}_RC_SRCS:.rc=.res)"]);
print FILEO "\n\n\n";
}
print FILEO "### Global source lists\n\n";
@ -2518,7 +2538,7 @@ sub generate_project_files($)
print FILEO "\n";
print FILEO "# Implicit rules\n";
print FILEO "\n";
print FILEO ".SUFFIXES: .cpp .rc .res\n";
print FILEO ".SUFFIXES: .cpp .cxx .rc .res\n";
print FILEO "DEFINCL = \$(INCLUDE_PATH) \$(DEFINES) \$(OPTIONS)\n";
print FILEO "\n";
print FILEO ".c.o:\n";
@ -2539,7 +2559,7 @@ sub generate_project_files($)
print FILEO " \\\\\\#*\\\\\\# *~ *% .\\\\\\#*\n";
print FILEO "\n";
print FILEO "clean:: \$(SUBDIRS:%=%/__clean__) \$(EXTRASUBDIRS:%=%/__clean__)\n";
print FILEO "\t\$(RM) \$(CLEAN_FILES) \$(RC_SRCS:.rc=.res) \$(C_SRCS:.c=.o) \$(CXX_SRCS:.cpp=.o)\n";
print FILEO "\t\$(RM) \$(CLEAN_FILES) \$(RC_SRCS:.rc=.res) \$(C_SRCS:.c=.o) \$(CXX_SRCS:$cpp_to_object)\n";
print FILEO "\t\$(RM) \$(DLLS:%=%.so) \$(LIBS) \$(EXES) \$(EXES:%=%.so)\n";
print FILEO "\n";
print FILEO "\$(SUBDIRS:%=%/__clean__): dummy\n";