From 021dc3f226daae466d0ee46552d20ebf64bc9022 Mon Sep 17 00:00:00 2001 From: Andrzej Kurek Date: Fri, 12 Apr 2019 10:51:27 -0400 Subject: [PATCH] generate_visualc_files.pl: add mbedtls source shadowing by crypto 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. --- scripts/generate_visualc_files.pl | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/scripts/generate_visualc_files.pl b/scripts/generate_visualc_files.pl index 37e09a1f6..e6545bc3a 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 = <; - 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;