Mail Archives: djgpp/2000/06/22/04:39:46
On Wed, 21 Jun 2000, Richard Dawe wrote:
> > > GAS_VERSION := $(shell as --version | sed -n 's/^GNU assembler //p')
> > > GAS_MAJOR := $(shell echo $(GAS_VERSION) \
> > > | sed -n 's/^\([0-9]*\).*/\1/p')
> > > GAS_MINOR := $(shell echo $(GAS_VERSION) \
> > > | sed -n 's/^[0-9]*\.\([0-9]*\).*/\1/p')
> > > GAS_MINORMINOR := $(shell echo $(GAS_VERSION) \
> > > | sed -n 's/^[0-9]*\.[0-9]*\.\([0-9]*\).*/\1/p')
>
> > > Is this satisfactory? My sed knowledge is limited (*), but this seems
> > > to do the trick.
> >
> > The Sed scripts can be improved slightly, but they seem to be correct.
>
> Sure, please tell me how, when you have time.
The last script could be simplified like this:
GAS_MINORMINOR := $(shell echo $(GAS_VERSION) \
| sed -n 's/.*\.\([0-9][0-9]*\)$/\1/p')
Also note that [0-9]* can pick up zero characters, so [0-9][0-9]* is
safer.
- Raw text -