Last change
on this file was
e16e8f2,
checked in by Edwin Eefting <edwin@datux.nl>, 3 years ago
|
bootstuff
|
-
Property mode set to
100755
|
File size:
927 bytes
|
Rev | Line | |
---|
[e16e8f2] | 1 | #!/usr/bin/perl |
---|
| 2 | # |
---|
| 3 | # Read the "version" file and produce some macro declarations |
---|
| 4 | # |
---|
| 5 | |
---|
| 6 | use Fcntl; |
---|
| 7 | |
---|
| 8 | sub defx($$$) { |
---|
| 9 | my($def, $name, $val) = @_; |
---|
| 10 | |
---|
| 11 | $def =~ s/\</${name}/g; |
---|
| 12 | $def =~ s/\@/${val}/g; |
---|
| 13 | |
---|
| 14 | return $def."\n"; |
---|
| 15 | } |
---|
| 16 | |
---|
| 17 | ($vfile, $vout, $def) = @ARGV; |
---|
| 18 | sysopen(VERSION, $vfile, O_RDONLY) or die "$0: Cannot open $vfile\n"; |
---|
| 19 | $vfile = <VERSION>; |
---|
| 20 | chomp $vfile; |
---|
| 21 | close(VERSION); |
---|
| 22 | |
---|
| 23 | unless ( $vfile =~ /^(([0-9]+)\.([0-9]+))\s+([0-9]+)$/ ) { |
---|
| 24 | die "$0: Cannot parse version format\n"; |
---|
| 25 | } |
---|
| 26 | $version = $1; |
---|
| 27 | $vma = $2+0; |
---|
| 28 | $vmi = $3+0; |
---|
| 29 | $year = $4; |
---|
| 30 | |
---|
| 31 | sysopen(VI, $vout, O_WRONLY|O_CREAT|O_TRUNC) |
---|
| 32 | or die "$0: Cannot create $vout: $!\n"; |
---|
| 33 | print VI defx($def, 'VERSION', $version); |
---|
| 34 | print VI defx($def, 'VERSION_STR', '"'.$version.'"'); |
---|
| 35 | print VI defx($def, 'VERSION_MAJOR', $vma); |
---|
| 36 | print VI defx($def, 'VERSION_MINOR', $vmi); |
---|
| 37 | print VI defx($def, 'YEAR', $year); |
---|
| 38 | print VI defx($def, 'YEAR_STR', '"'.$year.'"'); |
---|
| 39 | close(VI); |
---|
Note: See
TracBrowser
for help on using the repository browser.