fbrosson | 533407a | 2018-04-04 21:44:29 +0000 | [diff] [blame] | 1 | #!/usr/bin/env perl |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 2 | |
Andres AG | 5121d4b | 2018-04-11 20:35:19 -0500 | [diff] [blame] | 3 | # Generate main file, individual apps and solution files for MS Visual Studio |
| 4 | # 2010 |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 5 | # |
Manuel Pégourié-Gonnard | 813e585 | 2015-01-26 15:42:27 +0000 | [diff] [blame] | 6 | # Must be run from mbedTLS root or scripts directory. |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 7 | # Takes no argument. |
Bence Szépkúti | 700ee44 | 2020-05-26 00:33:31 +0200 | [diff] [blame] | 8 | # |
Bence Szépkúti | 1e14827 | 2020-08-07 13:07:28 +0200 | [diff] [blame] | 9 | # Copyright The Mbed TLS Contributors |
Bence Szépkúti | c7da1fe | 2020-05-26 01:54:15 +0200 | [diff] [blame] | 10 | # SPDX-License-Identifier: Apache-2.0 |
| 11 | # |
| 12 | # Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 13 | # not use this file except in compliance with the License. |
| 14 | # You may obtain a copy of the License at |
| 15 | # |
| 16 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 17 | # |
| 18 | # Unless required by applicable law or agreed to in writing, software |
| 19 | # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 20 | # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 21 | # See the License for the specific language governing permissions and |
| 22 | # limitations under the License. |
Manuel Pégourié-Gonnard | 684e9dc | 2013-09-20 15:11:44 +0200 | [diff] [blame] | 23 | |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 24 | use warnings; |
| 25 | use strict; |
Manuel Pégourié-Gonnard | 41e8b62 | 2014-05-09 12:27:49 +0200 | [diff] [blame] | 26 | use Digest::MD5 'md5_hex'; |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 27 | |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 28 | my $vsx_dir = "visualc/VS2010"; |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 29 | my $vsx_ext = "vcxproj"; |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 30 | my $vsx_app_tpl_file = "scripts/data_files/vs2010-app-template.$vsx_ext"; |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 31 | my $vsx_main_tpl_file = "scripts/data_files/vs2010-main-template.$vsx_ext"; |
Manuel Pégourié-Gonnard | 813e585 | 2015-01-26 15:42:27 +0000 | [diff] [blame] | 32 | my $vsx_main_file = "$vsx_dir/mbedTLS.$vsx_ext"; |
Manuel Pégourié-Gonnard | 0598faf | 2014-05-09 12:56:03 +0200 | [diff] [blame] | 33 | my $vsx_sln_tpl_file = "scripts/data_files/vs2010-sln-template.sln"; |
Manuel Pégourié-Gonnard | 813e585 | 2015-01-26 15:42:27 +0000 | [diff] [blame] | 34 | my $vsx_sln_file = "$vsx_dir/mbedTLS.sln"; |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 35 | |
| 36 | my $programs_dir = 'programs'; |
Darryl Green | 588e8cb | 2018-07-20 13:27:58 +0100 | [diff] [blame] | 37 | my $mbedtls_header_dir = 'include/mbedtls'; |
| 38 | my $psa_header_dir = 'include/psa'; |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 39 | my $source_dir = 'library'; |
Ronald Cron | 8dc0af2 | 2020-06-05 16:00:22 +0200 | [diff] [blame] | 40 | my $test_source_dir = 'tests/src'; |
| 41 | my $test_header_dir = 'tests/include/test'; |
Steven Cooreman | 0d7c64d | 2020-09-07 16:17:55 +0200 | [diff] [blame] | 42 | my $test_drivers_header_dir = 'tests/include/test/drivers'; |
Steven Cooreman | 16141ed | 2021-04-08 10:58:33 +0200 | [diff] [blame] | 43 | my $test_drivers_source_dir = 'tests/src/drivers'; |
Gilles Peskine | 13fac98 | 2020-02-12 20:34:22 +0100 | [diff] [blame] | 44 | |
| 45 | my @thirdparty_header_dirs = qw( |
| 46 | 3rdparty/everest/include/everest |
| 47 | ); |
| 48 | my @thirdparty_source_dirs = qw( |
| 49 | 3rdparty/everest/library |
| 50 | 3rdparty/everest/library/kremlib |
| 51 | 3rdparty/everest/library/legacy |
| 52 | ); |
Gilles Peskine | b41f88f | 2020-02-12 20:45:18 +0100 | [diff] [blame] | 53 | |
Gilles Peskine | 7156d8c | 2020-02-19 20:08:44 +0100 | [diff] [blame] | 54 | # Directories to add to the include path. |
| 55 | # Order matters in case there are files with the same name in more than |
| 56 | # one directory: the compiler will use the first match. |
| 57 | my @include_directories = qw( |
| 58 | include |
| 59 | 3rdparty/everest/include/ |
| 60 | 3rdparty/everest/include/everest |
| 61 | 3rdparty/everest/include/everest/vs2010 |
| 62 | 3rdparty/everest/include/everest/kremlib |
Ronald Cron | 8dc0af2 | 2020-06-05 16:00:22 +0200 | [diff] [blame] | 63 | tests/include |
Gilles Peskine | 7156d8c | 2020-02-19 20:08:44 +0100 | [diff] [blame] | 64 | ); |
| 65 | my $include_directories = join(';', map {"../../$_"} @include_directories); |
| 66 | |
Gilles Peskine | 66c3dc4 | 2020-06-03 02:25:17 +0200 | [diff] [blame] | 67 | # Directories to add to the include path when building the library, but not |
| 68 | # when building tests or applications. |
| 69 | my @library_include_directories = qw( |
| 70 | library |
| 71 | ); |
| 72 | my $library_include_directories = |
| 73 | join(';', map {"../../$_"} (@library_include_directories, |
| 74 | @include_directories)); |
| 75 | |
Gilles Peskine | b41f88f | 2020-02-12 20:45:18 +0100 | [diff] [blame] | 76 | my @excluded_files = qw( |
Gilles Peskine | 13fac98 | 2020-02-12 20:34:22 +0100 | [diff] [blame] | 77 | 3rdparty/everest/library/Hacl_Curve25519.c |
| 78 | ); |
Gilles Peskine | b41f88f | 2020-02-12 20:45:18 +0100 | [diff] [blame] | 79 | my %excluded_files = (); |
| 80 | foreach (@excluded_files) { $excluded_files{$_} = 1 } |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 81 | |
| 82 | # Need windows line endings! |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 83 | my $vsx_hdr_tpl = <<EOT; |
Manuel Pégourié-Gonnard | cd8f844 | 2014-05-08 12:53:58 +0200 | [diff] [blame] | 84 | <ClInclude Include="..\\..\\{NAME}" />\r |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 85 | EOT |
| 86 | my $vsx_src_tpl = <<EOT; |
Manuel Pégourié-Gonnard | cd8f844 | 2014-05-08 12:53:58 +0200 | [diff] [blame] | 87 | <ClCompile Include="..\\..\\{NAME}" />\r |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 88 | EOT |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 89 | |
Manuel Pégourié-Gonnard | 0598faf | 2014-05-09 12:56:03 +0200 | [diff] [blame] | 90 | my $vsx_sln_app_entry_tpl = <<EOT; |
| 91 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "{APPNAME}", "{APPNAME}.vcxproj", "{GUID}"\r |
| 92 | ProjectSection(ProjectDependencies) = postProject\r |
| 93 | {46CF2D25-6A36-4189-B59C-E4815388E554} = {46CF2D25-6A36-4189-B59C-E4815388E554}\r |
| 94 | EndProjectSection\r |
| 95 | EndProject\r |
| 96 | EOT |
| 97 | |
| 98 | my $vsx_sln_conf_entry_tpl = <<EOT; |
| 99 | {GUID}.Debug|Win32.ActiveCfg = Debug|Win32\r |
| 100 | {GUID}.Debug|Win32.Build.0 = Debug|Win32\r |
| 101 | {GUID}.Debug|x64.ActiveCfg = Debug|x64\r |
| 102 | {GUID}.Debug|x64.Build.0 = Debug|x64\r |
| 103 | {GUID}.Release|Win32.ActiveCfg = Release|Win32\r |
| 104 | {GUID}.Release|Win32.Build.0 = Release|Win32\r |
| 105 | {GUID}.Release|x64.ActiveCfg = Release|x64\r |
| 106 | {GUID}.Release|x64.Build.0 = Release|x64\r |
| 107 | EOT |
| 108 | |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 109 | exit( main() ); |
| 110 | |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 111 | sub check_dirs { |
Gilles Peskine | 13fac98 | 2020-02-12 20:34:22 +0100 | [diff] [blame] | 112 | foreach my $d (@thirdparty_header_dirs, @thirdparty_source_dirs) { |
| 113 | if (not (-d $d)) { return 0; } |
| 114 | } |
Manuel Pégourié-Gonnard | 51f14be | 2015-05-14 13:04:03 +0200 | [diff] [blame] | 115 | return -d $vsx_dir |
Darryl Green | 588e8cb | 2018-07-20 13:27:58 +0100 | [diff] [blame] | 116 | && -d $mbedtls_header_dir |
| 117 | && -d $psa_header_dir |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 118 | && -d $source_dir |
Ronald Cron | 8dc0af2 | 2020-06-05 16:00:22 +0200 | [diff] [blame] | 119 | && -d $test_source_dir |
Steven Cooreman | 16141ed | 2021-04-08 10:58:33 +0200 | [diff] [blame] | 120 | && -d $test_drivers_source_dir |
Ronald Cron | 8dc0af2 | 2020-06-05 16:00:22 +0200 | [diff] [blame] | 121 | && -d $test_header_dir |
Steven Cooreman | a70d588 | 2020-07-16 20:26:18 +0200 | [diff] [blame] | 122 | && -d $test_drivers_header_dir |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 123 | && -d $programs_dir; |
| 124 | } |
| 125 | |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 126 | sub slurp_file { |
| 127 | my ($filename) = @_; |
| 128 | |
| 129 | local $/ = undef; |
| 130 | open my $fh, '<', $filename or die "Could not read $filename\n"; |
| 131 | my $content = <$fh>; |
| 132 | close $fh; |
| 133 | |
| 134 | return $content; |
| 135 | } |
| 136 | |
Manuel Pégourié-Gonnard | 411f73e | 2014-05-09 13:00:18 +0200 | [diff] [blame] | 137 | sub content_to_file { |
| 138 | my ($content, $filename) = @_; |
| 139 | |
| 140 | open my $fh, '>', $filename or die "Could not write to $filename\n"; |
| 141 | print $fh $content; |
| 142 | close $fh; |
| 143 | } |
| 144 | |
Manuel Pégourié-Gonnard | 41e8b62 | 2014-05-09 12:27:49 +0200 | [diff] [blame] | 145 | sub gen_app_guid { |
| 146 | my ($path) = @_; |
| 147 | |
Manuel Pégourié-Gonnard | 813e585 | 2015-01-26 15:42:27 +0000 | [diff] [blame] | 148 | my $guid = md5_hex( "mbedTLS:$path" ); |
Manuel Pégourié-Gonnard | 41e8b62 | 2014-05-09 12:27:49 +0200 | [diff] [blame] | 149 | $guid =~ s/(.{8})(.{4})(.{4})(.{4})(.{12})/\U{$1-$2-$3-$4-$5}/; |
| 150 | |
| 151 | return $guid; |
| 152 | } |
| 153 | |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 154 | sub gen_app { |
| 155 | my ($path, $template, $dir, $ext) = @_; |
| 156 | |
Manuel Pégourié-Gonnard | 41e8b62 | 2014-05-09 12:27:49 +0200 | [diff] [blame] | 157 | my $guid = gen_app_guid( $path ); |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 158 | $path =~ s!/!\\!g; |
| 159 | (my $appname = $path) =~ s/.*\\//; |
| 160 | |
Gilles Peskine | 0f3f9c3 | 2020-04-01 13:34:50 +0200 | [diff] [blame] | 161 | my $srcs = "<ClCompile Include=\"..\\..\\programs\\$path.c\" \/>"; |
Andres Amaya Garcia | c84a65d | 2018-10-30 21:46:21 +0000 | [diff] [blame] | 162 | if( $appname eq "ssl_client2" or $appname eq "ssl_server2" or |
| 163 | $appname eq "query_compile_time_config" ) { |
Gilles Peskine | 0f3f9c3 | 2020-04-01 13:34:50 +0200 | [diff] [blame] | 164 | $srcs .= "\r\n <ClCompile Include=\"..\\..\\programs\\test\\query_config.c\" \/>"; |
Andres Amaya Garcia | c84a65d | 2018-10-30 21:46:21 +0000 | [diff] [blame] | 165 | } |
Gilles Peskine | a3ed34f | 2021-01-05 21:11:16 +0100 | [diff] [blame] | 166 | if( $appname eq "ssl_client2" or $appname eq "ssl_server2" ) { |
| 167 | $srcs .= "\r\n <ClCompile Include=\"..\\..\\programs\\ssl\\ssl_test_lib.c\" \/>"; |
| 168 | } |
Andres Amaya Garcia | c84a65d | 2018-10-30 21:46:21 +0000 | [diff] [blame] | 169 | |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 170 | my $content = $template; |
Andres Amaya Garcia | c84a65d | 2018-10-30 21:46:21 +0000 | [diff] [blame] | 171 | $content =~ s/<SOURCES>/$srcs/g; |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 172 | $content =~ s/<APPNAME>/$appname/g; |
Manuel Pégourié-Gonnard | 41e8b62 | 2014-05-09 12:27:49 +0200 | [diff] [blame] | 173 | $content =~ s/<GUID>/$guid/g; |
Gilles Peskine | d362d0b | 2020-02-26 14:32:42 +0100 | [diff] [blame] | 174 | $content =~ s/INCLUDE_DIRECTORIES\r\n/$include_directories/g; |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 175 | |
Manuel Pégourié-Gonnard | 411f73e | 2014-05-09 13:00:18 +0200 | [diff] [blame] | 176 | content_to_file( $content, "$dir/$appname.$ext" ); |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | sub get_app_list { |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 180 | my $app_list = `cd $programs_dir && make list`; |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 181 | die "make list failed: $!\n" if $?; |
| 182 | |
| 183 | return split /\s+/, $app_list; |
| 184 | } |
| 185 | |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 186 | sub gen_app_files { |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 187 | my @app_list = @_; |
| 188 | |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 189 | my $vsx_tpl = slurp_file( $vsx_app_tpl_file ); |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 190 | |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 191 | for my $app ( @app_list ) { |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 192 | gen_app( $app, $vsx_tpl, $vsx_dir, $vsx_ext ); |
| 193 | } |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 194 | } |
| 195 | |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 196 | sub gen_entry_list { |
Manuel Pégourié-Gonnard | cd8f844 | 2014-05-08 12:53:58 +0200 | [diff] [blame] | 197 | my ($tpl, @names) = @_; |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 198 | |
| 199 | my $entries; |
Manuel Pégourié-Gonnard | cd8f844 | 2014-05-08 12:53:58 +0200 | [diff] [blame] | 200 | for my $name (@names) { |
| 201 | (my $entry = $tpl) =~ s/{NAME}/$name/g; |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 202 | $entries .= $entry; |
| 203 | } |
| 204 | |
| 205 | return $entries; |
| 206 | } |
| 207 | |
| 208 | sub gen_main_file { |
Gilles Peskine | b41f88f | 2020-02-12 20:45:18 +0100 | [diff] [blame] | 209 | my ($headers, $sources, |
| 210 | $hdr_tpl, $src_tpl, |
| 211 | $main_tpl, $main_out) = @_; |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 212 | |
Gilles Peskine | b41f88f | 2020-02-12 20:45:18 +0100 | [diff] [blame] | 213 | my $header_entries = gen_entry_list( $hdr_tpl, @$headers ); |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 214 | my $source_entries = gen_entry_list( $src_tpl, @$sources ); |
| 215 | |
| 216 | my $out = slurp_file( $main_tpl ); |
| 217 | $out =~ s/SOURCE_ENTRIES\r\n/$source_entries/m; |
| 218 | $out =~ s/HEADER_ENTRIES\r\n/$header_entries/m; |
Gilles Peskine | 66c3dc4 | 2020-06-03 02:25:17 +0200 | [diff] [blame] | 219 | $out =~ s/INCLUDE_DIRECTORIES\r\n/$library_include_directories/g; |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 220 | |
Manuel Pégourié-Gonnard | 411f73e | 2014-05-09 13:00:18 +0200 | [diff] [blame] | 221 | content_to_file( $out, $main_out ); |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 222 | } |
| 223 | |
Manuel Pégourié-Gonnard | 0598faf | 2014-05-09 12:56:03 +0200 | [diff] [blame] | 224 | sub gen_vsx_solution { |
| 225 | my (@app_names) = @_; |
| 226 | |
| 227 | my ($app_entries, $conf_entries); |
| 228 | for my $path (@app_names) { |
| 229 | my $guid = gen_app_guid( $path ); |
| 230 | (my $appname = $path) =~ s!.*/!!; |
| 231 | |
| 232 | my $app_entry = $vsx_sln_app_entry_tpl; |
| 233 | $app_entry =~ s/{APPNAME}/$appname/g; |
| 234 | $app_entry =~ s/{GUID}/$guid/g; |
| 235 | |
| 236 | $app_entries .= $app_entry; |
| 237 | |
| 238 | my $conf_entry = $vsx_sln_conf_entry_tpl; |
| 239 | $conf_entry =~ s/{GUID}/$guid/g; |
| 240 | |
| 241 | $conf_entries .= $conf_entry; |
| 242 | } |
| 243 | |
| 244 | my $out = slurp_file( $vsx_sln_tpl_file ); |
| 245 | $out =~ s/APP_ENTRIES\r\n/$app_entries/m; |
| 246 | $out =~ s/CONF_ENTRIES\r\n/$conf_entries/m; |
| 247 | |
Manuel Pégourié-Gonnard | 411f73e | 2014-05-09 13:00:18 +0200 | [diff] [blame] | 248 | content_to_file( $out, $vsx_sln_file ); |
Manuel Pégourié-Gonnard | 0598faf | 2014-05-09 12:56:03 +0200 | [diff] [blame] | 249 | } |
| 250 | |
Andres Amaya Garcia | 3c5f949 | 2018-01-11 19:51:27 +0000 | [diff] [blame] | 251 | sub del_vsx_files { |
| 252 | unlink glob "'$vsx_dir/*.$vsx_ext'"; |
| 253 | unlink $vsx_main_file; |
| 254 | unlink $vsx_sln_file; |
| 255 | } |
| 256 | |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 257 | sub main { |
| 258 | if( ! check_dirs() ) { |
| 259 | chdir '..' or die; |
Manuel Pégourié-Gonnard | 813e585 | 2015-01-26 15:42:27 +0000 | [diff] [blame] | 260 | check_dirs or die "Must but run from mbedTLS root or scripts dir\n"; |
Manuel Pégourié-Gonnard | 2d34fe3 | 2014-05-07 17:51:20 +0200 | [diff] [blame] | 261 | } |
| 262 | |
Andres Amaya Garcia | 3c5f949 | 2018-01-11 19:51:27 +0000 | [diff] [blame] | 263 | # Remove old files to ensure that, for example, project files from deleted |
| 264 | # apps are not kept |
| 265 | del_vsx_files(); |
| 266 | |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 267 | my @app_list = get_app_list(); |
Gilles Peskine | b41f88f | 2020-02-12 20:45:18 +0100 | [diff] [blame] | 268 | my @header_dirs = ( |
| 269 | $mbedtls_header_dir, |
| 270 | $psa_header_dir, |
Ronald Cron | 8dc0af2 | 2020-06-05 16:00:22 +0200 | [diff] [blame] | 271 | $test_header_dir, |
Steven Cooreman | a70d588 | 2020-07-16 20:26:18 +0200 | [diff] [blame] | 272 | $test_drivers_header_dir, |
Gilles Peskine | b41f88f | 2020-02-12 20:45:18 +0100 | [diff] [blame] | 273 | $source_dir, |
| 274 | @thirdparty_header_dirs, |
| 275 | ); |
| 276 | my @headers = (map { <$_/*.h> } @header_dirs); |
| 277 | my @source_dirs = ( |
| 278 | $source_dir, |
Ronald Cron | 8dc0af2 | 2020-06-05 16:00:22 +0200 | [diff] [blame] | 279 | $test_source_dir, |
Steven Cooreman | 16141ed | 2021-04-08 10:58:33 +0200 | [diff] [blame] | 280 | $test_drivers_source_dir, |
Gilles Peskine | b41f88f | 2020-02-12 20:45:18 +0100 | [diff] [blame] | 281 | @thirdparty_source_dirs, |
| 282 | ); |
| 283 | my @sources = (map { <$_/*.c> } @source_dirs); |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 284 | |
Gilles Peskine | b41f88f | 2020-02-12 20:45:18 +0100 | [diff] [blame] | 285 | @headers = grep { ! $excluded_files{$_} } @headers; |
| 286 | @sources = grep { ! $excluded_files{$_} } @sources; |
| 287 | map { s!/!\\!g } @headers; |
| 288 | map { s!/!\\!g } @sources; |
Christoph M. Wintersteiger | 48d26c2 | 2018-12-06 18:59:19 +0000 | [diff] [blame] | 289 | |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 290 | gen_app_files( @app_list ); |
Manuel Pégourié-Gonnard | 0aafa5c | 2014-05-08 11:33:30 +0200 | [diff] [blame] | 291 | |
Gilles Peskine | b41f88f | 2020-02-12 20:45:18 +0100 | [diff] [blame] | 292 | gen_main_file( \@headers, \@sources, |
| 293 | $vsx_hdr_tpl, $vsx_src_tpl, |
| 294 | $vsx_main_tpl_file, $vsx_main_file ); |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 295 | |
Manuel Pégourié-Gonnard | 0598faf | 2014-05-09 12:56:03 +0200 | [diff] [blame] | 296 | gen_vsx_solution( @app_list ); |
Manuel Pégourié-Gonnard | cd8f844 | 2014-05-08 12:53:58 +0200 | [diff] [blame] | 297 | |
Manuel Pégourié-Gonnard | 1b57878 | 2013-09-16 13:33:42 +0200 | [diff] [blame] | 298 | return 0; |
| 299 | } |