i have a little program, aux/cpuid, that gets cpuid
information for x86 processors. clearly it's not going
to run on an arm or mips. is there a standard
trick for preventing such a program from being
built (and failing)? the hack i currently have is
objtype=386 as the first line of the mkfile.
Why not make it build everywhere and have it print a diagnostic for
platforms it doesn't support. E.g.
$CC -Darch=''''$objtype'''' ...
(I doubt the quoting is correct, but you get the idea.)
and
int arch;
.
.
.
switch arch {
default: fprint(2, "unknown $objtype\n");
exits("unknown arch"); break;
'k': fprint(2, "unsupported architecture\n");
exits("unsupported arch"); break;
.
.
.
'8': cpuid();
break;
}
This way is can embrace new platforms over time.
--lyndon