Allow generate_query_config.pl to take arguments
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
parent
aedca0c993
commit
3a8413d316
1 changed files with 18 additions and 8 deletions
|
@ -14,7 +14,8 @@
|
||||||
# information is used to automatically generate the body of the query_config()
|
# information is used to automatically generate the body of the query_config()
|
||||||
# function by using the template in scripts/data_files/query_config.fmt.
|
# function by using the template in scripts/data_files/query_config.fmt.
|
||||||
#
|
#
|
||||||
# Usage: ./scripts/generate_query_config.pl without arguments
|
# Usage: scripts/generate_query_config.pl without arguments, or
|
||||||
|
# generate_query_config.pl config_file template_file output_file
|
||||||
#
|
#
|
||||||
# Copyright The Mbed TLS Contributors
|
# Copyright The Mbed TLS Contributors
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
@ -33,16 +34,25 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
my $config_file = "./include/mbedtls/mbedtls_config.h";
|
my ($config_file, $query_config_format_file, $query_config_file);
|
||||||
|
|
||||||
my $query_config_format_file = "./scripts/data_files/query_config.fmt";
|
if( @ARGV ) {
|
||||||
my $query_config_file = "./programs/test/query_config.c";
|
die "Invalid number of arguments" if scalar @ARGV != 3;
|
||||||
|
($config_file, $query_config_format_file, $query_config_file) = @ARGV;
|
||||||
|
|
||||||
|
-f $config_file or die "No such file: $config_file";
|
||||||
|
-f $query_config_format_file or die "No such file: $query_config_format_file";
|
||||||
|
} else {
|
||||||
|
$config_file = "./include/mbedtls/mbedtls_config.h";
|
||||||
|
$query_config_format_file = "./scripts/data_files/query_config.fmt";
|
||||||
|
$query_config_file = "./programs/test/query_config.c";
|
||||||
|
|
||||||
unless( -f $config_file && -f $query_config_format_file ) {
|
unless( -f $config_file && -f $query_config_format_file ) {
|
||||||
chdir '..' or die;
|
chdir '..' or die;
|
||||||
-f $config_file && -f $query_config_format_file
|
-f $config_file && -f $query_config_format_file
|
||||||
or die "Without arguments, must be run from root or a subdirectory\n";
|
or die "Without arguments, must be run from root or a subdirectory\n";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Excluded macros from the generated query_config.c. For example, macros that
|
# Excluded macros from the generated query_config.c. For example, macros that
|
||||||
# have commas or function-like macros cannot be transformed into strings easily
|
# have commas or function-like macros cannot be transformed into strings easily
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue