X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?p=tinyboard.git;a=blobdiff_plain;f=projects%2Fstep-up%2Fversion.pl;fp=projects%2Fstep-up%2Fversion.pl;h=cb4ecc7e90ea358c8af150042319a3684ac7e5d2;hp=0000000000000000000000000000000000000000;hb=49420b56b31e113f4c40128c530f2e585a9f8061;hpb=d09c1dcb07782f32226fc5ab591dc2a40e8bb3fe diff --git a/projects/step-up/version.pl b/projects/step-up/version.pl new file mode 100755 index 0000000..cb4ecc7 --- /dev/null +++ b/projects/step-up/version.pl @@ -0,0 +1,32 @@ +#!/usr/bin/perl -w + +use strict; +use POSIX qw(strftime); + +my $git = `git rev-parse --short HEAD`; +chomp $git; + +my $now = strftime('%Y%m%d', localtime(time)); + +print < + +unsigned char version[] EEMEM = { +EOF + +print hex2c($git, "git revision"); +print hex2c($now, "date"); + +print "};\n\n/* EOF - this file has not been truncated */\n\n"; + +sub hex2c { + my ($data, $comment) = @_; + + my $data1 = $data; + $data1 .= '0' if (length($data1) & 1 == 1); + $data1 =~ s/(..)/0x$1, /g; + return "\t$data1 /* $comment $data */\n"; +} +