6 # Parse the NASM version file and produce appropriate macros
8 # The NASM version number is assumed to consist of:
10 # <major>.<minor>[.<subminor>]<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_VER -- whole version number as a string
34 if ( $line =~ /^([0-9]+)\.([0-9]+)\.([0-9]+)/ ) {
35 $maj = $1; $nmaj = $maj+0;
36 $min = $2; $nmin = $min+0;
37 $smin = $3; $nsmin = $smin+0;
39 } elsif ( $line =~ /^([0-9]+)\.([0-9]+)/ ) {
40 $maj = $1; $nmaj = $maj+0;
41 $min = $2; $nmin = $min+0;
42 $smin = ''; $nsmin = 0;
45 die "$0: Invalid input format\n";
49 print "#ifndef NASM_VERSION_H\n";
50 print "#define NASM_VERSION_H\n";
51 printf "#define NASM_MAJOR_VER %d\n", $nmaj;
52 printf "#define NASM_MINOR_VER %d\n", $nmin;
53 printf "#define NASM_SUBMINOR_VER %d\n", $nsmin;
54 printf "#define NASM_VER \"%s\"\n", $line;
55 print "#endif /* NASM_VERSION_H */\n";
56 } elsif ( $what eq 'mac' ) {
57 printf "%%define __NASM_MAJOR__ %d\n", $nmaj;
58 printf "%%define __NASM_MINOR__ %d\n", $nmin;
59 printf "%%define __NASM_SUBMINOR__ %d\n", $nsmin;
60 printf "%%define __NASM_VER__ \"%s\"\n", $line;
62 die "$0: Unknown output: $what\n";