-
Notifications
You must be signed in to change notification settings - Fork 2
/
mkversion
executable file
·48 lines (34 loc) · 828 Bytes
/
mkversion
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/perl
# Holy cow! A perl script!!
# usage: mkversion -ihexapod_version -v$(shell cat VERSION) >version.c
# ./mkversion -ikyu_version -v$(VERSION) >version.c
$ident = "kyu_version";
$vernum = "";
$board = "";
$user = `whoami`;
chomp $user;
$board = `readlink board`;
chomp $board;
$vernum = `cat VERSION`;
chomp $vernum;
# Command line arguments, -v and -i
while ( $_ = $ARGV[0] ) {
last unless /^-/;
shift;
($ident = $_) =~ s/^..// if /^-i/;
($vernum = $_) =~ s/^..// if /^-v/;
}
$ident = "kyu_version" if ( $ident eq "" );
$vernum = "0.0" if ( $vernum eq "" );
$board = "VME" if ( $board eq "" );
$date = `date`;
chomp $date;
print <<EOF;
/* version.c
*/
EOF
print "char \*$ident";
print " = \"version $vernum for $board, Compiled by $user: $date\"\;\n";
print <<EOF;
/* THE END */
EOF