]> www.fi.muni.cz Git - scxreader.git/blob - version.pl
Added licensing information.
[scxreader.git] / version.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4 use POSIX qw(strftime);
5
6 my $git = `git rev-parse --short HEAD`;
7 chomp $git;
8
9 my $now = strftime('%Y%m%d', localtime(time));
10
11 print <<EOF;
12 /* DO NOT EDIT - GENERATED BY $0 */
13
14 unsigned char version[] = {
15 EOF
16
17 print hex2c($now, "date");
18 print hex2c($git, "git revision");
19
20 print "};\n\nunsigned char version_len = 8;\n";
21 print "\n/* EOF - this file has not been truncated */\n\n";
22
23 sub hex2c {
24         my ($data, $comment) = @_;
25
26         my $data1 = $data;
27         $data1 .= '0' if (length($data1) & 1 == 1);
28         $data1 =~ s/(..)/0x$1, /g;
29         return "\t$data1 /* $comment $data */\n";
30 }
31