summaryrefslogtreecommitdiff
path: root/examples/keil_output_folder.pl
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-03-06 19:14:01 +0700
committerhathach <[email protected]>2018-03-06 19:14:01 +0700
commit4dc917c9ba8b746a4e5ce1934af019840bd20355 (patch)
tree5c8d270f36a6c38e98a64a991de54270e5a2d3f0 /examples/keil_output_folder.pl
parentfce85875c49a7d18115c4f0c2cf91d7f8e5df9d9 (diff)
rename demo to examples
Diffstat (limited to 'examples/keil_output_folder.pl')
-rw-r--r--examples/keil_output_folder.pl37
1 files changed, 37 insertions, 0 deletions
diff --git a/examples/keil_output_folder.pl b/examples/keil_output_folder.pl
new file mode 100644
index 000000000..69afc65e9
--- /dev/null
+++ b/examples/keil_output_folder.pl
@@ -0,0 +1,37 @@
+#!/usr/bin/perl
+
+use File::Spec;
+use File::Find;
+use File::Path;
+use File::Glob;
+use File::stat;
+#use Time::Piece;
+#use Time::Seconds;
+
+$" = "\n"; # change list separator
+@PROJECT_LIST = (<device/device*/*.uvproj>, <host/host*/*.uvproj>);
+print "@PROJECT_LIST";
+
+foreach (@PROJECT_LIST)
+{
+ my $project_file = $_;
+ my $backup_file = $project_file . ".bck";
+
+ rename $project_file, $backup_file or die "cannot rename $project_file to $backup_file";
+
+ open (fin, $backup_file) or die "Can't open $backup_file to read\n";
+ open (fout, ">$project_file") or die "Can't open $project_file to write\n";
+
+ my $target;
+ while (<fin>)
+ {
+ s/(<TargetName>.+) /\1_/; # replace space by underscore in target name if found
+
+ $target = $1 and print $target . "\n" if /<TargetName>(.+)</;
+ my $keil_build = ".\\KeilBuild\\$target\\";
+
+ print "replace $2 by $keil_build\n--> $_\n" if s/(<OutputDirectory>)(.+)</\1$keil_build</ || s/(<ListingPath>)(.+)</\1$keil_build</;
+
+ printf fout;
+ }
+} \ No newline at end of file