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