help-make
[Top][All Lists]
Advanced

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

Re: Internal make command Macro to identify linux/os distribution.


From: Martin Sebor
Subject: Re: Internal make command Macro to identify linux/os distribution.
Date: Tue, 09 Sep 2008 08:54:12 -0600
User-agent: Thunderbird 2.0.0.16 (X11/20080723)

Gautam Shejwalkar wrote:
Hi Dave,

Thank you for your quick reply.

Yes, I was referring to the distro. Actually based on the distro I want to decide which rpm package needs to be installed. B'coz only in uname -r we get the information on the distro. I am not sure if there are any other commands available for checking the distro type.
Any way the solution which you have mentioned is a good one.

The file /etc/*-release identifies the Linux distribution.
Here's a pretty extensive list:
    http://linuxmafia.com/faq/Admin/release-files.html

Martin


Regards,
-SG

On Tue, Sep 9, 2008 at 3:59 PM, Dave Korn <address@hidden <mailto:address@hidden>> wrote:

    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
address@hidden
http://lists.gnu.org/mailman/listinfo/help-make





reply via email to

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