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>
This commit is contained in:
H. Peter Anvin 2008-09-09 09:54:03 -07:00
parent 5618e0063d
commit 49039ab636

View File

@ -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";