Dan Crosta on 26 Jul 2006 17:48:33 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Linux Port


Daniel K. Spicer wrote:
If I use 'uname' in the makefile, what's the syntax in the .c files to distinguish between Solaris 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.


- d
___________________________________________________________________________
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