5 # Parse the NASM version file and produce appropriate macros
7 # The NASM version number is assumed to consist of:
9 # <major>.<minor>[.<subminor>][pl<patchlevel>]]<tail>
11 # ... where <tail> is not necessarily numeric.
13 # This defines the following macros:
18 # NASM_SUBMINOR_VER -- this is zero if no subminor
19 # NASM_PATCHLEVEL_VER -- this is zero is no patchlevel
20 # NASM_VERSION_ID -- version number encoded
21 # NASM_VER -- whole version number as a string
37 undef $man, $min, $smin, $plvl, $tail;
39 if ( $line =~ /^([0-9]+)\.([0-9]+)/ ) {
43 if ( $tail =~ /^\.([0-9]+)/ ) {
47 if ( $tail =~ /^(pl|\.)([0-9]+)/ ) {
52 die "$0: Invalid input format\n";
55 $nmaj = $maj+0; $nmin = $min+0;
56 $nsmin = $smin+0; $nplvl = $plvl+0;
58 $nasm_id = ($nmaj << 24)+($nmin << 16)+($nsmin << 8)+$nplvl;
61 print "#ifndef NASM_VERSION_H\n";
62 print "#define NASM_VERSION_H\n";
63 printf "#define NASM_MAJOR_VER %d\n", $nmaj;
64 printf "#define NASM_MINOR_VER %d\n", $nmin;
65 printf "#define NASM_SUBMINOR_VER %d\n", $nsmin;
66 printf "#define NASM_PATCHLEVEL_VER %d\n", $nplvl;
67 printf "#define NASM_VERSION_ID 0x%08x\n", $nasm_id;
68 printf "#define NASM_VER \"%s\"\n", $line;
69 print "#endif /* NASM_VERSION_H */\n";
70 } elsif ( $what eq 'mac
' ) {
71 printf "%%define __NASM_MAJOR__ %d\n", $nmaj;
72 printf "%%define __NASM_MINOR__ %d\n", $nmin;
73 printf "%%define __NASM_SUBMINOR__ %d\n", $nsmin;
74 printf "%%define __NASM_PATCHLEVEL__ %d\n", $nplvl;
75 printf "%%define __NASM_VERSION_ID__ 0%08Xh\n", $nasm_id;
76 printf "%%define __NASM_VER__ \"%s\"\n", $line;
77 } elsif ( $what eq 'id
' ) {
78 print $nasm_id, "\n"; # Print ID in decimal
79 } elsif ( $what eq 'xid
' ) {
80 printf "0x%08x\n", $nasm_id; # Print ID in hexadecimal
82 die "$0: Unknown output: $what\n";