[Top][All Lists]

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

Re: followup to previous question

From: Paul D. Smith
Subject: Re: followup to previous question
Date: Thu, 23 Jun 2005 14:41:25 -0400

%% 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.

 Paul D. Smith <address@hidden>          Find some GNU make tips at:            
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist

reply via email to

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