help-make
[Top][All Lists]
Advanced

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

Re: followup to previous question


From: Robert P. J. Day
Subject: Re: followup to previous question
Date: Thu, 23 Jun 2005 16:16:51 -0400 (EDT)

On Thu, 23 Jun 2005, Paul D. Smith wrote:

> %% Regarding followup to previous question; you wrote:
>
>   rpjd> there's a top-level VERSION file, whose contents will be something
>   rpjd> like "3.2.2".  so, for now, i can use:
>
>   rpjd> SRCDIR = [top of source tree]
>   rpjd> FULL_VERSION := $(shell cat ${SRCDIR}/VERSION)
>   rpjd> $(warning Full version is ${FULL_VERSION}.)
>
>   rpjd> MAJOR_VERSION := $(shell expr ${FULL_VERSION} : "\([0-9]*\)")
>   rpjd> $(warning version is ${MAJOR_VERSION}.)
>
>   rpjd> even though the above works, i'm just betting there's a more natural
>   rpjd> way to do either of:
>
>   rpjd> 1) get the contents of a one-line text file
>   rpjd> 2) extract the leading fully-numeric substring of a string
>
>   rpjd> am i right?  or is the above pretty much it?
>
> That's about it as far as getting the contents.  You can get the
> major version much more easily, though:
>
>     MAJOR_VERSION := $(firstword $(subst ., ,$(FULL_VERSION)))
>
> If the VERSION file had a make-like syntax, like:
>
>     FULL_VERSION = 3.2.2
>
> then you could, of course, just include it.

nope, it really is just the version string, but i can at least do the
firstword/subst trick on that.  thanks.

rday




reply via email to

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