diff --git a/cpu/mips/config.mk b/cpu/mips/config.mk
index b505a42550c2845e035ae976d711088a25346e71..a173c5480c0131e2c89808fee7f6398737061b52 100644
--- a/cpu/mips/config.mk
+++ b/cpu/mips/config.mk
@@ -20,7 +20,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston,
 # MA 02111-1307 USA
 #
-v=$(shell $(AS) --version |grep "GNU assembler" |cut -d. -f2)
+v=$(shell $(AS) --version | grep 'GNU assembler' | egrep -o '2\.[0-9\.]+' | cut -d. -f2)
 MIPSFLAGS:=$(shell \
 if [ "$v" -lt "14" ]; then \
 	echo "-mcpu=4kc"; \