|
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
In the message dated: Wed, 26 Jul 2006 13:47:01 EDT,
The pithy ruminations from Dan Crosta on
<Re: [PLUG] Linux Port> were:
=> Daniel K. Spicer wrote:
=> > If I use 'uname' in the makefile, what's the syntax in the .c files to distinguish between Sol
=> aris and Linux?
=> >
=>
=> I used this:
=>
=> ----
=>
=> # Get this computer's architecture (I686, Power Macintosh, etc.)
=> ARCH = $(shell uname -m | sed s/' '/''/ | tr '[a-z]' '[A-Z]')
=>
=> CFLAGS = [...] -D$(ARCH) [...]
=>
=> ----
=>
=>
=> I was doing work on OS X and Linux, so we got LINUX and POWERMACINTOSH
=> as #define'd constants. Not sure what uname -m will give for solaris,
=> but probably something sensible across different versions, etc.
Um, I don't think that's what you want.
Remember, Solaris runs on X86, and Linux runs on SPARC hardware...so you've got
potential confusion here...
You probably want "uname -s", which returns the OS type. Here's a quick,
un-scientific survey:
Platform uname -s
-------------------- ---------------
x86, linux Linux
sun4u, Solaris SunOS
IP35, Irix IRIX64
x86_64, Linux Linux
x86, NetBSD NetBSD
Note that Solaris is a subset of SunOS, as far as uname is concerned...I don't
have a machine running SunOS available to test what "uname -s" returns there...
This will also work (FSVO "work" on Windows machines running Cygwin).
Mark
=>
=> - d
=> ___________________________________________________________________________
-----
Mark Bergman Biker, Rock Climber, Unix mechanic, IATSE #1 Stagehand
http://wwwkeys.pgp.net:11371/pks/lookup?op=get&search=bergman%40merctech.com
I want a newsgroup with a infinite S/N ratio! Now taking CFV on:
rec.motorcycles.stagehands.pet-bird-owners.pinballers.unix-supporters
15+ So Far--Want to join? Check out: http://www.panix.com/~bergman
___________________________________________________________________________
Philadelphia Linux Users Group -- http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug
|
|