aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Kurek <andrzej.kurek@mobica.com>2019-04-12 10:51:27 -0400
committerAndrzej Kurek <andrzej.kurek@mobica.com>2019-04-12 10:51:27 -0400
commit021dc3f226daae466d0ee46552d20ebf64bc9022 (patch)
tree2b5b6b660ac07c1329b484c3ddcd0d328b08c844
parent463f049ef0a2b17745b8b255ee997a879cb32797 (diff)
downloadmbedtls-archive/iotssl-2801-generate-files-with-submodule.zip
mbedtls-archive/iotssl-2801-generate-files-with-submodule.tar.gz
mbedtls-archive/iotssl-2801-generate-files-with-submodule.tar.bz2
generate_visualc_files.pl: add mbedtls source shadowing by cryptoarchive/iotssl-2801-generate-files-with-submodule
Running the generation script with "include_crypto" input parameter set to 1 makes the mbedtls sources being overshadowed by crypto sources. In case of any duplicate sources, crypto ones take precedence.
-rwxr-xr-xscripts/generate_visualc_files.pl21
1 files changed, 15 insertions, 6 deletions
diff --git a/scripts/generate_visualc_files.pl b/scripts/generate_visualc_files.pl
index 37e09a1..e6545bc 100755
--- a/scripts/generate_visualc_files.pl
+++ b/scripts/generate_visualc_files.pl
@@ -4,7 +4,8 @@
# 2010
#
# Must be run from mbedTLS root or scripts directory.
-# Takes "include_crypto" as an argument, off by default.
+# Takes "include_crypto" as an argument that can be either 0 (don't include) or
+# 1 (include). Off by default.
use warnings;
use strict;
@@ -27,10 +28,7 @@ if( @ARGV ) {
my $programs_dir = 'programs';
my $header_dir = 'include/mbedtls';
my $source_dir = 'library';
-
-if( $include_crypto ) {
- $source_dir = 'crypto/library';
-}
+my $crypto_dir = 'crypto';
# Need windows line endings!
my $vsx_hdr_tpl = <<EOT;
@@ -204,7 +202,18 @@ sub main {
my @app_list = get_app_list();
my @headers = <$header_dir/*.h>;
- my @sources = <$source_dir/*.c>;
+
+ my @sources = ();
+ if ($include_crypto) {
+ @sources = <$crypto_dir/$source_dir/*.c>;
+ foreach my $file (<$source_dir/*.c>) {
+ my $basename = $file; $basename =~ s!.*/!!;
+ push @sources, $file unless -e "$crypto_dir/$source_dir/$basename";
+ }
+ } else {
+ @sources = <$source_dir/*.c>;
+ }
+
map { s!/!\\!g } @headers;
map { s!/!\\!g } @sources;