diff --git a/scripts/generate_visualc_files.pl b/scripts/generate_visualc_files.pl
index 8d36653b4..e042a4493 100755
--- a/scripts/generate_visualc_files.pl
+++ b/scripts/generate_visualc_files.pl
@@ -1,8 +1,7 @@
#!/usr/bin/perl
-# Generate files for MS Visual Studio:
-# - for VS6: main project (library) file, individual app files, workspace
-# - for VS2010: main file, individual apps, solution file
+# Generate main file, individual apps and solution files for MS Visual Studio
+# 2010
#
# Must be run from mbedTLS root or scripts directory.
# Takes no argument.
@@ -171,12 +170,22 @@ sub gen_vsx_solution {
content_to_file( $out, $vsx_sln_file );
}
+sub del_vsx_files {
+ unlink glob "'$vsx_dir/*.$vsx_ext'";
+ unlink $vsx_main_file;
+ unlink $vsx_sln_file;
+}
+
sub main {
if( ! check_dirs() ) {
chdir '..' or die;
check_dirs or die "Must but run from mbedTLS root or scripts dir\n";
}
+ # Remove old files to ensure that, for example, project files from deleted
+ # apps are not kept
+ del_vsx_files();
+
my @app_list = get_app_list();
my @headers = <$header_dir/*.h>;
my @sources = <$source_dir/*.c>;
diff --git a/tests/scripts/check-generated-files.sh b/tests/scripts/check-generated-files.sh
index 0400bc754..4976bacf5 100755
--- a/tests/scripts/check-generated-files.sh
+++ b/tests/scripts/check-generated-files.sh
@@ -1,6 +1,12 @@
-#!/bin/sh
+#! /usr/bin/env sh
-# check if generated files are up-to-date
+# This file is part of mbed TLS (https://tls.mbed.org)
+#
+# Copyright (c) 2018, ARM Limited, All Rights Reserved
+#
+# Purpose
+#
+# Check if generated files are up-to-date.
set -eu
@@ -11,14 +17,53 @@ fi
check()
{
- FILE=$1
- SCRIPT=$2
+ SCRIPT=$1
+ TO_CHECK=$2
+ PATTERN=""
+ FILES=""
+
+ if [ -d $TO_CHECK ]; then
+ for FILE in $TO_CHECK/*; do
+ FILES="$FILE $FILES"
+ done
+ else
+ FILES=$TO_CHECK
+ fi
+
+ for FILE in $FILES; do
+ cp $FILE $FILE.bak
+ done
- cp $FILE $FILE.bak
$SCRIPT
- diff $FILE $FILE.bak
- mv $FILE.bak $FILE
+
+ # Compare the script output to the old files and remove backups
+ for FILE in $FILES; do
+ if ! diff $FILE $FILE.bak >/dev/null 2>&1; then
+ echo "'$FILE' was either modified or deleted by '$SCRIPT'"
+ exit 1
+ fi
+ mv $FILE.bak $FILE
+
+ if [ -d $TO_CHECK ]; then
+ # Create a grep regular expression that we can check against the
+ # directory contents to test whether new files have been created
+ if [ -z $PATTERN ]; then
+ PATTERN="$(basename $FILE)"
+ else
+ PATTERN="$PATTERN\|$(basename $FILE)"
+ fi
+ fi
+ done
+
+ if [ -d $TO_CHECK ]; then
+ # Check if there are any new files
+ if ls -1 $TO_CHECK | grep -v "$PATTERN" >/dev/null 2>&1; then
+ echo "Files were created by '$SCRIPT'"
+ exit 1
+ fi
+ fi
}
-check library/error.c scripts/generate_errors.pl
-check library/version_features.c scripts/generate_features.pl
+check scripts/generate_errors.pl library/error.c
+check scripts/generate_features.pl library/version_features.c
+check scripts/generate_visualc_files.pl visualc/VS2010
diff --git a/visualc/VS2010/md5sum.vcxproj b/visualc/VS2010/md5sum.vcxproj
deleted file mode 100644
index 6f20e57e7..000000000
--- a/visualc/VS2010/md5sum.vcxproj
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
-
-
-
-
- {46cf2d25-6a36-4189-b59c-e4815388e554}
- true
-
-
-
- {80FE1ECF-6992-A275-7973-E2976718D128}
- Win32Proj
- md5sum
-
-
-
- Application
- true
- Unicode
-
-
- Application
- true
- Unicode
-
-
- Application
- false
- true
- Unicode
-
-
- Application
- false
- true
- Unicode
- Windows7.1SDK
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
- true
-
-
- false
-
-
- false
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- ../../include
-
-
- Console
- true
- NotSet
- kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
- Debug
-
-
- false
-
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- ../../include
-
-
- Console
- true
- NotSet
- kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
- Debug
-
-
- false
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- ../../include
-
-
- Console
- true
- true
- true
- Release
- kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- ../../include
-
-
- Console
- true
- true
- true
- Release
- %(AdditionalDependencies);
-
-
-
-
-
-
diff --git a/visualc/VS2010/sha1sum.vcxproj b/visualc/VS2010/sha1sum.vcxproj
deleted file mode 100644
index 2c3674b45..000000000
--- a/visualc/VS2010/sha1sum.vcxproj
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
-
-
-
-
- {46cf2d25-6a36-4189-b59c-e4815388e554}
- true
-
-
-
- {E91D12D7-01C0-357F-CAB1-8478B096743C}
- Win32Proj
- sha1sum
-
-
-
- Application
- true
- Unicode
-
-
- Application
- true
- Unicode
-
-
- Application
- false
- true
- Unicode
-
-
- Application
- false
- true
- Unicode
- Windows7.1SDK
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
- true
-
-
- false
-
-
- false
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- ../../include
-
-
- Console
- true
- NotSet
- kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
- Debug
-
-
- false
-
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- ../../include
-
-
- Console
- true
- NotSet
- kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
- Debug
-
-
- false
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- ../../include
-
-
- Console
- true
- true
- true
- Release
- kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- ../../include
-
-
- Console
- true
- true
- true
- Release
- %(AdditionalDependencies);
-
-
-
-
-
-
diff --git a/visualc/VS2010/sha2sum.vcxproj b/visualc/VS2010/sha2sum.vcxproj
deleted file mode 100644
index b1afb674d..000000000
--- a/visualc/VS2010/sha2sum.vcxproj
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
- Debug
- Win32
-
-
- Debug
- x64
-
-
- Release
- Win32
-
-
- Release
- x64
-
-
-
-
-
-
-
- {46cf2d25-6a36-4189-b59c-e4815388e554}
- true
-
-
-
- {8C5CF095-A0A4-54FB-0D48-8DF2B7FE4CA5}
- Win32Proj
- sha2sum
-
-
-
- Application
- true
- Unicode
-
-
- Application
- true
- Unicode
-
-
- Application
- false
- true
- Unicode
-
-
- Application
- false
- true
- Unicode
- Windows7.1SDK
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- true
-
-
- true
-
-
- false
-
-
- false
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- ../../include
-
-
- Console
- true
- NotSet
- kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
- Debug
-
-
- false
-
-
-
-
-
-
- Level3
- Disabled
- WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
- ../../include
-
-
- Console
- true
- NotSet
- kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
- Debug
-
-
- false
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- ../../include
-
-
- Console
- true
- true
- true
- Release
- kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
-
-
-
-
- Level3
-
-
- MaxSpeed
- true
- true
- WIN64;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
- ../../include
-
-
- Console
- true
- true
- true
- Release
- %(AdditionalDependencies);
-
-
-
-
-
-