diff options
| author | hathach <[email protected]> | 2018-03-06 19:14:01 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-03-06 19:14:01 +0700 |
| commit | 4dc917c9ba8b746a4e5ce1934af019840bd20355 (patch) | |
| tree | 5c8d270f36a6c38e98a64a991de54270e5a2d3f0 /examples/keil_output_folder.pl | |
| parent | fce85875c49a7d18115c4f0c2cf91d7f8e5df9d9 (diff) | |
rename demo to examples
Diffstat (limited to 'examples/keil_output_folder.pl')
| -rw-r--r-- | examples/keil_output_folder.pl | 37 |
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 |
