Simplify usage of generate scripts

This commit is contained in:
Manuel Pégourié-Gonnard 2014-05-09 13:40:14 +02:00 committed by Paul Bakker
parent 71c8f20619
commit d66f900ba2
3 changed files with 46 additions and 8 deletions

View File

@ -85,10 +85,10 @@ do
done done
[ $VERBOSE ] && echo "Re-generating library/error.c" [ $VERBOSE ] && echo "Re-generating library/error.c"
scripts/generate_errors.pl include/polarssl scripts/data_files library/error.c scripts/generate_errors.pl
[ $VERBOSE ] && echo "Re-generating library/version_features.c" [ $VERBOSE ] && echo "Re-generating library/version_features.c"
scripts/generate_features.pl include/polarssl scripts/data_files library/version_features.c scripts/generate_features.pl
[ $VERBOSE ] && echo "Re-generating visualc files" [ $VERBOSE ] && echo "Re-generating visualc files"
scripts/generate_visualc_files.pl scripts/generate_visualc_files.pl

View File

@ -1,11 +1,32 @@
#!/usr/bin/perl #!/usr/bin/perl
# Generate error.c
# #
# Usage: ./generate_errors.pl or scripts/generate_errors.pl without arguments,
# or generate_errors.pl include_dir data_dir error_file
use strict; use strict;
my $include_dir = shift or die "Missing include directory"; my ($include_dir, $data_dir, $error_file);
my $data_dir = shift or die "Missing data directory";
my $error_file = shift or die "Missing destination file"; if( @ARGV ) {
die "Invalid number of arguments" if scalar @ARGV != 3;
($include_dir, $data_dir, $error_file) = @ARGV;
-d $include_dir or die "No such directory: $include_dir\n";
-d $data_dir or die "No such directory: $data_dir\n";
} else {
$include_dir = 'include/polarssl';
$data_dir = 'scripts/data_files';
$error_file = 'library/error.c';
unless( -d $include_dir && -d $data_dir ) {
chdir '..' or die;
-d $include_dir && -d $data_dir
or die "Without arguments, must be run from root or scripts\n"
}
}
my $error_format_file = $data_dir.'/error.fmt'; my $error_format_file = $data_dir.'/error.fmt';
my @low_level_modules = ( "AES", "ASN1", "BLOWFISH", "CAMELLIA", "BIGNUM", my @low_level_modules = ( "AES", "ASN1", "BLOWFISH", "CAMELLIA", "BIGNUM",

View File

@ -3,9 +3,26 @@
use strict; use strict;
my $include_dir = shift or die "Missing include directory"; my ($include_dir, $data_dir, $feature_file);
my $data_dir = shift or die "Missing data directory";
my $feature_file = shift or die "Missing destination file"; if( @ARGV ) {
die "Invalid number of arguments" if scalar @ARGV != 3;
($include_dir, $data_dir, $feature_file) = @ARGV;
-d $include_dir or die "No such directory: $include_dir\n";
-d $data_dir or die "No such directory: $data_dir\n";
} else {
$include_dir = 'include/polarssl';
$data_dir = 'scripts/data_files';
$feature_file = 'library/version_features.c';
unless( -d $include_dir && -d $data_dir ) {
chdir '..' or die;
-d $include_dir && -d $data_dir
or die "Without arguments, must be run from root or scripts\n"
}
}
my $feature_format_file = $data_dir.'/version_features.fmt'; my $feature_format_file = $data_dir.'/version_features.fmt';
my @sections = ( "System support", "PolarSSL modules", my @sections = ( "System support", "PolarSSL modules",