summaryrefslogtreecommitdiff
path: root/version.pl
blob: fa09e40d006f4606fa039b92696411cc04c1510d (plain)
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
#!/usr/bin/perl
#
# Read the "version" file and produce some macro declarations
#

use Fcntl;

$vfile = $ARGV[0];
sysopen(VERSION, $vfile, O_RDONLY) or die "$0: Cannot open $vfile\n";
$version = <VERSION>;
chomp $version;
close(VERSION);

unless ( $version =~ /^([0-9]+)\.([0-9]+)$/ ) {
    die "$0: Cannot parse version format\n";
}
$vma = $1+0; $vmi = $2+0;

open(VI, "> version.gen") or die "$0: Cannot create version.gen\n";
print VI "%define VERSION \"$version\"\n";
print VI "%define VER_MAJOR $vma\n";
print VI "%define VER_MINOR $vmi\n";
close(VI);