Convert include statements of not-found files to lower case by
default Added --no-lower-include option to override the above Beautified the interactive mode output to make it easier to follow Interactive mode: support the --mfc and --wrap options for both projects and targets Fixed the mfc/wrap propagation between project and targets (goes both ways) Autodetect MFC based projects by looking for an 'stdafx.(cpp|h)' file Don't put the stdafx.cpp file in the list of files to compile (it's just there for pre-compiled headers, yuk) Fixed LD_LIBRARY_PATH when linking an application with a library from the same makefile Don't forget 'extra' sources when looking for a file for configure.in Renamed the '--no-makefile' option to '-no-generated-file'
This commit is contained in:
parent
45afff3836
commit
a106edb71a
118
tools/winemaker
118
tools/winemaker
|
@ -3,7 +3,7 @@
|
|||
# Copyright 2000 Francois Gouget for CodeWeavers
|
||||
# fgouget@codeweavers.com
|
||||
#
|
||||
my $version="0.5.1";
|
||||
my $version="0.5.2";
|
||||
|
||||
use Cwd;
|
||||
use File::Basename;
|
||||
|
@ -57,6 +57,10 @@ my $opt_backup;
|
|||
# Defines which files to rename
|
||||
my $opt_lower;
|
||||
|
||||
##
|
||||
# If we don't find the file referenced by an include, lower it
|
||||
my $opt_lower_include;
|
||||
|
||||
|
||||
# Options for the 'Source' method
|
||||
|
||||
|
@ -86,9 +90,9 @@ my $opt_ask_project_options;
|
|||
my $opt_ask_target_options;
|
||||
|
||||
##
|
||||
# If true then winemaker should not generate any file (mostly
|
||||
# makefiles, thus the name, but also .spec files, configure.in, etc.)
|
||||
my $opt_no_makefile;
|
||||
# If false then winemaker should not generate any file, i.e.
|
||||
# no makefiles, but also no .spec files, no configure.in, etc.
|
||||
my $opt_no_generated_files;
|
||||
|
||||
##
|
||||
# Specifies not to print the banner if set.
|
||||
|
@ -389,15 +393,19 @@ sub source_set_options
|
|||
push @{@$target[$T_LIBRARY_PATH]},$option;
|
||||
} elsif ($option =~ /^-l/) {
|
||||
push @{@$target[$T_IMPORTS]},$';
|
||||
} elsif (@$target[$T_TYPE] != $TT_SETTINGS and
|
||||
@$target[$T_TYPE] != $TT_DLL and
|
||||
} elsif (@$target[$T_TYPE] != $TT_DLL and
|
||||
$option =~ /^--wrap/) {
|
||||
@$target[$T_FLAGS]|=$TF_WRAP;
|
||||
} elsif (@$target[$T_TYPE] != $TT_SETTINGS and $option =~ /^--mfc/) {
|
||||
} elsif (@$target[$T_TYPE] != $TT_DLL and
|
||||
$option =~ /^--no-wrap/) {
|
||||
@$target[$T_FLAGS]&=~$TF_WRAP;
|
||||
} elsif ($option =~ /^--mfc/) {
|
||||
@$target[$T_FLAGS]|=$TF_MFC;
|
||||
if (@$target[$T_TYPE] != $TT_DLL) {
|
||||
@$target[$T_FLAGS]|=$TF_WRAP;
|
||||
}
|
||||
} elsif ($option =~ /^--no-mfc/) {
|
||||
@$target[$T_FLAGS]&=~($TF_MFC|$TF_WRAP);
|
||||
} else {
|
||||
print STDERR "warning: unknown option \"$option\", ignoring it\n";
|
||||
}
|
||||
|
@ -447,6 +455,7 @@ sub source_scan_directory
|
|||
$project=[];
|
||||
project_init($project,$path);
|
||||
}
|
||||
my $project_settings=@$project[$P_SETTINGS];
|
||||
|
||||
# First find out what this directory contains:
|
||||
# collect all sources, targets and subdirectories
|
||||
|
@ -482,11 +491,19 @@ sub source_scan_directory
|
|||
} elsif ($dentry =~ /\.c$/i and $dentry !~ /\.spec\.c$/) {
|
||||
push @sources_c,"$dentry";
|
||||
} elsif ($dentry =~ /\.(cpp|cxx)$/i) {
|
||||
push @sources_cxx,"$dentry";
|
||||
if ($dentry =~ /^stdafx.cpp$/i) {
|
||||
push @sources_misc,"$dentry";
|
||||
@$project_settings[$T_FLAGS]|=$TF_MFC|$TF_WRAP;
|
||||
} else {
|
||||
push @sources_cxx,"$dentry";
|
||||
}
|
||||
} elsif ($dentry =~ /\.rc$/i) {
|
||||
push @sources_rc,"$dentry";
|
||||
} elsif ($dentry =~ /\.(h|hxx|inl|rc2|dlg)$/i) {
|
||||
push @sources_misc,"$dentry";
|
||||
if ($dentry =~ /^stdafx.h$/i) {
|
||||
@$project_settings[$T_FLAGS]|=$TF_MFC|$TF_WRAP;
|
||||
}
|
||||
} elsif ($dentry =~ /\.dsp$/i) {
|
||||
push @dsp_files,"$dentry";
|
||||
$has_win_project=1;
|
||||
|
@ -512,7 +529,6 @@ sub source_scan_directory
|
|||
return;
|
||||
}
|
||||
|
||||
my $project_settings=@$project[$P_SETTINGS];
|
||||
my $source_count=@sources_c+@sources_cxx+@sources_rc+
|
||||
@{@$project_settings[$T_SOURCES_C]}+
|
||||
@{@$project_settings[$T_SOURCES_CXX]}+
|
||||
|
@ -586,12 +602,12 @@ sub source_scan_directory
|
|||
if ($opt_is_interactive == $OPT_ASK_YES) {
|
||||
my $target_list=join " ",keys %targets;
|
||||
print "\n*** In $path\n";
|
||||
print "winemaker found the following list of (potential) targets\n";
|
||||
print "$target_list\n";
|
||||
print "Type enter to use it as is, your own comma-separated list of\n";
|
||||
print "targets, 'none' to assign the source files to a parent directory,\n";
|
||||
print "or 'ignore' to ignore everything in this directory tree.\n";
|
||||
print "Target list:\n";
|
||||
print "* winemaker found the following list of (potential) targets\n";
|
||||
print "* $target_list\n";
|
||||
print "* Type enter to use it as is, your own comma-separated list of\n";
|
||||
print "* targets, 'none' to assign the source files to a parent directory,\n";
|
||||
print "* or 'ignore' to ignore everything in this directory tree.\n";
|
||||
print "* Target list:\n";
|
||||
$target_list=<STDIN>;
|
||||
chomp $target_list;
|
||||
if ($target_list eq "") {
|
||||
|
@ -639,9 +655,22 @@ sub source_scan_directory
|
|||
|
||||
# Ask for project-wide options
|
||||
if ($opt_ask_project_options == $OPT_ASK_YES) {
|
||||
print "Type any project-wide options (-D/-I/-L/-l),\n";
|
||||
print "or 'skip' to skip the target specific options, or 'never' to not be\n";
|
||||
print "asked this question again:\n";
|
||||
my $flag_desc="";
|
||||
if ((@$project_settings[$T_FLAGS] & $TF_MFC)!=0) {
|
||||
$flag_desc="mfc";
|
||||
}
|
||||
if ((@$project_settings[$T_FLAGS] & $TF_WRAP)!=0) {
|
||||
if ($flag_desc ne "") {
|
||||
$flag_desc.=", ";
|
||||
}
|
||||
$flag_desc.="wrapped";
|
||||
}
|
||||
print "* Type any project-wide options (-D/-I/-L/-l/--mfc/--wrap),\n";
|
||||
if (defined $flag_desc) {
|
||||
print "* (currently $flag_desc)\n";
|
||||
}
|
||||
print "* or 'skip' to skip the target specific options,\n";
|
||||
print "* or 'never' to not be asked this question again:\n";
|
||||
my $options=<STDIN>;
|
||||
chomp $options;
|
||||
if ($options eq "skip") {
|
||||
|
@ -666,6 +695,7 @@ sub source_scan_directory
|
|||
my $target=[];
|
||||
target_init($target);
|
||||
@$target[$T_NAME]=$target_name;
|
||||
@$target[$T_FLAGS]|=@$project_settings[$T_FLAGS];
|
||||
if ($target_name =~ /^lib(.*)\.so$/) {
|
||||
@$target[$T_TYPE]=$TT_DLL;
|
||||
@$target[$T_INIT]=get_default_init($TT_DLL);
|
||||
|
@ -683,8 +713,23 @@ sub source_scan_directory
|
|||
|
||||
# Ask for target-specific options
|
||||
if ($opt_ask_target_options == $OPT_ASK_YES) {
|
||||
print "Specify any link option (-L/-l) specific to the target \"$target_name\"\n";
|
||||
print " or 'never' to not be asked this question again:\n";
|
||||
my $flag_desc="";
|
||||
if ((@$target[$T_FLAGS] & $TF_MFC)!=0) {
|
||||
$flag_desc=" (mfc";
|
||||
}
|
||||
if ((@$target[$T_FLAGS] & $TF_WRAP)!=0) {
|
||||
if ($flag_desc ne "") {
|
||||
$flag_desc.=", ";
|
||||
} else {
|
||||
$flag_desc=" (";
|
||||
}
|
||||
$flag_desc.="wrapped";
|
||||
}
|
||||
if ($flag_desc ne "") {
|
||||
$flag_desc.=")";
|
||||
}
|
||||
print "* Specify any link option (-L/-l/--mfc/--wrap) specific to the target\n";
|
||||
print "* \"$target_name\"$flag_desc or 'never' to not be asked this question again:\n";
|
||||
my $options=<STDIN>;
|
||||
chomp $options;
|
||||
if ($options eq "never") {
|
||||
|
@ -779,7 +824,7 @@ sub source_scan_directory
|
|||
# the libraries
|
||||
if (@local_imports > 0 and @program_list > 0) {
|
||||
foreach $target (@program_list) {
|
||||
push @{@$target[$T_LIBRARY_PATH]},".";
|
||||
push @{@$target[$T_LIBRARY_PATH]},"-L.";
|
||||
push @{@$target[$T_IMPORTS]},@local_imports;
|
||||
push @{@$target[$T_DEPENDS]},@local_depends;
|
||||
}
|
||||
|
@ -833,7 +878,7 @@ sub source_scan
|
|||
#
|
||||
#####
|
||||
|
||||
sub create_wrappers
|
||||
sub postprocess_targets
|
||||
{
|
||||
foreach $project (@projects) {
|
||||
foreach $target (@{@$project[$P_TARGETS]}) {
|
||||
|
@ -855,6 +900,10 @@ sub create_wrappers
|
|||
|
||||
push @{@$project[$P_TARGETS]},$wrapper;
|
||||
}
|
||||
if ((@$target[$T_FLAGS] & $TF_MFC) != 0) {
|
||||
@{@$project[$P_SETTINGS]}[$T_FLAGS]|=$TF_MFC;
|
||||
$needs_mfc=1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1109,8 +1158,7 @@ sub get_real_include_name
|
|||
}
|
||||
$filename =~ s+\\\\+/+g; # in include ""
|
||||
$filename =~ s+\\+/+g; # in include <> !
|
||||
if ($filename =~ /^[A-Z_.\/\\]*$/) {
|
||||
#FIXME: should this depend on --lower-uppercase & co???
|
||||
if ($opt_lower_include) {
|
||||
return lc "$filename";
|
||||
}
|
||||
return $filename;
|
||||
|
@ -1733,7 +1781,7 @@ sub generate_global_files
|
|||
# Get the name of a source file for configure.in
|
||||
my $a_source_file;
|
||||
search_a_file: foreach $project (@projects) {
|
||||
foreach $target (@{@$project[$P_TARGETS]}) {
|
||||
foreach $target (@{@$project[$P_TARGETS]}, @$project[$P_SETTINGS]) {
|
||||
$a_source_file=@{@$target[$T_SOURCES_C]}[0];
|
||||
if (!defined $a_source_file) {
|
||||
$a_source_file=@{@$target[$T_SOURCES_CXX]}[0];
|
||||
|
@ -1817,6 +1865,7 @@ sub generate
|
|||
|
||||
$opt_backup=1;
|
||||
$opt_lower=$OPT_LOWER_UPPERCASE;
|
||||
$opt_lower_include=1;
|
||||
|
||||
# $opt_single_target=<undefined>
|
||||
$opt_target_type=$TT_GUIEXE;
|
||||
|
@ -1824,7 +1873,7 @@ $opt_flags=0;
|
|||
$opt_is_interactive=$OPT_ASK_NO;
|
||||
$opt_ask_project_options=$OPT_ASK_NO;
|
||||
$opt_ask_target_options=$OPT_ASK_NO;
|
||||
$opt_no_makefile=0;
|
||||
$opt_no_generated_files=0;
|
||||
$opt_no_banner=0;
|
||||
|
||||
|
||||
|
@ -1854,8 +1903,14 @@ while (@ARGV>0) {
|
|||
$opt_lower=$OPT_LOWER_ALL;
|
||||
} elsif ($arg eq "--lower-uppercase") {
|
||||
$opt_lower=$OPT_LOWER_UPPERCASE;
|
||||
} elsif ($arg eq "--no-makefile") {
|
||||
$opt_no_makefile=1;
|
||||
} elsif ($arg eq "--lower-include") {
|
||||
$opt_lower_include=1;
|
||||
} elsif ($arg eq "--no-lower-include") {
|
||||
$opt_lower_include=0;
|
||||
} elsif ($arg eq "--generated-files") {
|
||||
$opt_no_generated_files=0;
|
||||
} elsif ($arg eq "--no-generated-files") {
|
||||
$opt_no_generated_files=1;
|
||||
|
||||
} elsif ($arg =~ /^-D/) {
|
||||
push @{$global_settings[$T_DEFINES]},$arg;
|
||||
|
@ -1910,6 +1965,7 @@ if (defined $usage) {
|
|||
print STDERR " [--wrap|--nowrap] [--mfc|--nomfc]\n";
|
||||
print STDERR " [-Dmacro[=defn]] [-Idir] [-Ldir] [-llibrary]\n";
|
||||
print STDERR " [--interactive] [--single-target name]\n";
|
||||
print STDERR " [--generated-files|--no-generated-files]\n";
|
||||
exit (2);
|
||||
}
|
||||
|
||||
|
@ -1919,14 +1975,14 @@ fix_file_and_directory_names(".");
|
|||
# Scan the sources to identify the projects and targets
|
||||
source_scan();
|
||||
|
||||
# Create targets for wrappers
|
||||
create_wrappers();
|
||||
# Create targets for wrappers, etc.
|
||||
postprocess_targets();
|
||||
|
||||
# Fix the source files
|
||||
fix_source();
|
||||
|
||||
# Generate the Makefile and the spec file
|
||||
if (! $opt_no_makefile) {
|
||||
if (! $opt_no_generated_files) {
|
||||
generate();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue