Parsing the output of 'gmake --version' isn't going to be easy if Mr Stallman
keeps changing the format of the version blurb. You could change the regexp to
/gnu make (?:version )?(\S+)/i
To solve the version numbering scheme problem, you can use the 'v' notation and
string comparisons. example:
$v = eval "v$1"; die if (($v cmp v3.78.6) < 0);
(of course, double up the $ if you put this in a makefile)
The "v" notation is only available in perl 5.6.0 and after. It creates a string
of bytes (so it won't be useful for TeX's version counting...). It is useful
for generating IPv4 addresses too.
-Mark
Mark Lakata, Staff Engineer 1225 Charleston Road voice 650-567-5170
MIPS Technologies Mountain View CA 94043 fax 650-567-5002
On Thu, 5 Jun 2003, Ted Stern wrote:
> On 4 Jun 2003, Mark Lakata wrote:
> >
> > Makefile.versiondep: FORCE
> > @(perl -e '($$v) = `gmake --version` =~/version (\S+),/; die "old
> > make detected, found $v, need 3.78\n" if $$v < 3.78' && touch $@ ) || ( rm
> > -f $@; false )
>
> The perl arithmetic comparison is fragile -- what about GNU make version lines
> that return as follows?
>
> GNU make 3.80
> GNU Make version 3.79.1
>
> Ted
> --
> Ted Stern Applications Group
> Cray Inc. office: 206-701-2182
> 411 First Avenue South, Suite 600 cell: 206-383-1049
> Seattle, WA 98104-2860 FAX: 206-701-2500
>
> Frango ut patefaciam -- I break that I may reveal
> (The Paleontological Society motto, equally apropos for debugging)
>
|