* Stephen Montgomery-Smith <step...@missouri.edu> [2012-06-21 19:59]:

> I was looking at the Makefile, and it had some comments asking for 
> suggestions for how to extract the version numbers of octave.
> 
> How about:
> 
> majorversion := $(shell mkoctfile --version 2>&1 \
> | awk -F '[. ]' '{print $$3}')
> minorversion := $(shell mkoctfile --version 2>&1 \
> | awk -F '[. ]' '{print $$4}')
> microversion := $(shell mkoctfile --version 2>&1 \
> | awk -F '[. ]' '{print $$5}')
> 
> The backslashes are there only because I can't fit it all on one line 
> with my email client.
> 
> Or:
> 
> majorversion := $(word 3,$(shell mkoctfile --version 2>&1 \
> | sed 's/\./ /g'))
> minorversion := $(word 4,$(shell mkoctfile --version 2>&1 \
> | sed 's/\./ /g'))
> microversion := $(word 5,$(shell mkoctfile --version 2>&1 \
> | sed 's/\./ /g'))

Your proposed code is cleaner than the original one, even though there is
no need to fix things that are not broken.  At any rate, please, avoid
the solution that use awk, since this would introduce an extra
build-dependency in systems like Debian.

Rafael

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Octave-dev mailing list
Octave-dev@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to