On 25 Jan 2010, at 5:51 pm, erik quanstrom wrote:

On Mon Jan 25 10:00:19 EST 2010, lyn...@orthanc.ca wrote:
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.

x86 assembly doesn't often assemble with an
arm assembler.  :-)

- erik


Heh. :)

P9P uses a separate file for each arch: plan9/src/libthread/$os-$arch.s

Inferno uses a separate dir. Some of the dirs have C code instead since the asm is only an optimisation in this case.

I'd put a test in the mkfile: if cpuid-$objtype exists build that, else.. well, either error out or build cpuid-port.c which in turn either emits an error at runtime or perhaps more usefully outputs the contents of #P/cputype.


--
http://xkcd.com/676/

Ethan Grammatikidis
eeke...@fastmail.fm




Reply via email to