Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / July 2008



Tip: Looking for answers? Try searching our database.

makefile problem - detecting OS version

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lothar Behrens - 21 Jul 2008 10:15 GMT
Hi,

I have the following makefile snipped that does not work as expected:

OSVERSION=`uname -r`
OSPLATFORM=`uname -p`

#OSVERSION=9.0.0
#OSPLATFORM=ppc

ifeq ($(OSVERSION), 9.0.0)
.                                        # should go here so I could
see the correctness of the detection.
OSNAME=Leopard
else
OSNAME=Panther
endif

But this does not work. I also have tried ´ instead of `.

I am using Mac OS X 10.5 (Leopard) and the XCode tools from the
orginal installation DVD.

Any ideas ?

Thanks

Lothar
Paul Russell - 21 Jul 2008 11:48 GMT
> Hi,
>
[quoted text clipped - 24 lines]
>
> Lothar

I get 9.4.0 for OS X 10.5.4.

Also note that you should not have a space after the comma in the ifeq test.

Paul
David Phillip Oster - 22 Jul 2008 06:42 GMT
> > Hi,
> >
[quoted text clipped - 30 lines]
>
> Paul

on my OS X 10.4.11, uname -v says:
Darwin Kernel Version 8.11.0: Wed Oct 10 18:26:00 PDT 2007;
root:xnu-792.24.17~1/RELEASE_PPC

so, as expected, uname -r says:
8.11.0
Martin Knelleken - 22 Jul 2008 15:11 GMT
Lothar Behrens schrieb:
> Hi,
>
[quoted text clipped - 20 lines]
>
> Any ideas ?

You should use
ifeq ($(shell uname -r),9.0.0)
# ...
else
#...
endif

instead of the ` ` call.

And further I would prefer sw_vers (piped to grep) instead of
uname -r to detect the OS Version.

ifeq ($(shell sw_vers | grep 10.5),)
# for Leopard
else
# for Tiger or less
endif

And last but not least I would use arch instead if uname -p to detect
the architecture

ifeq ($(shell arch),i386)
# Intel stuff
else
# PowerPC
endif

Kind regards

Martin
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.