help-make
[Top][All Lists]
Advanced

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

Re: Newbie question - testing for OS. . .


From: bC
Subject: Re: Newbie question - testing for OS. . .
Date: Wed, 20 Dec 2006 21:06:33 -0500

Thanks for the prompt replies, everyone.
  Are you always this way, or was I just lucky?   ;-)

  I made a test Makefile that set variables to the values of various flags
on the uname command.   I'm definitely still 'green'.  I had to use the
'make -n' mode to see the variable assignments without make trying to do
something unknown to me.  But, emboldened with that interesting output, I
attempted to write a 'simple' test Makefile that when read by make would
unzip one file if found to be running under the OS version of FC5...
failing that, unzip a different file.

  To further demonstrate my novice status on all things 'make', observe my
lame test file, whose results are not-what-i-expect-or-wanted.

####################
test:

   osver := $(shell uname -r)
  #osname := $(shell uname -s)
  #cpuarch := $(shell uname -m)
  #youname := $(shell uname -o)
  ifeq ($(osver),2.6.15-1.2054_FC5)
      unzip ksh.zip
  else
      unzip ksh2.zip
  endif
###################


I obviously haven't "caught on" yet.
Lifesavers welcome.

Thanks



>All good points.  I have only to add that uname without arguments will
>give you useful platform information but it may lack any sort of
>pertinent version information.  I find the following to be fairly
>portable and a pretty good way to dial makefile settings to a
>particular platform.
>
>osname := $(shell uname -s)
>osver := $(shell uname -r)
>cpuarch := $(shell uname -m)
>
>Then you can do things like this, for example.
>
>Darwin-8.8.1-i386-CFLAGS := -DMACOSX_X86
>SunOS-5.9-sun4u-CFLAGS := -DSOL9_SPARC
>
>CFLAGS := $($(osname)-$(osver)-$(cpuarch)-CFLAGS)
>
> HTH,
> Ken Smith






reply via email to

[Prev in Thread] Current Thread [Next in Thread]