diff g23m/system/busyb/tools/make_ver.pl @ 0:509db1a7b7b8

initial import: leo2moko-r1
author Space Falcon <falcon@ivan.Harhan.ORG>
date Mon, 01 Jun 2015 03:24:05 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/g23m/system/busyb/tools/make_ver.pl	Mon Jun 01 03:24:05 2015 +0000
@@ -0,0 +1,52 @@
+$argcount = @ARGV;
+if ($argcount < 2)
+{
+  die "Usage: perl make_ver.pl [version_file] [filename]+ \n";
+}
+
+my $outfile=$ARGV[0];
+chomp $outfile;
+my $directory=$ARGV[1];
+chomp $directory;
+
+# convert forslashes to backslashes
+while ($outfile =~ s/\//\\/) {};
+while ($directory =~ s/\//\\/) {};
+
+#open the version file
+open(CFILE,">$outfile")||die "can't create c file for versionning\n";
+
+#
+# extract (last sub) directory name from file name and path
+#
+$directory =~ s|(.*)\\||;
+$directory = $+;
+$directory =~ s|.*\\||;
+$directory=lc($directory);
+
+
+if (system("cleartool -ver 2> NUL") == 0)
+{
+  $view=`cleartool pwv -s`;
+  chomp $view;
+}
+else
+{
+  $view="non_clearcase";
+  chomp $view;
+}
+$user=$ENV{"USERNAME"};
+$view = substr($view.(' ' x 14), 0, 14);
+$user = substr $user, 0, 4;
+$time = time;
+($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime($time);
+if($year >= 100)
+{
+  $year -= 100;
+}
+$time=sprintf ("%02d:%02d:%02d %02d/%02d/%02d",$hour,$min,$sec,$mday,$mon+1,$year);
+$version=$user." ".$view."  ".$time;
+print CFILE"static char* verstring_$directory = \"$directory $version\" ;\n";
+print CFILE"extern char* ${directory}_version(void){\n";
+print CFILE"return verstring_$directory ;}";
+close CFILE;