9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] Finding the object suffix
@ 2004-03-25 10:53 Nils M Holm
  2004-03-25 11:57 ` David Presotto
  0 siblings, 1 reply; 3+ messages in thread
From: Nils M Holm @ 2004-03-25 10:53 UTC (permalink / raw)
  To: 9fans


I am currently writing an rc script that needs to know the
object suffix of the architecture it is running on. Would
the following code reliably return this suffix, or is there
a better way?

grep '^O=.$' /$objtype/mkfile | sed -e 's/O=//'

Thanks,

Nils.

-- 
Nils M Holm <nmh@t3x.org> -- http://www.t3x.org/nmh/


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] Finding the object suffix
  2004-03-25 10:53 [9fans] Finding the object suffix Nils M Holm
@ 2004-03-25 11:57 ` David Presotto
  2004-03-26  7:14   ` Nils M Holm
  0 siblings, 1 reply; 3+ messages in thread
From: David Presotto @ 2004-03-25 11:57 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 220 bytes --]

first of all, $objtype is the target to compile for, not the type 
of the local cpu.  You at least need to look at $cputype.

The following would do it with one less process:
	sed -n 's/^O=(.*)/\1/p' /$cputype/mkfile

[-- Attachment #2: Type: message/rfc822, Size: 2534 bytes --]

From: Nils M Holm <nmh@t3x.org>
To: 9fans@cse.psu.edu
Subject: [9fans] Finding the object suffix
Date: Thu, 25 Mar 2004 11:53:55 +0100
Message-ID: <2004032510535500-74837@Symmetry.UUCP>


I am currently writing an rc script that needs to know the
object suffix of the architecture it is running on. Would
the following code reliably return this suffix, or is there
a better way?

grep '^O=.$' /$objtype/mkfile | sed -e 's/O=//'

Thanks,

Nils.

-- 
Nils M Holm <nmh@t3x.org> -- http://www.t3x.org/nmh/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] Finding the object suffix
  2004-03-25 11:57 ` David Presotto
@ 2004-03-26  7:14   ` Nils M Holm
  0 siblings, 0 replies; 3+ messages in thread
From: Nils M Holm @ 2004-03-26  7:14 UTC (permalink / raw)
  To: 9fans

On 2004-03-25, David Presotto wrote:
> first of all, $objtype is the target to compile for, not the type 
> of the local cpu.  You at least need to look at $cputype.

I see. I think my explanation was a bit fuzzy, so I will try
again. My script runs a compiler that compiles to C. It then
has to invoke the proper C compiler and loader to create a
program that can be run in the window the compiler was started
in. I currently use

$O^c -Dplan9 $file.c
$O^l $file.$O

where $O is the object suffix found. I want the compiler driver
to make a good guess on $O, so that the resulting code can run
on both terminals and CPU servers (of course not at the same time
in case the CPU types differ).

> The following would do it with one less process:
> 	sed -n 's/^O=(.*)/\1/p' /$cputype/mkfile

Yes, thanks.

Nils.

-- 
Nils M Holm <nmh@t3x.org> -- http://www.t3x.org/nmh/


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-03-26  7:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-03-25 10:53 [9fans] Finding the object suffix Nils M Holm
2004-03-25 11:57 ` David Presotto
2004-03-26  7:14   ` Nils M Holm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).