summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2008-09-09 09:54:03 -0700
committerH. Peter Anvin <hpa@zytor.com>2008-09-09 09:54:03 -0700
commit49039ab636449017677cafca6549ca5c4ddf943c (patch)
treeb118175d808412b1cfcf8fbe3c0dc8de9e2af7d1
parent5618e0063d205ff1214ac5291f24b857144bf950 (diff)
downloadnasm-49039ab636449017677cafca6549ca5c4ddf943c.tar.gz
macros.pl: don't include macros for disabled output formats
Don't include macros for output formats we aren't compiling in. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rwxr-xr-xmacros.pl17
1 files changed, 13 insertions, 4 deletions
diff --git a/macros.pl b/macros.pl
index 165d09f7..dd9c9618 100755
--- a/macros.pl
+++ b/macros.pl
@@ -47,7 +47,9 @@ print OUT "\n";
print OUT "#include \"tables.h\"\n";
print OUT "#include \"nasmlib.h\"\n";
print OUT "#include \"hashtbl.h\"\n";
+print OUT "#include \"outform.h\"\n";
print OUT "\n";
+print OUT "#if 1\n";
print OUT "const unsigned char nasm_stdmac[] = {";
my $npkg = 0;
@@ -71,9 +73,15 @@ foreach $fname ( @ARGV ) {
undef $pkg;
my @out_alias = split(/\s+/, $1);
printf OUT " /* %4d */ 0\n", $index++;
- print OUT "};\n";
+ print OUT "};\n#endif\n";
$index = 0;
- printf OUT "const unsigned char %s_stdmac[] = {\n", $out_alias[0];
+ print OUT "\n";
+ my $pfx = '#if';
+ foreach my $al (@out_alias) {
+ print OUT $pfx, " defined(OF_\U${al}\E)";
+ $pfx = ' ||';
+ }
+ printf OUT "\nconst unsigned char %s_stdmac[] = {\n", $out_alias[0];
print OUT " /* From $fname */\n";
$lastname = $fname;
push(@out_list, $out_alias[0]);
@@ -84,8 +92,9 @@ foreach $fname ( @ARGV ) {
die "$0: $fname: duplicate package: $pkg\n";
}
printf OUT " /* %4d */ 0\n", $index++;
- print OUT "};\n";
+ print OUT "};\n#endif\n";
$index = 0;
+ print OUT "\n#if 1\n";
printf OUT "static const unsigned char nasm_stdmac_%s[] = {\n", $pkg;
print OUT " /* From $fname */\n";
$lastname = $fname;
@@ -126,7 +135,7 @@ foreach $fname ( @ARGV ) {
}
close(INPUT);
}
-printf OUT " /* %4d */ 0\n};\n\n", $index++;
+printf OUT " /* %4d */ 0\n};\n#endif\n\n", $index++;
print OUT "const unsigned char * const nasm_stdmac_after_tasm = ",
"&nasm_stdmac[$tasm_count];\n\n";