Gautam Shejwalkar wrote on 09 September 2008 08:52:

> Hi,
> 
> Is there any internal command or macro available to identify on which
> Linux distribution the make is running. I know one way of finding is to
> run 'unake -r' and then compare it with the know string. But if there is
> any better way or solution which make provides it will great.   

  Nah, there's nothing built in.  A lot of makefiles don't even care what
system they're running on; in the GNU world, configure scripts (specifically
config.guess) work it out and define variables on the make command-line
appropriately; and make is cross-system, so can't assume it's even running on
Linux at all.

  (BTW, you said 'distribution', which means Red hat or Ubuntu or Debian or
whatever, but "uname -r" tells you which kernel version you're running.  I
assume you really mean kernel version rather than distro, so you can take care
of kernel build system and internal ABI differences.)

  So just go ahead and take the simple solution: at the start of your makefile

KERNELVERSION:=$(shell uname -r)

and then use make's string match functions to check what you need to know.
Note that it's important to use ':=' instead of just plain '=' otherwise make
launches a fresh shell and re-runs the uname command every time you refer to
$(KERNELVERSION)!



    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....



_______________________________________________
Help-make mailing list
Help-make@gnu.org
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to